I have connected a CIM motor to a Jaguar speed controller, powered by a 12V battery. The Jaguar is connected to an Arduino Uno via the signal and ground. Also, I have two switches connected to the Arduino, for forward and reverse of the motor.

In the code, for speed of the motor, I have set 90 as the mid point and 100 for forward and 80 for reverse. When I push the reverse button, the motor runs smoothly in the reverse direction at the set speed. However, the problem is, when I press the forward button, the motor runs seemingly slower in the forward direction than the set speed.

My logic here was, if I have set speeds in forward and reverse at +/- 10 from the mid-point, the motor should run at the same speed in the forward and reverse direction, but this is not happening.

I am pasting my code below. Any help would be much appreciated. Thank you!

#include <Servo.h> 

int forwardPin = 2;
int reversePin = 4;
int motorPin = 10;
int fwdReading = 0;
int revReading = 0;

Servo myservo;

void setup() {
  TCCR1B = TCCR1B & 0b11111000 | 0x04; // PWM Freq. at 122Hz
  pinMode (forwardPin, INPUT);
  pinMode (reversePin, INPUT);
  myservo.write(90);  // set servo to mid-point

void loop() {
  fwdReading = digitalRead(forwardPin);
  revReading = digitalRead(reversePin);
  if (fwdReading == HIGH) {
    myservo.write(100); // forward
  } else if (revReading == HIGH) {
    myservo.write(80); // reverse
  } else
    myservo.write(90); // neutral
  • When I read Jaguar speed controller I imagined you were mounting this on a Jaguar XD anyway how do you detect that the motor is slower? How much slower? Did you get quantitative measures (e.g. with an encoder)?
    – frarugi87
    Apr 5, 2016 at 8:28
  • @frarugi87 Haha... Btw, no I haven't measured it, but by eyeballing one can tell that it is slower than the other direction.
    – Arrow
    Apr 5, 2016 at 18:48
  • Is there anything attached to it? And.. It would be better to test it using an encoder. And, in the end, remember that the controller board does not control speed directly, but just the voltage (and so the speed will not be controlled very well). I don't know if that controller board supports a speed feedback, but if you require a precise speed then you'd better switch to a closed loop design (either integrated - but I don't know them) or build one yourself
    – frarugi87
    Apr 5, 2016 at 22:22

1 Answer 1


I searched for the library you're using and the arduino website mentions :

0 being full-speed in one direction, 180 being full speed in the other, and a value near 90 being no movement

From this we can take that the value 90 is not perfectly in the middle of the speed range therefore 10 points under 90 won't necessarily be equivalent to 10 points above 90. My only advice is to try and find the equivalence point yourself by trail and error. Even though 90 seems to cause no movement, try 89 or 91 see if they also have the result and so on.

Or simply try different values to get same speeds in different directions, it's ok if you use different values (away from 90) for the two different directions :P.

Gd Luck

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.