External power supply for servos using 7805

Hi again, after being playing with my Arduino, it arrived the time to connect the ServoMotors in an external supply. My servo motors are the “famous” TowerPro SG90 mini. Using the 5v power supply by an arduino it worked for one, but now using the circuit I’m attaching below is not… I’ve created an analogRead program and I can be for sure that that I’m getting ~5v (1017 analog read).
Maybe the problem is related to the intensity supplied… I’ll appreciate some help to sort that problem out.

Connexion is pretty easy: a 9v battery is powered to a voltatge regulator with transistor 7805 on it. The 5v+ resultant is connected to one servo, the ground to a common ground which shares GND of Arduino and ground of the servo. Then PIN 3 is attached to the servo…

Code used is a simple one like this:

#include <Servo.h> 
 
Servo myservo;

void setup() 
{ 
  myservo.attach(3); 
} 
 
void loop() 
{ 
  myservo.write(0);
  delay(1500);
  myservo.write(180);
  delay(1500);
}

That battery is probably not supping enough current. If you had 2 in parallel, it might work or you can just power the servo with 4xAA batteries without the regulator.

It could also be an issue with the code too, please post it.

HazardsMind:
That battery is probably not supping enough current. If you had 2 in parallel, it might work or you can just power the servo with 4xAA batteries without the regulator.

It could also be an issue with the code too, please post it.

Also tried with the 4AA batteries. I need exactly 5v to work with those servos and 4AA will give me 6v. Code is simply example of the arduino servo for the moment. The power I'm using is 9v battery... 7805 transiestor work with 7-12v afaik.

I need exactly 5v to work with those servos

why is that? I would think those servos would be specked at 4.8v to 6.0v .

I have those exact servos, and though they are rate for 4.8 - 6.0V, they don't do so good at 5.0V. I am running them at 5.7V using a 7805 and a diode. Look at this for schematic LINK

HazardsMind:
I have those exact servos, and though they are rate for 4.8 - 6.0V, they don't do so good at 5.0V. I am running them at 5.7V using a 7805 and a diode. Look at this for schematic LINK

How are you getting a 5.7v output? I'm getting 1017 analog read from arduino (4.X)... Any help on this? More entrance voltatge?

1017 is a value based on a range of 0 - 1023 or ~0 - 5V.
To see the voltage from the pin, you need to multiply the value you get from the analogRead() by 0.00488759.

float V = float(analogRead(A0));

float V_final = V * 0.00488759;

Serial.println( V_final );

If you feed 5.7V into the analog pin, you will fry the Arduino Use a voltmeter!

HazardsMind:
1017 is a value based on a range of 0 - 1023 or ~0 - 5V.
To see the voltage from the pin, you need to multiply the value you get from the analogRead() by 0.00488759.

float V = float(analogRead(A0));

float V_final = V * 0.00488759;

Serial.println( V_final );




**If you feed 5.7V into the analog pin, you will fry the Arduino** You a voltmeter!

oh! Sure I’ll… but, any idea on my problem why servos aren’t working with the circuit? :stuck_out_tongue:

Well you still haven't posted the code you're using.

HazardsMind:
Well you still haven’t posted the code you’re using.

Well that’s my code… it’s a simply one… Thanks for the help there.

#include <Servo.h> 
 
Servo myservo;

void setup() 
{ 
  myservo.attach(3); 
} 
 
void loop() 
{ 
  myservo.write(0);
  delay(1500);
  myservo.write(180);
  delay(1500);
}

The code says it should be on pin 9, but your picture shows its on pin 3. :wink: Hmmm.

HazardsMind:
The code says it should be on pin 9, but your picture shows its on pin 3. :wink: Hmmm.

LOL sorry, PIN was right, tested again. Just I made quick example to show from another PC. Sorry, code was this one with pin 3, going to re-write it.

I don't know what else to tell you. The circuit looks good (other than the 9V battery) and the code should work. Maybe you just have a bad servo.

HazardsMind:
I don't know what else to tell you. The circuit looks good (other than the 9V battery) and the code should work. Maybe you just have a bad servo.

argh... okey thanks for the help! I tried another servo and it worked sloow, really slow, what can the problem be? Oh and for more information, connecting the actual servo to the 5v power supply of the arduino works. Maybe that can give us an idea...

Yes of course it is going to work but it is not good for the arduino. Once you put a load on the servo the arduino is dead.

HazardsMind:
Yes of course it is going to work but it is not good for the arduino. Once you put a load on the servo the arduino is dead.

I've read though that a guy made it work with the 7805 transistor and a 12v power supply... I'll give a try to that... :stuck_out_tongue:

EDIT: Do you have those servos, which sketch are you exactly using to make them work?

Hello all,

I've the same problem I tried to solve before building my own power supply for my robot.

