sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Building a 5v UPS using LM317 IC. Help needed.

Sat Dec 22, 2012 5:56 pm

Hello,

I am trying to build a 5v Online UPS for my Pi.
Idea is, use 6V 5Ah 1.2A Sealed Rechargeable battery to power the pi (after bringing down the voltage to 5.25V using LM317 IC). And charge the battery using 12V 1.5A adapter. (after bringing down the voltage to 7.3V using LM317 IC).
I am working on the first part now. That is powering the pi using 6V 5Aah 1.2A Sealed Rechargeable battery (after bringing down the voltage to 5.25V using LM317 IC).
Below is the circuit I used to bring down the voltage to 5.25V.
Image
Circuit details are at http://www.circuit-innovations.co.uk/LM317.html

I adjusted the output voltage using the variable resistor in the circuit and brought down to 5.25V (measured at the female USB connector end).
Now I connect the pi using a USB to micro USB cable. When I measure the voltage between TP1 and TP2, its near to 4V only. What could be the issue?
what changed to be done at the circuit, so that I get 5V between TP1 and TP2?
Voltage direct from the battery is 6.52V if I use that directly to the pi will it be too much voltage for the pi?
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

gritz
Posts: 449
Joined: Sat Jan 28, 2012 2:33 am

Re: Building a 5v UPS using LM317 IC. Help needed.

Sat Dec 22, 2012 7:07 pm

The LM317 is a linear regulator and it requires that the input voltage is *about* 2V higher than the required output. To use your 6V battery you'll need a switching regulator (sometimes called a DC to DC converter). These are available as little pcb's or simple sealed boxes with wires attached. Most will accept a range of input volgages and supply a stable output voltage up to a maximum specified current, so they're not too hard to use. Quite a few people on the forum have succeeded in battery powering their Pis, so try entering a few relevent key words in the "forum search" box at the top of the page to find which particular techniquess have worked for other people. :)

* You could also use a linear low dropout regulator - these don't require so much "overhead" between input and output voltage as older tech like the 317 or 7805, but a lot are only available in surface mount packages and you might well find that a little DC-DC board is just less fuss.

User avatar
Mortimer
Posts: 925
Joined: Sun Jun 10, 2012 3:57 pm

Re: Building a 5v UPS using LM317 IC. Help needed.

Sat Dec 22, 2012 7:18 pm

Isn't worse than that? I don't think the LM317 has full current capability unless Vin - Vout is 3V or more.
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Sun Dec 23, 2012 4:52 am

Can some one suggest a most widely available switching regulator IC and its circuit?

or
gritz wrote:The LM317 is a linear regulator and it requires that the input voltage is *about* 2V higher than the required output.
as gritz suggested, I will have to purchase a 12V battery and bring down the voltage to 7.25V and try again?
But I think if the voltage is above 5.5V pi wont even get turned on. I increased the voltage from existing battery to 5.7V and tried powering the pi, it wont blink the red LED.
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

cnt
Posts: 60
Joined: Wed Sep 26, 2012 4:42 am

Re: Building a 5v UPS using LM317 IC. Help needed.

Sun Dec 23, 2012 6:33 am

as others suggested you can't really use a linear regulator unless you use one with an extremely low dropout. What I would suggest is using a 12v battery and getting a 5v DC out switching power supply. If you're willing to wait on shipping from china you can get them for as low as 2-3$ each.

User avatar
Burngate
Posts: 6329
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Sun Dec 23, 2012 12:43 pm

Also, many linear regulators of the 7805 and 317 ilk have built-in thermal protection, and their headline current-carrying capacity is much reduced unless a large heatsink is attached.

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Tue Dec 25, 2012 4:43 am

I managed to get 4.85V using LM 317.
I used a 12V battery this time.
Issue is, IC gets heated a lot as soon pi is connected.
A ready made dc to dc converter (which is 5V 2A) is hard to get in india.
I googled for a name or part number of a switching regulator IC which can reduce 12V or 6V to 5.25 V 2A
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

business_kid
Posts: 30
Joined: Fri Dec 21, 2012 9:33 am

Re: Building a 5v UPS using LM317 IC. Help needed.

Tue Dec 25, 2012 5:42 pm

Those guys have pinpointed the problem for you. The lm317 is a variable regulator and I would have said it needed 4V overhead, i.e your input needs to be 9V for 5V at full load.

The lm317 is a bad choice. You want 5V - right? Get a low drop fixed 5V regulator. It will be cooler, In fact, with a 6V battery, you would probably get away with a simple diode in series, but that's not a good design.

technion
Posts: 238
Joined: Sun Dec 02, 2012 9:49 am

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 1:40 am

I'm very interested in this topic.
There are several threads like it but all are slightly over my head.

