5 months, 1 week ago.

Integrating speed sensor SNG-QPMB-000 with NUCLEOF103RB?

I am using Hall effect speed sensor to measure the speed of my electric vehicle. I am using microcontroller NUCLEOF103RB. I used the reference design attached below which was mentioned in the datasheet of sensor. I used load resistance of 200 ohm, as i used 5 volt to power the sensor. I used PwmIn.h header file to read period of pwm output of the sensor. I used below attached code to read sensor output. I am not able sense the speed properly and sensor is giving random output irrespective of speed. Can anyone please help me to sort this issue? /media/uploads/DheerajEtta/code.png /media/uploads/DheerajEtta/speed.png

1 Answer

5 months, 1 week ago.

Hello Dheeraj,

  • The SNG-QPMB-000 is a quadrature speed and direction sensor so I'd recommend to try the Quadrature Encoder Interface library. Although it deals primarily with optical quadrature encoders the interface works with any encoder that provides quadrature outputs.
  • Please note that not all pins on a NUCLEO-F103RB board are 5V tolerant. Especially the analog inputs are sensitive and could be damaged when connected to 5V! Either use 3.3V to power the sensor or select 5V tolerant pins as inputs. Although not all NUCLEO-F103 pins are available on a BluePill board this pinout could help.
  • You might need to add small capacitors to improve the performance as suggested here by Wim.