RoboticsGeneral

Raspberry Pi DC motor driver encoder pulse count

userHead Account cancelled 2020-10-09 07:42:02 4992 Views8 Replies
Hi Everyone,

I have a Raspberry Pi DC motor driver hat with encoders and was wondering if there is a way to get the encoder pulse count, rather than the speed from the hat?

Thanks for your advice!

Cheers,

Mick
2021-11-09 14:30:03 The encoder pulses are counted on the Arduino board via two of the board's Digital Inputs. One of the board's Digital Outputs is also employed to switch a Mybpcreditcard transistor on and off, thereby connecting and disconnecting the motor to a DC voltage source. userHeadPic nandlastrategy
2021-09-11 07:27:52 Hi All,
Yes, I am doing the project with Gp36 Planetary Geared Motor With Encoder-dc Motor-1:14-1000cpr and I have the same question and found it here. I am new to encoder so please correct me if I am wrong.
I can output the speed of the encoder. For instance it is 5530 rpm with 1000 frequency by default. The reduction ratio is 1:14 so
motor_speed = 5530 / 14
pulse count = 1000 * 60 / 5530?

Thanks
userHeadPic nodochau
2020-11-11 23:45:34 Thanks for the update guys. navyarmyccu userHeadPic janejenkins19844
2020-11-11 23:08:31 Thanks for the update and quick reply. I'll be sure to keep an eye on this thread Official Site userHeadPic tinapowell42
2020-11-06 23:12:53 Hi,bro,of course we can count the pulses of pwm. You just need to record the total running time of the motor. You can use this function: unsigned int millis (void); or unsigned int micros (void);. You can record at the beginning and at the end.Multiply the time difference by the frequency (the default value is 1000, you can set it yourself) to get the number of pulses. Since your purpose is to measure distance, it can also be calculated using the motor speed. You just need to multiply the total time by the speed. Please pay attention to the unit conversion. userHeadPic wangyf8797
2020-11-03 05:48:47 I am trying to measure distance. I suppose counting pulses would be nice.
Can we count pulses with this HAT?

Regards
userHeadPic ano.nemo
2020-10-28 09:28:28 Hi,

is it possible to elaborate some more? Can you point to a resource to read into this?

Thanks in advance
Ano
userHeadPic ano.nemo
2020-10-14 23:36:21 There is a function set_moter_pwm_frequency(frequency) in the library of the motor drive to set the frequency of the pwm signal, the default frequency is 1000Hz
It should be able to get the number of pulses according to time.
userHeadPic 347945801