Servo motor issue with arduino

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
It was quicker for me to take a picture than for a schematic :p Hope it is clear enough. I can get the servo to work when the 5v is connected directly into the arduino pin. The problem arises when i connect the servo to the regulated 5v. When measuring the output from 5v voltage reg, i get a value of 2v. There has to be a problem with my wiring so let me explain how it is connected.

The three legs of the voltage regulator are connected to ground, with a 0.1μF cap (blue) and a 1μF(yellow). The third leg is connected by the red wire which should be giving a 5v-this is where the 2v measurement is coming from. For the servo, the black wire is connected to ground, the red to +5v(currently 2v) and the white wire is connected to the blue wire which is fed into pin 9 on my arduino. The code is fine because i can get it to work as explained above. I just want to know why im having issues here.

Finally, the voltage regulator has a max current of 1.5A and the servo has a max current of 0.5A, could this be causing an issue?

Thanks for any help on this!
 

Attachments

Markd77

Joined Sep 7, 2009
2,806
Those 9V PP3 batteries are poor at high currents. Their voltage drops quickly to unusable levels.
Check the battery voltage with the circuit connected.
Also the regulator is only good for 1.5A with a heatsink, without one it will go into thermal shutdown.
 

KMoffett

Joined Dec 19, 2007
2,918
What is the supply to the 5v regulator? Can't tell which regulator pin is connected to the servo and which is to the raw supply...they're hidden in the photo. What happens to the reg voltage when the servo is unplugged from the breadboard?

Ken
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
Thanks for the replies, the supply i am providing the the voltage reg is currently at 7.5v.On the data sheet it accepts an input of 17v if I remember correctly.

The red (middle wire) is connected to the regulated voltage but nothing is connected from the raw supply to the servo. The raw supply is connected to the red knob on the breadboard and the ground is connected to the green knob. I have then connected a wire to the top of the rail to be my 9v(actually 7.5v currently) and the green wire is connected to the bottom rail for ground. Let me know if i misunderstood what you was asking there.

When the servo is disconnected, the voltage regulator works as it should, producing a 5v output.
 

Markd77

Joined Sep 7, 2009
2,806
A lot of regulators need over 2V higher supply than the regulated voltage if they are going to work properly, especially at higher currents. I don't know which one you have so check the datasheet.
I know you have 2.5V more, but that is cutting it a bit fine, especially if the supply drops a bit under load.
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
@KMoffett. I have the arduino Mega and when i connect the red wire on the servo to +5v on the built in pin on the arduino (and the black wire to ground on the arduino and the white wire to a PWM signal), the servo works as requied. The reason why i want to power the ervo from an external supply is so that i can power multiple servos..
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
@Markd77, i understand what you are saying. Is it right that my output from the external battery should have a regulated voltage of 2v when attaching the servo load? Im going to buy another battery to see if that is the issue but it just seems really strange if that is the case..
 

SgtWookie

Joined Jul 17, 2007
22,230
With a 7805 or LM340-5, looking at it so that you can read the part number, the left pin is #1, and it is the input. Pin 2 is GND, pin 3 is OUT.

The way you have your caps on the board, there is a LOT of wire from caps to ground. This means inductance, which can easily cause the regulator to oscillate at high frequencies; I've had it happen myself. I was measuring between 1.6v and 2.3v with an O-scope when it was oscillating.

Put the 1uF cap in the breadboard so that it's directly across pins 1 and 2. Put the 0.1uF cap in the breadboard so that it's directly across pins 2 and 3. Both caps should have pretty short leads, and be very close to the regulator.
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
@StgWookie i did as you said and also changed my battery to a brand new 9v. The servo moved however it was not doing what it should have been doing. It should rotate every 20degrees until it gets to 180 degrees and then reverse direction back to the beginning. The servo was increasing by 20 degrees and after the third increment, it started spinning forwards and backwards. Also, the battery dropped to 7.5v again and the voltage regulator stopped working again. Im draining batterys like crazy which makes me continue to doubt my wired circuit...
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
ok then. Im thinking of buying a barrel jack socket to fit onto the breadboard. If anyone has brought one, would it be possible to write the product name for me :) I have been looking on farnell but was unable to find the three pinned device.
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
I would like a through mount one, one that can connect through the holes of my breadboard.

Im currently downstairs..only joking :p i live in England. Farnell is a good website for me to order from but i dont mind searching around for the product if im given the manufacturers name :)
 

Thread Starter

u-will-neva-no

Joined Mar 22, 2011
230
Is switched contact where it switches on and off? Im not too fussed if that is the case, i was going to buy a switch anyways but if there is one built with it then that would be a bonus :)
 

KMoffett

Joined Dec 19, 2007
2,918
http://uk.farnell.com/jsp/search/browse.jsp?N=2031+203761&Ntk=gensearch&Ntt=power+jack&Ntx=mode+matchallpartial&D=*power*+*jack*
The three-pin jacks are meant to switch a device to battery if the wall-wart (wall plug power supply) plug is removed. You will need to find your power supply first, so you can match the jack to the plug on the power supply. Or, buy a matching plug and jack, and replace the plug on the new power supply. I would get a panel mounted jack, like #1310915 at the top of the page. Make a small "L" bracket with a hole on the vertical leg to match the jack, and a hole in the horizontal leg to screw it to the metal base on the breadboard.

Ken
 
Top