Page 1 of 1

Odd Speed Readings Of Motor Speeds with 2x7A

Posted: Thu Jun 10, 2021 7:05 am
by vch
So I'm using the roboclaw 2x7A to control two 12V DC motors. I've been using an Arduino Due as the microcontroller and thus programming in the Arduino IDE. In the IDE there's a roboclaw library with different commands to control the motor controller. So I've been trying to read the speeds of the motors when they're both on and off. My code basically runs a 3s on for one motor whilst the other one is off, and then the next 3s the other one turns on while the first one turns off. This cycle continues to repeat until I've collected enough data. So I've noticed that when the motors are on, I get consistent speed readings using the ReadSpeedM1 or ReadSpeedM2 commands. However, when the motors are on their off cycle, they will slowly decrease to zero but I'll get sporadic readings that are way to high to make sense (like 4 million). I was wondering if anyone else has had an issue similar to mine and if there's a solution for it. Any insight would be much appreciated!

Re: Odd Speed Readings Of Motor Speeds with 2x7A

Posted: Thu Jun 10, 2021 6:28 pm
by Basicmicro Support
Speed will go to zero when the motor stops. Note the Speed reading is a 1 second average. The ISpeed reading is the 1/300th of a second instant speed.

If you have noise on your encoder inputs you could get an instantaneous speed of up to 9.8 million. Enough noise could cause the symptom you describe. To fix encoder noise issues the simplest solution is usually to add .01uf caps from each encoder signal(A/B) to ground.

Re: Odd Speed Readings Of Motor Speeds with 2x7A

Posted: Fri Jul 09, 2021 8:58 am
by vch
So unfortunately, the addition of a capacitor at each encoder signal did not help with the encoder noise. Is there another possible solution for solving this. Again the issue occurs when the motors are slowing down to zero I'm getting readings close to 4.5 million. Thanks!

Re: Odd Speed Readings Of Motor Speeds with 2x7A

Posted: Mon Jul 12, 2021 1:34 pm
by Basicmicro Support
Please show a printout of the speed values you are seeing here. Along with your code.