Let's Make Robots!

Once you've decided on batteries, how do you regulate the voltage?

Regulate voltages in your robot.
DSE200405_catalogue_data.pdf1.02 MB
LM2940CT-5.pdf409.32 KB
LM7805.pdf1.7 MB

Recently I've noticed some people are a bit unsure of how to regulate their robots batteries and since there was a tip/walkthrough on batteries recently I though this might be a good time to explain voltage regulation. Since robots and their power requirements vary so much I've presented several general purpose schematics showing different configurations. These should work with most of the robots I've seen on this site. Note that a heatsink should be used on the regulator. I've attached data sheets for the regulators.

To begin with the most common configuration is a battery with a voltage greater than 5V and a simple 5V regulator.

I've notice many people use a 9V battery so that is what I've shown here. The large electrolytic capacitors (470uF) help the regulator deal with big surges in power such as a heavy load being turned on. The smaller capacitors help filter out noise and spikes. This setup cannot produce a lot of current due to the battery. A 8.4V NiMh or NiCd rechargeable battery is the way to go here as it saves you money and can usually deliver more current for longer.

This setup isn't very efficent because up to 4V is dropped across the regulator. If your circuit is drawing 100mA at 5V then it uses 5x0.1=0.5W of power. If you are using a 9V then 4V at 100mA = 0.4W is wasted as heat by the regulator and a small heatsink may be required. Once again the rechargeable is a better choice as it will only waste 0.34W of power.

This is a more efficent design that can deliver more power. It also has a 6V output for servos, motors, relays etc. You can use 4xalkaline batteries or 5xNiMh. I recommend 5xNimh as they last longer and the voltage stays at 6V almost to the end where as the alkaline batteries will steadily drop in voltage. I've used a low dropout regulator for efficency. The popular 7805 needs the input to be at least 2.5V higher than the output for reliable opperation. This LM2940CT-05 will work reliably with an input just 0.5V higer than the output. As I mentioned before, the more a regulator has to drop the voltage the less efficent it is.

This is another variation using a popular 7.2V NiCd or NiMh battery pack from a radio controlled car. This circuit gives you 7.2V for bigger motors. I've used two power diodes in series to give you a 6V supply for servos. Each diode will drop about 0.6V and will handle up to 1A, together they drop aprox. 1.2V. If you need more than an amp for servos then bigger diodes can be installed. You may want to install a fuse as well since those battery packs can put out a lot of current if a motor stalls.

This is a typical setup with two batteries. I've shown a 12V car or SLA battery as might be used in a big robot like Walter. I've also shown a 9V as in some cases a 9V supply can be handy for op-amps. You can use whatever batteries suit your needs. The batteries shown in these circuits are just typical examples.


These are typical capacitors I use in my circuits.
I've shown them here for those who are uncertain what capacitors to use.

At the top you can see two electrolytic capacitors. These capacitors may be a different colour but will always have the polarity marked on them. Note in the photo that a negative symbol is shown in an arrow pointing to the negative lead. Usually the negative lead is a bit shorter than the positive as well. They also have a voltage rating on them. Never exceed this or connect them the wrong way around as the can leak a foul substance.

The next down is a greencap, polyester or mylar capacitor. They are not always green but reguardless of their name they work the same. The capacitor in this picture is a 0.1uF and could be used in the above circuits. This capacitor is not polarised (no plus or minus) and is rated up to 100V.

The smaller grey capacitor below is a modern equivalent called a MKT or minature polyester. It is the same as the greencap above in value and voltage rating but noticably smaller.

At the bottom is a monolithic ceramic capacitor which is what I tend to use these days. These capacitors have a lower ESR (equivalent series resistance) that allows them to charge / discharge quicker and filter higher frequencies. The capacitor in the picture is also a 0.1uF and non-polarised. It has a rating of 50V.

I've attached a general purpose datasheet from Dick Smith Electronics that has good information on electronic components in general including a section on regulators.

Our friends at SparkFun has a good article on capacitors here: https://www.sparkfun.com/news/1271


Finally a brief mention on DC-DC converters. As mentioned above, the more voltage a regulator has to drop the less efficent it is. When you need to use higher voltage batteries such as the 24V I use for BoozeBot then regulators are bad news. They can deal with input voltages in excess of 30V with suitable heatsinks but to get 5V at 1A from a 24V battery means 19W of power would be wasted as heat to give me 5W of usable power or just over 20% efficency. This is where DC-DC converters are well worth the money as they are usually 80%-90% efficent depending on load and design.

This photo shows the 3 DC-DC converters used in BoozeBot. The two converters at the top are kits I bought and assembled. They can put out in excess of 2A each. The 6V output is regulated down to 5V where necessary and the 9.5V output is for an ASUS Eee-Pc. These kits were reasonably priced and because you make them yourself they can be setup to produce almost any voltage. Both of mine reduce the voltage but they can be made to increase the voltage as well. At the bottom is a bought unit. It can produce about 10A and will run BoozeBots arm motors.

