Go Down

Topic: Unexpected servo behaviour (Read 3737 times) previous topic - next topic

Dblackb99

I have a small project to drive a servo with an Arduino Pro Mini using 2 push buttons - one for clockwise movement and the other for counterclockwise movement. The logic is simple and the sketch is correct. The problem I am having is the servo behavior varies with the power source and whether I have an ammeter in the circuit. A copy of the schematic is attached.

If the circuit is powered from a USB connection (bypassing the 7805 voltage regulator) the servo works as intended.
If it is powered from a 9V battery the servo movements are erratic and often it will simply stall and not move at all until power is reset.
However, if I plug an ammeter into the circuit between the voltage regulator and the servo power pin the servo works as intended.

Clearly the ammeter is having some effect but I can't figure out what that is and how to either replicate it in my circuit or design my circuit so it isn't an issue.

I'm pretty new to this so any help would be appreciated.

Thanks

zoomkat

Quote
Clearly the ammeter is having some effect but I can't figure out what that is and how to either replicate it in my circuit or design my circuit so it isn't an issue.


Placing an ammeter in a circuit is basically the same as placing a piece of wire in a circuit.


Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Dblackb99

Quote
Placing an ammeter in a circuit is basically the same as placing a piece of wire in a circuit.


That was my understanding, but then why would the servo behave differently?

retrolefty


I have a small project to drive a servo with an Arduino Pro Mini using 2 push buttons - one for clockwise movement and the other for counterclockwise movement. The logic is simple and the sketch is correct. The problem I am having is the servo behavior varies with the power source and whether I have an ammeter in the circuit. A copy of the schematic is attached.

If the circuit is powered from a USB connection (bypassing the 7805 voltage regulator) the servo works as intended.
If it is powered from a 9V battery the servo movements are erratic and often it will simply stall and not move at all until power is reset.

Those small 9 volt batteries were designed to power smoke alarms and garage door openers, they really can't supply the current required to operate a motor in a servo.

However, if I plug an ammeter into the circuit between the voltage regulator and the servo power pin the servo works as intended.

Depending on your specific current meter most use  a current shunt resistor in series that measures the voltage drop to calculate the current flow, so it in effects drops a small amount of voltage depending on the shunt resistor size and as your 9 volt battery's voltage is probably already sagging with the current draw from the servo the current meter is just making the problem a little worst. Measure the actual 5 volt pin while you are trying to operate the servo while on the 9 volt battery and see what it says, most likely the 9 volt battery's voltage is dropping below the minimum input voltage specification for the 5 volt regulator chip and not providing the servo with a steady regulated +5vdc.
Lefty


Clearly the ammeter is having some effect but I can't figure out what that is and how to either replicate it in my circuit or design my circuit so it isn't an issue.

I'm pretty new to this so any help would be appreciated.

Thanks

Dblackb99

Quote
Measure the actual 5 volt pin while you are trying to operate the servo while on the 9 volt battery and see what it says, most likely the 9 volt battery's voltage is dropping below the minimum input voltage specification for the 5 volt regulator chip and not providing the servo with a steady regulated +5vdc.


I've done that and am getting a nice, steady 5vdc when operating the servo.

But if the problem was the battery couldn't provide the needed current, why would the servo work only when I added load to the circuit through the ammeter?

zoomkat

Quote
But if the problem was the battery couldn't provide the needed current, why would the servo work only when I added load to the circuit through the ammeter?


Perhaps you jumpered around the voltage regulator with the ammeter, directly feeding the board/servo from the battery. Only you know how you have put the ammeter in the circuit.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Dblackb99

Quote
Perhaps you jumpered around the voltage regulator with the ammeter, directly feeding the board/servo from the battery. Only you know how you have put the ammeter in the circuit.

Nope, that's not it. The ammeter was plugged in between the output of the voltage regulator (5vdc) and the servo. I'm beginning to suspect the servo may be defective, but that still doesn't really explain the behaviour I'm experiencing.

Robin2

#7
May 28, 2013, 08:41 am Last Edit: May 28, 2013, 08:44 am by Robin2 Reason: 1
Perhaps the ammeter (which is a very low value resistor) was restricting the flow of current to the servo just enough to keep the voltage at the Arduino high enough for the Arduino to work properly.

Try connecting a piece of wire between the points where you had the ammeter connected. If the behaviour is the same as it is with the ammeter my guess is wrong.

By the way check that your ground connections are good. I had some very strange servo behaviour when the ground connection between the servo power and the Arduino board came a bit loose.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Dblackb99

Okay, after lots of testing, component isolation, etc it appears the problem is somewhere in my power supply/voltage regulator circuit. The Arduino itself is working fine, and when I power the servo from the Vcc pin on the Arduino the servo works properly. But when I power it directly from the 5v output side of the voltage regulator it starts acting erratically so I expect there's some sort of power fluctuation happening there. My understanding was that the two capacitors were supposed to modulate any variability. Is that correct?  Am I using the wrong size capacitors?

I could power the servo from the Arduino itself but most knowledgeable users suggest against doing that because of the small size of the voltage regulator on the board and possible overheating problems. That's why I am trying to use a separate voltage regulator, to isolate the board from the 9v supply.

Any other suggestions?


zoomkat

Quote
when I power the servo from the Vcc pin on the Arduino the servo works properly. But when I power it directly from the 5v output side of the voltage regulator it starts acting erratically so I expect there's some sort of power fluctuation happening there.


Perhaps you should check the Vcc pin voltage and see if is the direct input from the battery. The onboard voltage regulator on the arduino is not sized to power motors, and you may be causing an under voltage condition on the arduino when you connect the servo to the 5v pin. You connect the arduino to a large 9v power supply and you might damage the arduino voltage regulator chip when the servo is under load.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Dblackb99

I have solved the problem, although I'm not sure why it works this way. I rewired the Arduino to take 9V power through the RAW pin. I left the servo drawing its power through the 5V voltage regulator. By separating the two devices power sources the erratic servo behaviour has now gone away. If anyone knows why that would be I'd be interested in hearing it, but for now I'm just happy it's working. :D

Go Up