Page 1 of 1

Wrong Encoder Reading with roboclaw.Duty command

Posted: Tue Jun 18, 2019 12:21 am
by Ellimc
Hi
I tried to controle my robot. Sometime I will need to control it on Force or torque if you prefer. So I was thinking the roboclaw.DutyM1(...) was the right command to do this but when I use it the encoder reading become wrong. It is as if when I send the roboclaw.DutyM1(...) the zero of the encoder just slide to another position...When the duty is low, the motor mouves but the encoder reading do not increase. Then if I put a higher duty to the motor then the encoder start to count.
This problem does not appear when I use the velocity PIV and the position PID... What can I do?
Thank you in advence
Camille :D

Re: Wrong Encoder Reading with roboclaw.Duty command

Posted: Tue Jun 18, 2019 9:52 am
by Basicmicro Support
It sounds like something is wrong with your encoder signal. Check the encoder signal on an oscilloscope if you have access to one.

If you are using a motor with the built in hall encoders(eg the really inexpensive encoders) this have a known issue with passing motor noise into the encoder signal line(and 5v power). You can fix this by adding a .01uf cap from each signal line to ground. I also recommend putting a .1uf cap from the 5v connection to ground as well to help prevent noise getting back into the logic circuit of the Robocalw that way.