Tuesday, May 7, 2013

Cookbook : Simple Power supply for Raspberry Pi



When i got my Raspberry pi for the first time earlier this year, i was eager to see it working soon. But i needed a 5V, 1A regulated power supply. Many of the cheap SMPS adapters failed to work for the following reasons - 

     (i) It couldn't supply 1A current without a significant fall in voltage ( In technical terms, poor load regulation ). The suggested safe voltage range for RPI is 4.75V to 5.25V. The cheap adapters could usually supply 5V when starting up, but fails to provide enough current when the GUI is loaded, causing a restart (it boots up, restarts, and the cycle repeats)

    (ii) AC leakage and high ripples - If you connect an AC tester to the output terminals of a SMPS adapter, the tester lits. This means the ac line voltage leaks to the output. I got shock many times from RPI when using such adapters. Chances are that an AC spike can destroy the RPi.

If you are looking for a ready made solution, buy a standard android phone charger. That works out of the box. 

But i was in need of a battery operated RPI, so i decided to make my own PSU.

7805 IC based regulator powered from a battery (i used 12V 7AH SLA battery) seems to be the simplest solution, especially if you are developing a remotely operated RPI (some kind of embedded system ). But the solution has a low efficiency ( when RPI draws 1A from a 7805 which is powered from a 12V battery, the 7V is dropped across 7805 resulting in 7V * 1A = 7W thermal dissipation, which is higher than 5V * 1A = 5W delivered to the RPI ). Although it has less than 50% efficiency, it is still the easiest power supply you can try, and is almost certain to work.

The 7805 used in this project is a metal-can package 7805 (as opposed to the plastic package normally used in low-current circuits)

You can find the details of 7805 based power supply from http://elinux.org/RPi_5V_PSU_construction

Don't miss out the diode ( use 1N4007 or anything that you can find!), or else you'll destroy many 7805's(like i did!). If the input gets short circuited for some reason (if your input wires get shorted accidentally after disconnecting from battery), the input voltage of 7805 reduces to zero. But the output capacitor C3 is still charged, which pushes current to the output terminals of 7805 which destroys it(the output terminal can only source current, cannot sink current).
Datasheet describes the need of this diode in detail (see:  )
 
This diode is necessary whenever the output capacitor is greater than 10uF (in this case we used 470uF). Be sure that the 100nF capacitors are soldered close to 7805's terminals.

R1 and R2 can provide some fine adjustment of output voltage. Use R1 = 1k and R2 = 100ohms potentiometer (oops, i've marked R1 as variable in the above circuit, sorry for the error. Use a pot for R2). Adjust the pot to read 5.1V at output. When the circuit is loaded, this value drops a bit.

See the datasheet for the design of R1 and R2 (link: )

Also use a polarity protection diode and a 1.5A slow-blow fuse in the input from battery.

Its a good idea to add an indicator at the output, showing that power is on. For this, connect a RED LED in series with a 220 ohm resistor to the +5V output.
 

The circuit can be easily assembled on a general purpose PCB. Be sure to attach a heats sink to the 7805 with heat sink compound. Recall that the 7805 pumps out 7W as heat.

Attach a USB socket at regulated output ( be sure of the polarity). Connect ground of the circuit to ground of the USB socket and +5V output to Vcc of USB socket. Leave the data pins disconnected.

The power supply is finished! You can now connect the RPI to power supply using a USB data cable with a microUSB connector at the other end.

This PSU costs less than Rs.100 (excluding the battery)

A picture of my prototype -



RPi booted up -

LXDE Desktop loaded  - RCA output on a 26" TV



Process manager

the hardware connections

the experimental setup for my project (i'll make a cookbook of my project in a later blog post)




If you are looking for a better high efficiency power supply, go for LM2576 based PSU. It is also very simple and low-cost, but includes a toroid that is rather difficult to get (you can get it from a burned out computer SMPS) . With the LM2576 PSU your battery lasts longer(atleast double the times compared to the PSU described above).Also this PSU is less bulky.

But for novices, i suggest the 7805 to tryout first.

Happy DIYing!


Saturday, May 4, 2013

DIY LED lamp using recyled materials

HI,

I had  a 20W solar panel, 12V/6A PWM charge controller, and 12V SLA battery lying around in lab for sometime. So thought of lighting up a few LED panels, so that light comes free of of cost at night.

Panels of 24 white LED's (no idea of their luminous power) were available at moderate rates in market(Rs.110/- per panel).  They have brightness compared to a 15W CFL(or a bit less). However the LED panel comes in 'bare-bone' , without any enclosures and on/off switch. I made it out of an empty trash powder tin, and connected an on/off switch (see pictures, 'a picture is worth a thousand words'). Iam in search for more creative casing ideas.

the bare panel along with enclosure cut to fit inside it

add a switch - salvaged from some old appliance


connect panel to switch

connect panel to required length of wire. make a knot inside the cap so that the panel can be hanged


the final finished 'LED lamp'




The rest of the circuit is straight forward. Connect the wires from the panels to lamp output of charge controller(make sure of the polarity). Connect the battery and panel to the charge controller( Again, make sure of the polarity).

The battery was initially 12.23V charged. After the lamp worked for 2 hours and battery voltage dropped to 12.13V - a 0.10V drop - consuming only very low currents. The battery is a bit old ( i can't get it charged to >13V ! ).

the charge controller showing screw terminals for connecting panel, battery and 12 VDC lamps

Close up look of connections


'the Lamp in darkness'

the overall setup showing battery, charge controller and lamp

The panel - make:Lotus India solar power, 20W,costs Rs.1,300

the lit-up lab - picture appears washed out. 


The charge controller costs around Rs.500 and it can even be 'DIY'ed. From a bit reverse engineering, i found that the charge controller contained a PIC microcontroller, an optocoupler, three MOSFETS and some other passive components.
the PCB of charge controller - for those who are curious of 'what's inside?'

I think the project can be build in less than rs.2000, if you are creative in finding use of materials around you. You can use surplus wires lying around, junk electronics parts and metal cans for enclosures.