Let's Make Robots!

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

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.
RoboSerg's picture

Why use two 470uF capasitor before and after the voltage regulator ? Also some people are using 100uF caps. Who is right ?

OddBot's picture
I assume beginners will copy this circuit exactly. I do not know what their robot's demands will be. I went extra big to be safe. I drew a circuit that should work for 90% of the robots I see on this site.
ignoblegnome's picture

That's a fair question. I did some reading before answering.

Some monolithic (single chip) regulators like the ones in this post need capacitors before the regulator, especially if the regulator is more than a couple of inches from the power source (battery).

The recommended capacitor values may vary. However, as OddBot says, "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."

So a single 100uF cap before or after the regulator is a compromise between large surge handling and noise/fast spikes.

You may be fine with a 100uF cap in some cases. However, keep in mind that with robots we are usually dealing with motors and servos, which can put variations on the battery voltage. For an extra couple of caps, I'll stick with a big one and a small one on each side.


Ro-Bot-X's picture

Keep in mind that on a robot you'll have motors and servos powered directly from the battery. The first large capacitor BEFORE the voltage regulator helps to keep the battery voltage steady when the motors start or reverse. The second large capacitor, AFTER the voltage regulator, helps keeping the regulated voltage steady when power hungry sensors (or sometimes servos) draw too much power, or when the input voltage drops too much for the regulator to be able to keep up. These capacitors act like power storage tanks.

The 0.1uF capacitors before and after the voltage regulator help filtering high frequency spikes in the voltage created by motors and servos, as well as by active sensors.

So you need all of them.

What is the best value? Depends how much amperage your motors/servos draw from the battery. The bigger the amperage, the larger the voltage drop across the battery terminals. You need to have big enough capacitors to compensate. If you build a SHR, then 220uF is good enough. For motors that draw more than 1A each, you need to double the capacitors, or get up to 1000uF. Also, make sure the capacitors are rated for at least double the battery voltage, I usually like to use triple the voltage, if I can get them in small enough size.

It is also a good practice to use a 0.1uF in parallel with a 10uF as close as possible with each IC or bank of sensors/servos. The 0.1uF for filtering and the 10uF as a small power storage tank.

Gabriel_f's picture

Thank you OddBot!

If it wasn't for your tutorial and these comments I would never have figured out that my LM7805 was giving flaky voltage. It caused some really strange symptoms.

I've placed an order for a 2940 instead. It'll arrive in two weeks, until then I'll just have to live with powering my Arduino straight of my 5x1.2V NiMh :)

OddBot's picture

Yes you can use a LM2937 regulator and different value capacitors. I have shown a typical circuit using common parts.

LDO regulators (Low Drop Out) are prefered as you can use lower battery voltages which gives better efficiency. Another good choice is an L4940V5 which has a 1.5A rating asumming a suitable regulator is used.

Unless a datasheet states otherwise then generally bigger capacitors are better which is why I showed 470uF. 2x 220uF in parallel is even better as the two capacitors combined have a lower ESR (Equivalent Series Resistance) which allows them to cope with big surges better.

Mr. Roboto's picture

Could I use I a LM2937 (from solarbotics) instead of a 7805? And could I use a 330uf electrolytic capacitor instead of the 470uf one?The second is on this page is what I am using. The reason I'm concerned is that the product page says something about certain capacitors for regulator stability. any help is appreciated.

I have a 6 NiMH battery pack so I was going to build the 7.2v option in this post since I have some components needing 5v, my motors need 6v, and my Arduino Duemilanove has a 5v regulator built in so I guess I'll power that off the 7.2v line.  My motors have a 1.6 A stall so I think I need diodes that handle over 1amp instead of the 1N4004 diodes in the schematic.  What diodes would you suggest?  How about the 1N54xx?  I found some 1N5401.  Would they be good?  Any suggestions appreciated.  Thanks!

TeleFox's picture

All of the 1N540x diodes will handle 3A, what do you think you maximum total current draw (worst-case scenario, all motors stalled) is likely to be?

Take a look at the forward voltage vs forward current chart in this datasheet. The forward voltage is 0.6V-0.8V up until about 1.5A, so you may do better using only 1 diode instead of 2 in series if you expect high current.

g_code's picture

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