Go Down

Topic: Controlling servo motors using RC transmitter/receiver and Arudino (Read 5 times) previous topic - next topic


Code: [Select]
degree = ((ch3-1250)* 180)/700;
So, let's say "ch3" is 1950.
(1950 - 1250) = 700.
700 * 180 = 126000.


Try promoting your constants to "long"
Code: [Select]
degree = ((ch3-1250L)* 180L)/700L;

Edit: Or divide top and bottom by ten.   :)  (Hey! It's Monday morning, and I haven't had any coffee yet)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


You could automatically calibrate to whatever range the transmitter is sending, you will often find that is different even for channels on the same transmitter.

Here is an example of RC Code with calibration, it also stores the calibration in EEPROM so after the first calibration you only need to recalibrate if you change transmitters.


The bit you would need to change is inside if(gMode == MODE_RUN) this is designed to map steering and throttle channels into the left and right throttle values required for a tracked vehicle - not servos. You will want to use the map function to map the limited range from your RC Receiver into the full range allowed by your servos - i.e.


Duane B



Hey AWOL, thank you very much for the advice! Im getting full range of motion out of my servo now. I doubt I would have ever thought of or found that correction you suggested.

DuaneB, I will run into that problem sooner or later. Thanks for the tip in advance. I will work on it in the next few days.

I am facing another problem now. My servo seems to be able to move into position how every its "glitching" or pulsating around that position. Any idea what is going on?



One of four things

1) you need a common ground between the servos, receiver and arduino.

2) too many volts, servos are usually best at 6 volts

3) Not enough amps - you need separate power for the servos and arduino - check the links in my signature below

4) if 1 to 3 are in place, its usually code.

Duane B


I've have ensured that the servo is getting 6v and sufficient current by connecting it to an external power supply. I have also connected it to common ground on the arduino. Servo sweep example ran without a problem.

When I check the serial prints. I notice the values fluctuating around the "set" values. Could this just be the servos reacting directly to the fluctuations. If so, how do you suggest I rectify it?

Go Up