You Are Here: Home » AVR ATmega Projects » White LED Battery Powered Power Failure Light

White LED Battery Powered Power Failure Light


Where I live most of the time, the AC power drops out upon occasion. This used to leave me groping around in the dark for a flashlight. I could have bought a battery-backed up “emergency light” for about US$35, but being basically metal boxes with floodlights attached, they would make my living room look more like a prison. And besides, I make things like this for fun, so thinking about the problem eventually lead to the solution on this web page.

The power failure light that I eventually designed and built is housed in the plastic case from a wall-mounted power transformer. I had accidentally destroyed the transformer by shorting its output, and had kept the plastic case for years, just waiting for a project like this one. Since its mounted in a hand-sized enclosure, when the power fails, it is a simple matter to walk over to the light, unplug it from the wall, and use it like a flashlight to walk into other rooms to retrieve a flashlight. This particular lamp dims after a few minutes, and is down to a dull glow after about 15 minutes. The glow can last for hours after that. I suspect that this is at least partly the result of using rechargeable batteries from a surplus store.

As of this writing,  I have had this power failure light in my living room for a little more than a year. It has come on many times when the AC line failed, and it has worked as intended. I am very glad that I made it.

wall mounted

The two white LEDs are the light source when the AC power goes out.
The green LED is on when the AC power is on to show that the battery is being
trickle charged.  The light would look a lot nicer if I were to have painted
the case to cover up the markings from the original use of the plastic case.

This is not a do-it-yourself construction project. This is a project that I built for my
own use, and I have chosen to publish this as an example for the benefit of those
with similar interests and who have the technical skills to design their own.

The Circuit


Many of the components in this circuit are dedicated to safety-
keeping transient voltages from destroying the lamp,
and keeping the lamp from catching fire. Click on the schematic
for large version.

The circuit can be viewed as four blocks. The AC  line input and trickle charge ring circuit, the power failure switch, and the battery operated white LED driver. We will look at the blocks one at a time.

AC Input and Trickle Charging Circuit

The first thing you should notice about the AC Line Input and Trickle Charging Circuit is the fuse. Not only one fuse, but two, because R1 is a  fusible resistor.  I’m pretty concerned about personal electrical and fire safety, especially when it comes to AC line operated devices in my home. I’ll come back to the fuse later, but first, a little bit about how the circuit works.

If we take the circuit node that is represented in the schematic by the lower AC line input to be our reference, I can talk about the upper connection shown in the schematic -the one that F1 is connected to, as having the full AC power line voltage on it with respect to our reference, and it will be a lot easier to describe the circuits operation.

Under normal, operation, a little while after power is first applied to the circuit,  the AC voltage from the power line sees R1, the 20 Ohm resistor in series with C,1 R3, and the combination of D1, D2, and D3. The 24 volt Metal Oxide Resistor (MOV) does not conduct in normal operation.

The RMS current through the input circuit is approximately equal to the input voltage divided by the series impedance. Impedance is equal to the square root of resistance squared plus the reactance of C1 squared.  The reactance of C1 is
1/(6.28 x 50 x .000000068) = 47,000.

This is very large compared to the resistance, which is dominated by the 20 Ohm resistor, so as a practical matter, we can say that current is equal to the input voltage divided by the reactance (47k) of C1.

The RMS current, in amps, is equal to 240 VRMS / 47k =  5 milliamps RMS. Since average current is equal to 0.9 times RMS current, the total average current available to trickle charge the battery and keep C2 charged up is 4.5 milliamps.

Since most of the voltage is dropped across C1, the current is practically independent of the state of charge on the battery, B1.

A few critical words on the election of components for this part of the circuit. The key safety components are C1, R1, and F1. C1 is an X type capacitor. X type capacitors meet certain safety specifications and are designed to be safely used across the AC power line. Other types of capacitors may fail from the constant AC power line voltage across it, and when they fail, the results could be deadly. Don’t use other types of capacitors. The reason that C1 is a .068 uf capacitor is that this is the largest value  X capacitor that I could get my hands on.


For more detail: White LED Battery Powered Power Failure Light using microcontroller

Leave a Comment

You must be logged in to post a comment.

Read previous post:
atmega32 datasheet PDF download

ATmega32 for which we will see its datasheet is The high-performance, low-power Atmel 8-bit AVR RISC-based microcontroller combines 32KB of programmable...

Scroll to top