I hope this information is helpful. Good luck and enjoy!


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Holy smoke,

All this information in one foul swoop.
I swear I can smell smoke and I hear some crackling going on and I have not touched anything electronic tonight.
I am only a machinist man, what are you trying to do to me? I feel Like I am being re-programmed.

Jokes aside, this is probably the most usefull information I heave taken in all year. Still way over the top of my head but this is one refference I will be returning to regularly.

In the mean time let mme go see if I relly did learn anything.

Thank you OddBot

Nice tutorial!

But are the diodes not also burning watts?

Yep, although with an input of 7.2V the power loss along the 6V line is only ~17%, which is still not actually that bad at all. At the rated max current of 1A, the diodes will burn off 1.2W between them, and the remaining 6W will be delivered to the 6V load.

Diodes don't determine the current, they drop voltage.

Think about it this way. In OddBot's schematic, imagine a resistor connected to the 6V line through the two diodes. The other end of the resistor is connected to ground.  This resistor represents the load of whatever is powered by the 6V line (motors, servos, etc.).

The voltage level before the diodes is coming directly from the batteries, and is 7.2V. Each diode drops about 0.6V, so two of them drop the 7.2V battery voltage to 6V.  Now the load (represented by the resistor) has 6V across it. The current through the diodes and the load resistor will be the same, and it is determined by the value of the resistor.

Re-arrange Ohm's Law (V = IR) to solve for current: I = V / R

V (voltage in volts)

I (current in amps)

R (resistance in ohms)

I = V / R

So if the load resistor is 10 ohms:

I = 6V / 100 ohms = .6 ams = 600 mA

I've got some 278RA05C low dropout voltage regulators I picked up from Electronic Goldmine for less than $1 US each.  You can find the datasheet here.

I think these might be a viable alternative to the LM2940.  The 278RA05C will output 2A and has some nice features. I'll post back if they work out OK.

They should work better than the LM2940. Just don't forget a heatsink.

I just made your first setup yesterday. However, I actually found your guide here after I had bought the parts and built the setup. My setup was slightly different though. I didn't use the 0.1uF monolithics. When I first set it up, I tested it with my multimeter and it was reading 5.9V, not 5. I tested a 9V battery as a benchmark and found that it was reading about 10V. So, I suppose my multimeter is just off by some factor (note: sense then my multimeter has gotten worse...now reading 15V from a 9V battery...).

However, I do have a question. I'm fairly certain that I accidently hooked a 7.2V 1200mA battery backwards to this setup for a few seconds. I couldn't get the setup to work anymore--however at first I guess I just assumed my multimeter was getting worse. 

So, my question is this: Will wiring a battery to the 7805 backwards destroy it? I'm still getting full voltage through the middle prong (ground), but nearly nothing through the Vout. Also, could this have destroyed my 470uF capacitors as well? I really don't think it would have, but I thought I'd ask.

Thanks for any advice...I can always go buy another one of these ($1.50 at RadioShack).

(Edit: I fixed the multimeter...the battery was nearly dead--oops.)

(Edit 2: I have sense done more Google searching and found that wiring the 7805 backwards will almost certainly destroy it).


Until I got to the end I was going to suggest you Multimeter had a flat battery since they are never out by that much normally. If there is a possibility of accidently connecting a battery reverse polarity then I suggest putting a power rectifying diode in series with the battery connection. Better to loose 0.6V than fry your robot.

I would replace the 470uF to be on the safe side and I still recommend the 0.1uF caps for noise suppresion. Even your processor generates noise that can potentially affect your sensor readings.

Finally I have the time to read this carefully.. very good info, thanks for sharing this.
I have made some setups using voltage regulators but never understood the capacitors thing...  now I will move forward into a more wise (sould I say 'techy'?) setup..    :-)

Just a question.. what is the diference between the 7805 and the LM2940CT ?

The 7805 requires the input voltage to be at least 2.5V higher than the 5V output for it to work reliably. The 2940 can work reliably with the input only 0.5V higher. This has two advantages.

1. your robot can use lower voltage batteries with the 7805 even a 7.2V battery pack is too low for reliable opperation.

2. By using a lower voltage, say 5x1.2V NiMh to give 6V, not only do you get the best voltage for your servos but you waste less power. For example, lets say your 5V circuit (processor and sensors) draws 100mA. Running off of a 8.4V NiMh battery pack, the 7805 waste (8.4V-5V)x0.1A=0.34W of power as heat. If you run your servo's off of that 5V output then it will be much higher and your 7805 will need a heatsink assuming it can supply the current needed for the servos.

Using a 2940 and a 6V battery pack, you'd waste (6V-5V)x0.1A=0.1W. Your battery pack would besmaller and lighter and if you did run servos then they could run directly off the 6V pack without wasting any power through the regulator.