Odd Speed Readings Of Motor Speeds with 2x7A

General discussion of using Roboclaw motor controllers
Post Reply
vch
Posts: 3
Joined: Mon May 31, 2021 12:17 pm

Odd Speed Readings Of Motor Speeds with 2x7A

Post by vch » Thu Jun 10, 2021 7:05 am

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!

User avatar
Basicmicro Support
Posts: 1555
Joined: Thu Feb 26, 2015 9:45 pm

Re: Odd Speed Readings Of Motor Speeds with 2x7A

Post by Basicmicro Support » Thu Jun 10, 2021 6:28 pm

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.

vch
Posts: 3
Joined: Mon May 31, 2021 12:17 pm

Re: Odd Speed Readings Of Motor Speeds with 2x7A

Post by vch » Fri Jul 09, 2021 8:58 am

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!

User avatar
Basicmicro Support
Posts: 1555
Joined: Thu Feb 26, 2015 9:45 pm

Re: Odd Speed Readings Of Motor Speeds with 2x7A

Post by Basicmicro Support » Mon Jul 12, 2021 1:34 pm

Please show a printout of the speed values you are seeing here. Along with your code.

Post Reply