Go Down

Topic: Arduino Mini pro servo control - driver required? (Read 840 times) previous topic - next topic

BigusDickus

Hi,

I'm having some problems with a servo based design, I'm not sure if I can directly control a servo from an arduino without some form of driver.

Here's the setup. I'm controlling a pair of small 6 volt servos (Futaba S3170G hi torque, http://www.futabarc.com/servos/digital.html) from an arduino mini pro (http://arduino.cc/en/Main/ArduinoBoardProMini). The arduino and servos share a common ground, a 12 volt supply powers the arduino, and a 6v regulator that powers the servos. The control wire for each servo is connected directly to a PWM pin on the mini. The position of each servo is controlled via a joystick, the joystick consists of a pair of servos set up as voltage dividers which control the voltage at two analog intput pins.

First the good news, it all works - most of the time! I've written a simple library and sketch that a) reads the analogue input voltage from the joystick, b) converts this to a servo position (in degrees) and c) converts this into a pulse width. The sketch displays these values on the screen AND sets the positions of the servos using servo.writeMicroseconds(). The problem is that after about five minutes of operating perfectly correctly, the servos just stop moving, the sketch continues to run fine, it continues to show all the expected values on the screen, but the servos don't move. Here's what I've checked so far....
a)   The battery voltage (supplying the arduino mini and regulator) remains at about 12 volts
b)   The output voltage from the regulator remains at 6 volts.
c)   The first time this happened I thought there was a fault with the arduino, so I tried with a 2nd one and got the same results.
d)   When the servos stop working they both stop working at the same time - so I'm guessing problem is with the arduino, not the servos.
e)   I've also tried some old unlabled servos from an old project and get the same results.
f)   There's no sign of anything overheating.
g)   Since the sketch continues to run and display the expected values on the screen, I think it's more likely to be hardware issue than a software one.
h)   When I plug the servos into a servo test unit they work fine.
The only cure seems to be to switch everything off for ten minutes, and then switch it on again, at which point it's works again for another few minutes before failing.

My conclusions so far are....
a)   Since the time that everything will work for varies from a couple of minutes to over five minutes I don't think this has anything to do with integers overflowing or anything like that.
b)   A simple reset will NOT cure the problem, again suggesting that it's not related to buffer overflows or other corruption. I can only get it to work again by switching everything off for a few minutes.
c)   The sketch continues to correctly display all the joystick changes, and the corresponding pulse widths even after the servos have stopped moving - so the code is still working, but servo.writeMicroseconds() isn't doing it's stuff.
d)   If, when the servo stop moving I immediately unplug it and connect it to a servo-tester it works fine. So the problem isn't with the servo.

My current best guess is that the pulse width modulated signal coming from  the arduino is somehow faulty or deficient, could it be that some form of driver is required? Could the servo be drawing more current through the control pin than the arduino can supply? Unfortuantely I don't have access to an oscilloscope, so can't check the PWM output. Any suggestions? Am  I missing anything obvious? I can post the code if anyone thinks it's the likely cause.

Thanks

MarkT

Quote
The control wire for each servo is connected directly to a PWM pin on the mini.


No need, the Servo library drives _any_ pin equally well, doesn't use hardware PWM.

What current can your supply source? What current can your regulator handle without overload?
What is the peak current demand of each servo?   How hot is the 6V regulator getting?
[ I won't respond to messages, use the forum please ]

BigusDickus

Quote
What current can your supply source?
plenty - it's a lead acid battery.
Quote
What current can your regulator handle without overload?
0.5 amp.
Quote
What is the peak current demand of each servo?
just a few milliamps, I haven't connected them to a load yet.
Quote
How hot is the 6V regulator getting?
It's barely getting warm.

Thanks

Go Up