Vex motor erratic behavior

Hello All, I am building a circuit that drives a Vex motor ( using the Servo library. The motor is powered from the Duemilanove's Vin connector and its signal is generated digital pin 9.

The whole board is running on a 9v power supply.

My problem is that even after i send the servo.detach() command, the motor displays very erratic behavior. It will suddenlty start turning at random times and wildly different sppeds and directions.

I've read that motors may require having a capacitor connected to them in order to ensure they receive a steady and clean source of power. Is this true? if so, could this be the reason for the erratic beahior? Lastly, if this is the case, would you please recommend the appropiate capacitor that would be needed for this motor (see link above for details)

Thank you all for your help!


If that's just a modded servo (I think it says it is) then the motor should have a capacitor fitted.

What is the rating of the 9V supply? Have you got a common ground?

What is the rating of the 9V supply?

I don't have the equipment in front of me. However, im pretty sure it is a 9v and 600mA wall adapter.

Have you got a common ground?

I am not sure what you mean by "common" However the motor's ground cable is connected to the Arduino's ground on the digital pins row side. I also have a photo resistor grounded to the same pin.

I should have mentioned this too: i also have a small laser pointer being powered by the board. It is grounded on the Analog side ground pin.

Thanks for your patience with a novice like myself!

OK, what happens when you take away the laser?

I’d be inclined to write a short program (probably only about 20 or 30 lines) to just control the motor (even replace it with an actual servo if you’ve got one).
Disconnect everything else - just loop values to the servo object with a few tens of milliseconds between writes. See if it behaves.

I am not sure what you mean by “common” However the motor’s ground cable is connected to the Arduino’s ground on the digital pins row side.

That’s a common ground.

From the website:

4.4 - 15 Volts (Motor life will be reduced operating outside the VEX Controller range of 5.5 - 9.0 Volts

You’re running it from 9V?
Is the power supply regulated?
Can you check the voltage on Vin?

If you’ve got a 4xAA battery pack, try powering the motor from that (don’t connect the + side of the battery pack to the Arduino, just the -), and continue with the power supply for the Arduino.

OK, what happens when you take away the laser?

I am pretty sure it acted the same way even without the photo resistor and the laser connected to it.

I will try your suggestions when i get home. i have a spare board so i will write the program to it.

Again, thanks again for all your help. I will update this post with my results.


i have got the same(or atleast 90% similar) erratic behavior ...i am using "tower pro mg995r" servo, but the same program(servo lib examples) works without problem with "tower pro sg51r" servo. using different source 9 volt batery for the servo didnt help.

Hello... Back to see if i can get further assistance with this issue!

I have configured several circuits using the Vex motor stated in earlier posts on this thread. I think my issue is with the complexity of the circuit that i am using for my project. There may be a short or some other type of issue that i just cannot detect. Below is a diagram of the circuit i am using...

The xbee controller is from this kit

The laser pointer is from SparkFun

If anyone could take a look at it and see if you notice any major issues or problems that could case the servo motor to randomly run without control, i would truly appreciate it.

Thanks again!


Hello All, I found a solution to my problem. It is related to an issue called decoupling.

After reading the above article, i started playing with my circuit trying to figure out where to add the appropiate capacitors. My problem was that, for some reason, i thought that i had to add a capacitor to the servo's ground connection. after i removed this capacitor and added it to the the signal connection, my device stopped its erratic behavior. The servo ran ONLY when i sent it the appropiate command.

Hope this is helpful to anyone else having erratic motor behavior issues. Good luck!!