If you get this working I would love to see a parts list and basic build guide.

sajidtoor
Posts: 4
Joined: Fri Dec 28, 2012 6:40 am

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 6:41 am

Thanks for sharing.
Modern-Tech

sajidtoor
Posts: 4
Joined: Fri Dec 28, 2012 6:40 am

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 7:19 am

Thanks for sharing...! :)
Modern-Tech

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 9:30 am

sim_tcr wrote:I managed to get 4.85V using LM 317.
I used a 12V battery this time.
Issue is, IC gets heated a lot as soon pi is connected.
Ah there's your clue - look at what Burngate said again. You need a heatsink attached to the LM317 - it is wasting several watts of power, and will get hot very quickly and shut down.

Look for maybe a TO220 style heatsink at least 3-4 centimetres across with fins. Also note the heatsink must NOT be attached to the case, that is, it must NOT be earthed.

(Note using a switching regulator is better because it is more efficient - so your supply will last longer. It'll also generate much less heat.)

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 3:38 pm

Ravenous wrote:
sim_tcr wrote:I managed to get 4.85V using LM 317.
I used a 12V battery this time.
Issue is, IC gets heated a lot as soon pi is connected.
Ravenous wrote:Ah there's your clue - look at what Burngate said again. You need a heatsink attached to the LM317 - it is wasting several watts of power, and will get hot very quickly and shut down.
I already had a normal 3cm length heat sink attached to LM317.
Ravenous wrote:(Note using a switching regulator is better because it is more efficient - so your supply will last longer. It'll also generate much less heat.)
So many here suggested switching regulator, but no one answered what IC (name, number anything) I could use for this?
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

User avatar
cosmo
Posts: 51
Joined: Mon Nov 19, 2012 8:36 pm

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 3:51 pm

There is an article in issue 6 of the MagPi on building a power supply. This may be helpful to you. I intend to build one myself (I've already bought the components, but won't have time to build until the new year).


Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 4:01 pm

Also there have been many posts here in the forums about switching power supplies. Worth searching around if you can get anything out of the search function...

I will mention one I've used but NOTE it is only 500mA (I used it with other stuff, not the Pi) - I recommend you check the data sheet and look for a higher power version the same manufacturer makes (also note this is a link to a UK supplier):

http://www.rapidonline.com/Electrical-P ... ries-78070

Alternatively, many people have posted about using those little USB converters that run off a car's 12V cigarette lighter. Apparently you can open these up and use a little 12V-5V converter circtuit inside.

I'm a little worried you already have a heatsink on the LM317 but it's still overheating...

Good luck! I understand it's not easy to find components where you are.

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 4:04 pm

Dilligaf wrote:Here's a $4.50 solution ready to go http://www.hobbyking.com/hobbyking/stor ... ction.html
Ready made solution will not work here, I live in India. I dont think they ship to India. Morover I have most of the components with me, It just the IC I need to buy. I want some one to point out what switching regulator IC I could use.
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 4:07 pm

sim_tcr wrote:
Dilligaf wrote:Here's a $4.50 solution ready to go http://www.hobbyking.com/hobbyking/stor ... ction.html
Ready made solution will not work here, I live in India. I dont think they ship to India. Morover I have most of the components with me, It just the IC I need to buy. I want some one to point out what switching regulator IC I could use.
LM2596S is a great little chip. It's the IC that drives most of the ebay regulators that you say you can't buy. Pity because they are so cheap and easy to use. :cry: It's meant to be good for 2 amps without a heat sink.
Alex Eames RasPi.TV, RasP.iO

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 4:20 pm

alexeames wrote:LM2596S is a great little chip. It's the IC that drives most of the ebay regulators that you say you can't buy. Pity because they are so cheap and easy to use. :cry: It's meant to be good for 2 amps without a heat sink.
Thank you. Thats what I have been searching for.
http://in.element14.com/national-semico ... dp/1469195 Its written Primary Input Voltage:12V and Output Voltage: 5V, 3A. (my current battery is of 6V, I guess I will have to go for a 12V one) otherwise will this serve my purpose?
Also found this http://in.element14.com/exar/spx29300t- ... dp/1829406 It says Primary Input Voltage: 6V and Output Voltage: 5V, 3A. Thats exactly my requirement. If i have to purchase from element14 I have to spend double the amount written on their website as in taxes and shipping charges. I will try to check if these ICs are available in the local store.
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 5:23 pm

Actually I've just realised I didn't give you the complete part number because the last bit is on the next line when printed on the chip.

LM2596S-ADJ This is an adjustable switching regulator, which, on the boards I have is easily adjusted using a small potentiometer. :)

Farnell sells them for more than the cost of the pre-made regulator boards out of Hong Kong.
Alex Eames RasPi.TV, RasP.iO

User avatar
bugsy_malone 666
Posts: 292
Joined: Mon Dec 17, 2012 10:50 pm
Location: Basingstoke UK

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Dec 28, 2012 7:25 pm

well there may be a pre built solution for this, kind of. if you can get your hands on one or look online at how it's built, a 12v emergency light pack. Mr16 halogen spot lamps as found in some office buildings are run by a unit which has a circuit, 6v 4ah battery and 2 transformers to run off Mains voltage, one transformer is 12v for direct powering the light and ones 6-8v for for the charging circuit. the battery charger is for a sealed lead acid battery and the charging circuit runs on a lm317 voltage reg, a few capacitors and resistors, there's also some relays for change over when the power goes down. what I'd probably look to do is use something like an L7805 fixed voltage reg on the output with some caps to stabilize the voltage when changeover happens. something like that.

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Jan 04, 2013 11:30 am

I am almost failed on this project.

1) Using LM317 and 12V battery, I was able to get 4.9V steady. But LM317 get heated instantly (I had used heat sink. If i leave the circuit on, LM317 will get burned quickly) I even tried connecting two LM317 in parallel, still same issue.
2) I was able to source LM2596S-ADJ (switching regulator IC as alexeames suggested here) . Using this I could not bring the down the voltage to desired level using 12V battery. Circuit tried is below,
Image
I have to admit, I could not get 33uh coil and 1N5824. So I had tried without these two components.
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Jan 04, 2013 11:43 am

I'm sorry but there is absolutely no way that circuit will work without the coil. (I don't know in detail but I doubt it will work without the diode either - it looks like a zener diode and will probably determine the output voltage.) You really need to look for those parts.

The LM317 should work, but probably needs a big and reasonably thick heatsink. May also need thermal paste to transfer the heat.

A suggestion: try your LM317 again but without a raspi connected. Does it produce the voltage you need now? This will at least confirm the circuit is correct.

There have been a lot of threads on running off a battery, and various other methods have been suggested.

sim_tcr
Posts: 331
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
Contact: Website

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Jan 04, 2013 11:57 am

Ravenous wrote:I'm sorry but there is absolutely no way that circuit will work without the coil. (I don't know in detail but I doubt it will work without the diode either - it looks like a zener diode and will probably determine the output voltage.) You really need to look for those parts.
Are there any alternative for coil and zener diode (any other diode number equivalent of the other one)
Ravenous wrote:The LM317 should work, but probably needs a big and reasonably thick heatsink. May also need thermal paste to transfer the heat.
I had used 3cm heat sink and thermal paste.
Ravenous wrote:A suggestion: try your LM317 again but without a raspi connected. Does it produce the voltage you need now? This will at least confirm the circuit is correct.
Before connecting raspi, I measured the voltage using digital multimeter and it was showing a reading of 5.25V. Also tried charging a mobile phone and ic don't get heated big.
So I believe raspi look for much larger Amperes and that making the IC heated.
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Raspberry Pi 2 x 2, Transcend 32GB Class 10, Transcend 16GB Class 10, Transcend 8GB Class 4, Custom 12V 1.5A (stepped down to 5.5V)

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Building a 5v UPS using LM317 IC. Help needed.

Fri Jan 04, 2013 12:24 pm

Right let's look at how big a heatsink you might need...

The regulator is dropping 7 Volts (12V-5V)

If you're drawing 0.7 Amps (a raspi on its own with nothing else connected) the power = current * voltage = 0.7*7=around 5 watts.

(By the way, this means the regulator is wasting 5 watts, the raspi is probably using around 2-3 watts so the linear regulator is wasting two thirds of your battery life. That's why a switching regulator is better, it will waste much less power. But let's carry on with the LM317 for now.)

Here are some heatsinks from a small supplier I use here in the UK:

http://www.bitsbox.co.uk/semiconhw.html

The biggest (for example) claims it's 7.1 degrees C per watt. If so, 5 watts would mean it runs at 35 degrees - that's 35 degrees above your room temperature. (I bet your location is warmer than mine at the moment by the way!)

You don't need a heatsink THAT big (note that one is drilled for big power transistors), but I suggest you look around for a big piece of scrap aluminium or even copper, at least 3mm thick, at first and see if that helps. Or if you can't find a bit of metal MAYBE try a fan at full speed... just for an experiment...

Your circuit (for the LM317) is definitely working, I think your heatsink isn't big enough. (I once had a 30V transformer from an audio project - I tried to regulation down to 12V - so it was wasting 18V at half an amp or so, and even the BIG heatsink I had was too hot and the circuit kept shutting down!)

As for the switched power supplies I can't help as I've never built or designed one - just used ready-made modules as we discussed earlier. Hopefully someone else will help.

Return to “General discussion”