The thing is now I am using a 7805 for powering the servo, the inconvenience is the battery is the same for arduino and servo. But, I though the regulator would make like a division of the circuit and then I wouldn't need an extra battery. Isn't it good idea? I mean, the battery supplies about 14 Volts, and L7805 outputs 4.97V, and the servo is tower pro 9g SG90, its range is 4.8 - 7 Volts. So, should I use diodes and capacitors if I want to use the same battery for arduino and servo, even using regulator? :frowning:

Sorry my little knowledges about electronics, I just started a year ago as a hobby.

Thanks if you answer me, thanks anyway for reading.

Hope you help me!

Abel.

Bye.

pd. If you don't know my problem, it just that I am having electrical spikes or buzzing in the servo, which this didn't happen before when using a battery for servo and another for the arduino (well said an ftdi cable). Hope you understand me, hope that helps too.

Abel.

bieltv3:

HazardsMind:
Yes of course it is going to work but it is not good for the arduino. Once you put a load on the servo the arduino is dead.

I’ve read though that a guy made it work with the 7805 transistor and a 12v power supply… I’ll give a try to that… :stuck_out_tongue:

EDIT: Do you have those servos, which sketch are you exactly using to make them work?

My suggestion, is NEVER put a load on the Arduino’s +5V regulator. If it draws too much, and the AVR will shut-down.

This is a simple 2-regulator block I use, with an external +12V supply.

both regulators are standard TO-220 modules, mounted to a single heatsink piece.

It depends on what the maximum draw of the servo is, jumping from -100% (0) to +100% (179).

A single 9V transistor battery should be plenty, through the 7805, (skipping the 7809. Yeah, I found out they existed when I scrapped a few old 16-bit sound boards.) Your code is sound, But I’m trying to find an overhead of the Arduino board, to find out if Digital-3 is a PWM (~) capable output. (and I’m seeing it is.)

The buzzing, depends on the servo’s sensitivity, too. I ran into a few Airtronics servos that didn’t like (a) conversion to constant rotation, (b) powering below 7.5V… to say nothing of how sensitive they were to PWM changes. Most servos run a bandwidth from 1000uS to 2000uS. (1500uS being center, or SHOULD be stop for constant rotation.) Anything in between, could be just off the exact 5.556uS steps, and cause the servo to bounce back & forth between the two adjacent values. :~

The only other thing I can come up with, you didn’t mention if these are fixed 180 or constant rotation servos?
If the Servos are converted ones, how was neutral ( servo.Write(90) ) determined? 2 fixed value resistors? or a trim-pot?
If a trim pot, the center of the wiper could be slightly off… If fixed values (A pair of 2.2K’s in series, center to the old wiper), the tolerance of the resistors is a factor… How much one is off from the value of the other… (2.2K both, yes, but one could be actually 2.194K (<), or the other could be 2.293K (>)…) ) :relaxed:

A robot project of mine, uses the remains of a VeX kit, using the VeX Motor Drives (Essentially, custom Futaba S2003’s with their own version of a driver board.)… The actual dead-stop value is off by 10uS. (yep, 2-degrees off.)

Hopefully, this gives some insight.

Just did a googlesearch of the towerpro SG90, and ran across this link for the specs: http://www.servodatabase.com/servo/towerpro/sg90

HazardsMind, whether the digital pin was 9, or 3… ANY of the PWM (~) pins will work. as long as the Myservo.attach(#) code assigns one of those pins. Also, it needn’t be exactly set to specifically MyServo, With my vEx robot, I have 3 servos, running from the same library:
LWheel , RWheel, SServo assigned to pins 9, 8, and 5. (9 being the left wheel, 8 for the Right Wheel, 5 for the servo rotating the Ultrasonic Range sensor.) (which itself, wires-up similar to the 4-pin PING))), but using 2X 3-pin plugs.)

My code for those, in the setup void, would be

#include <Servo.h> 
 
Servo LWheel;
Servo RWheel;
Servo SServo;

void setup() 
{ 
  LWheel.attach(9); 
  RWheel.attach(8); 
  SServo.attach(5); 
}

The servo.h library is capable of up to 6 servos on the standard arduinos, Without the board in front of me, I can’t remember how many capable on the 2560 Mega.

Well, good post my friend. I liked so much.

The thing is my problem is that I implemented a serial communication with a GSM module over pins 3 and 4. Making INT1 the RX trigger, and the 4th pin the TX. I solved my buzzing by implementing it on pure C, as my code didn't overloads the CPU. But, NOW after building my own power supply, it starts buzzing again.

For sure is a thing of not enough power. But the range is 4.8 - 7 Volts. And I am supplying 5V at 1.5A max.... can't understand which the problem is.

I'm uploading schema in few moments as I can't find lm350 on eagle neither Qucs....

Here is my schema of my power supply and I am having buzzing on my servo… :frowning: