Arduino with Vex motor

I have a 2 wire Vex motor and a motor controller 29 which is basically a H bridge. I am using the servo library because they say with this motor controller 29 it should work like a servo. In my code I am using the .write method of my servo object. I am writing the code to move the motor forward for 3 seconds and stop for 3 seconds and then backwards for 3 seconds. When I measure the output of the motor controller 29 it shows +7.4 volts and then a very low MA that keeps changing and then -7.4 volts. That is basically what I programmed but when I plug it into the motor the motor makes a sound like it has very little voltage that is not enough to move it and it does not move. The motors work fine if I hook them directly to the battery.

I have tried 2 different battery configurations. A 6 V for the motor and a 9 V for the Arduino. I have also tried powering both off the 9 V. I tried to find an answer online and tried wiring a low pass filter with a 1K resistor and a 1uF compositor to the output of the arduino. That did get the motor moving but only in only 1 direction and the output I measure is now + 7.4 volts and the pause then +7.4 volts again and does not reverse the polarity. Can anybody please make any suggestions on how to solve this problem?

Hi, can you please post a copy of your circuit and your program so we can better help you with the problem.
Tom.... :slight_smile:

Sure. This is a diagram with out the low pass filter. I can post with it later but I only had time to post this for now. Thanks

Code
#include <Servo.h>

Servo myServo;

void setup()
{
myServo.attach (9);
}

void loop()
{
myServo.write(160);
delay(3000);

myServo.write(91);
delay(3000);

myServo.write(20);
delay(3000);

myServo.write(91);
delay(3000);
}

Hi, you shouldn't need a LPF on the arduino output , the output going to the servo control is a pulse with varying duty cycle, so remove the filter as this will distort the waveform.
Also is it a drawing mistake , have you got arduino ground connected to servo supply positive, it should be to the negative.
Normal convention RED positive, BLACK negative.
Is the controller happy with 5V control?

Tom... :slight_smile:

Yea sorry I was in a hurry and drew it kind of fast. It the + and - are backward and the colors are off on the diagram. I thought about putting the low pass filter on the output of the controller 29 but since it will reverse the polarities to move the motor the other direction I did not know if that would work.

http://robomatter.com/Shop-By-Robot/VEX-Robots/Hardware/Electronics/VEX-Motor-Controller-29

Is worth a look at, it tells you what the pulse length should be for fwd, stop and reverse.
You will have to check what the arduino servo library puts out.

Tom...sorry can't be of anymore help at the moment, its 7:30am and I have to go to work.... :slight_smile:

Controller seems to take an absolute maximum supply voltage 8.5V, normally a 7.2V
NiMH pack or 2S LiPo is assumed. Its rated at 3A stall, so presumably the motor needs
an amp or so to function. Presumably 6V wlll work for it, but 9V is not advised. What current
can your supply(s) produce? Is it enough?

Thanks to you both! I really appreciate it! I took a weeks off work to build this robot and could not get any where because I could not program the motors to work.

You are on to something with the amperage. I set my meter to measure amps and it showed 0.01 so I set it to milliamps and the motor started working flawlessly. I measured around 300 milliamps. Which I think is weird since it measured .01 amps. Isn't that 10 milliamps? I think my meter must be supplying some amperage for its measurements.

Hi, check the fuses inside your multi-meter..
Tom.... :slight_smile:

Since what they normally use with these motors is a hobby 7.2 NIHI 3000 MAH; If i use this instead of the alkaline 9 V I was using do you think that will increase the amperage on the out put of that motor controller 29?

By the way here is a corrected diagram:

Update - I got the new 7.2 V NiMh battery and it is working fine now. I can not believe that I did not think to check the current. I guess it did not work from the 9 V battery because I was powering the Arduino from the same source as my motor. I still don't know why it didn't work with 4 AAA batteries for the motor and with the separate 9 v for the Arduino. That is enough to power this motor directly but did not pass the current when it when through the controller 29 h bridge. Any way at least I got it working. :smiley: