Once you've decided on batteries, how do you regulate the voltage?
| Attachment | Size |
|---|---|
| DSE200405_catalogue_data.pdf | 1.02 MB |
| LM2940CT-5.pdf | 409.32 KB |
| LM7805.pdf | 1.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 capacitor which is what I tend to use these days. 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.
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!





@ Wed, 2010-04-21 07:02
Diode Options
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!
@ Wed, 2010-04-21 12:12
All of the 1N540x diodes
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.
@ Sat, 2009-11-07 08:52
Smoke
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
@ Sun, 2009-08-23 14:56
Nice tutorial! But are the
Nice tutorial!
But are the diodes not also burning watts?
@ Sun, 2009-08-23 22:49
Yep, although with an input
@ Sun, 2009-08-23 17:33
Ohms Law
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
@ Mon, 2009-08-03 08:52
Alternative Voltage Regulator Chip?
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.
@ Mon, 2009-08-03 12:33
They look very nice
@ Fri, 2009-07-03 01:14
I just made your first setup
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).
Thanks.
@ Fri, 2009-07-03 01:21
Yep, you got 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.
@ Thu, 2009-01-15 10:32
Finally I have the time to
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 ?
@ Thu, 2009-01-15 12:40
The 7805 requires the input
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.
@ Thu, 2009-01-15 13:49
I was using a 9.6V-2000mAh
I was using a 9.6V-2000mAh race pack, and regulating the voltage to 5V for the micro and to 6V for motors and servos, and now I understand it was very nonsense... with the 5x1.2V NiMh is a lot better... I will try to find those 2940 :-)
and by the way.. nice pic :p
@ Thu, 2009-01-15 15:29
LOL, thanks
@ Thu, 2009-01-15 16:39
The local hardware store
@ Wed, 2008-12-10 00:32
hey OB, I love the info that
hey OB, I love the info that you've put here, and I'm going to look into dc to dc regulation(maxim-ic has a few I think), but I was wondering if you knew what sort of drawbacks it may have when using dc->dc vs just using a vreg in a more efficient manner say like using 7.2-9.6v?
This is who I was going to get my components from...hopefully samples :)
http://www.maxim-ic.com/products/power/dc_dc_switchers/
@ Wed, 2008-12-10 02:27
depends on efficency
@ Tue, 2008-12-09 22:16
Thanks, this is a really
Thanks, this is a really useful posting. I've worked with plenty of LM7805's and LM317's, but this gave me some ideas I hadn't thought of. I definitely want to pick up some LDO regulators. I really like that idea about getting all three voltages from a 7.2v R/C car battery pack -- I realized a while back that BullyBot really needs three different voltage sources, and was trying to think of a way to avoid adding a third battery pack. I think your circuit will solve my problem nicely.
Dan
@ Tue, 2008-12-09 17:39
Here is my question that I
@ Wed, 2008-12-10 03:05
Formula
The type is usually chosen by the value required and voltage. As for amperage, it depends on frequency. Since most robots are running off of batteries the frequency of the supply is zero. Sounds like you want a walkthrough on mains based power supplies.
I posted this to help people avoid formula but I forgot about the intelligence and therefore the curiosity of everyone here so now I keep getting asked for formula. As I mentioned in another question, when a capacitor is placed across a power supply it doesn't short out the supply because a capacitor is essentially an open circuit to DC. However to AC components such as ripple, spikes, surges, commutator noise etc. a capacitor has a low impedance. The formula for capacitive reactance is Xc=1/2ΠfC where f is the frequency in Hertz and C is the capacitance in Farads.
The lower the capacitave reactance the better it shorts out the ac components. Bigger capacitors have the storage capacity to handle low frequencies but have a higher reactance. Small capacitors have a much lower reactance but can only handle higher frequencies.
The circuits I've shown have a reasonably large capacitor to deal with low frequency stuff like a relay coil turning on and drawing more power. And a smaller capacitor to deal with higher frequency noise from the thousands of transistors in the MCU turning on and off and a small amount of com noise from an electric motor. The regulator deals with the frequencies in between.
In some cases the 470uF capacitors may need to be increased. In rare cases you might even add say a 47pF ceramic.
The types of capacitor used in power supplies are mainly Electrolitics for their large storage capacity. They come in many different voltage ratings so choose carefully and be aware of their polarity and temperature rating in some cases. With the smaller values polyesters are common. For very small values ceramics are used.
@ Wed, 2008-12-10 04:52
Xc=1/2ΠfC
What is Π?
To spell it out is the formula capacitive reactance equal to one half of frequency (in hertz) times capacitance (in farads)? I wasn't sure what the extra character is unless it means divided by? Thanks for the walkthrough. I knew I was going to need to work with this in the near future because I wanted to make a robot that had a circuit to recharge batteries.
@ Wed, 2008-12-10 05:20
It's supposed to be pi
I used the special character feature to put in pi and it looked ok in the edit box but came out different in the final text.
Pi=3.1415. I'll do a walkthrough on mains power supplies / chargers next.
@ Wed, 2008-12-10 17:59
That make sense. I was goign
@ Tue, 2008-12-09 17:22
I'm a total noob at
I'm a total noob at electronics
and I DO mean total noob
so let me see if I get this straight?
I can use the second example from the top with a 6v battry pack and connect the 5V out to, say, the input of my Picaxe chip
and use the 6V for the extra power input on the chip that supplies the servos. And get a steady current that doesn't dip and mess things up when the servos start moving?
@ Wed, 2008-12-10 00:52
I'm confused by your
@ Wed, 2008-12-10 13:47
oh sorryyes, that's it the
oh sorry
yes, that's it
the picaxe 28X starter kit has an input for external power that delivers power to the servos
right now I have to have two battery packs to power my robot when I use servos which produces a serious weight problem
@ Wed, 2008-12-10 14:35
Ok
@ Thu, 2008-12-11 10:47
awesome
thanks
this'll be great for my next project.
@ Tue, 2008-12-09 12:13
Very interesting.. I have a
Very interesting.. I have a question: why do i need capacitors both before and after the regulator? Isn't it enought to have them in one place ?
@ Wed, 2008-12-10 04:17
Fit those capacitors!
@ Tue, 2008-12-09 16:18
If you read the data sheets
@ Tue, 2008-12-09 11:13
Great walkthrough!
This explains a lot! Very good to finally have a good voltregulation tutorial on LMR.
A few questions.
Why do you use 470uF caps around the regulator? I've seen walkthroughs on other sites that use 10uF or 20uF. Am I correct in asuming that a larger cap will be able to handle a larger surge, but will take longer to charge (i.e be usefull) ?? Any way to determine the optimal value?
Also, isn't it common to place a fuse before the powerswitch? I don't think it would really matter, but some say the fuse should be as close to the battery as possible.
@ Tue, 2008-12-09 11:52
Fuses and capacitors
Remember I'm trying to design general purpose circuits that should work with any of the robots I've seen on this site. I've chosen components based on experience and simplicity. The regulator circuits show should power any picaxe, atmega or arduino along with status leds and support IC's up to 1A with a heatsink. Note that power for servos and Hbridges are directly from the battery, not the regulator.
I only showed a fuse in series with the big battery so that if your motor stalled and blew a fuse your processor would still have power. You could put a fuse in series with every battery or voltage output, it depends on your robots design. I haven't show a fuse with the smaller batteries because I wouldn't bother, they're not dangerous enough. BoozeBot has one 40A fuse in series with the battery for emergencies and six smaller circuit breakers, one for each DC-DC converter and one for each 100W motor and it's drive circuitry in case a H-bridge fries.
With the capacitors it depends on how big a load is being drawn but since the regulator shown is only rated at one amp and a battery is being used, 470uF is probably overkill. If in doubt go bigger. I've shown circuits that should work with any of the robots I've seen on this site.
@ Wed, 2009-06-10 08:10
yet another question
I've obtained a bunch of capacitators, but the 470uF caps are rated 64V instead of the 16V in your drawings or the 25V in the picture. Does the voltage rating matter much or will i risk sending too many volts through the circuit when that big cap discharges?
@ Wed, 2009-06-10 10:36
G'day Mintvelt, higher voltage ratings are ok
The voltage rating on the capacitors only indicates what is the maximum voltage the capacitor can handle without damge occuring to it. I just showed typical safe voltages in my drawing.
I usually try and use capacitors with a voltage rating 50% higher than what they should get for safety when using batteries. The reason for this is that batteries, particularly rechargeables can have a higher across them when new or freshly charged.
In the case of regulating AC from the wall I aim for a voltage rating of double the expected voltage. If you have a transformer that puts out 12V AC RMS then it's peak output voltage can be around 18V when rectified.
The only downside to using capacitors with a higher voltage rating is that they tend to be bigger physically which can be a problem with small robots where space is at a premium.
@ Wed, 2009-06-10 10:37
thanx
@ Tue, 2008-12-09 09:50
I r newb, so still kind of
I r newb, so still kind of confused,
when people use capacitors to "filter noise" and such, whats that doing? (filtering noise, obviously) but whats that mean in lamens terms?
And when doing so, or just using a capacitor to protect from spikes, what determines what size to use?
Yar, my electronics lab hasn't teach-en-ed me what I want yet!
@ Tue, 2008-12-09 11:10
Capacitors are reservoirs .... sort of
Think of a kitchen sink that is kind of spitting water because there is air in the pipes ... there's not a steady flow of water. So you, being industrious, make a contraption where the faucet flows into a bucket, and then you put a hole on the bottom of the bucket to use as a faucet. Now when you want to wash your hands, you turn on the sink by opening the hole on the bucket.
Since there's a finite amount of space, this analogy isn't perfect, but hopefully it gets the idea across. The faucet is the battery (where the water comes from). The bucket is the capacitor (where the water builds up). By having a kind of buffer that builds up in the bucket, you'll always have a steady flow of water, even if the sink is sometimes spitting air or at other times has pressure spikes.
@ Tue, 2008-12-09 11:13
Thank you Mr Clean for
@ Tue, 2008-12-09 12:07
:)
@ Tue, 2008-12-09 10:42
I was avoiding going into
I was avoiding going into too much technical detail as whole textbooks can be devoted to filtering.
If your voltage varies at all due to coommutator noise, spikes, surges etc then that is an AC component. Capacitors conduct ac but not dc since they are effectively an open circuit. So when they are placed across your supply they do not short out your power but they do short outthe ac components. The bigger the capacitor, the lower the frequency it is capable of shorting out. In these circuits I've shown a 470uF filtering out ripple and other low frequency components. For light loads like a MCU and some LEDs this will be fine but bigger is better, so the bigger the capacitor the bigger ripple it can filter. With the small capacitors, one factor is what type of capacitor, how low is it's ESR (equivalent series resistance). I don't know as much about this but I use monolithics because in the old days when TTL and other prehistoric families ruled the computer motherboard you could find one for every chip on the board to filter the noise produced. I still tend to follow that practice of one monolithic per IC near as possible to it's supply pins but these days its more to protect from outside noise of motors and cell phones. Probably overkill.
There! Condensed a medium size text book into a paragraph of drivelling nonsense :D
Otherwise read the datasheet I provided, it has lots of easy info on capacitors, resistors, opamps etc. It was my bible when I was twelve. It's out of print now I think.
@ Tue, 2008-12-09 08:07
Thanks OddBot,Great walk
Thanks OddBot,
Great walk through, very informative.
Also it's nice to see the inside of boozebot. I notice that you use european style position barrier strips for connectors. Even wire straps, very professional. Lovely color coding too! By the bends, I'm guessing stranded wire? Does that work well for the barrier strips? I got my first barrier strip today!
GroG
@ Tue, 2008-12-09 11:01
Ummm... Err.. what are you talking about?
I didn't have good pics in the past of BoozeBot because I was using a crappy web cam. Now that I have nice 8Mpixel pics you are seeing things that I haven't heard of. After looking at my own robot for a while and re-reading your description lets see if I understand.
I assume that what you call European style position barrier strips is what we call a terminal strip (easier to say at least).
Wire straps = cable ties. Maybe this shoulda been in CTC's forum on translating different languages?
As for the stranded wire, when I was an electrician we were taught to twist the strands tightly by hand and then tighten the screw so it doesn't cut the strands. It works quite well but sometimes I cheat and solder / tin the strands before screwing it in.
I can understand that you'd be suprised by the relative tidyness of BoozeBot after looking at my other birdnest contraptions like Junior. BoozeBot is a long term project so I've spent a lot of time on him. Even then that section is a bit untidy because it normally can't be seen.
@ Tue, 2008-12-09 05:52
Thanks