This project was inspired by my simple need to avoid painfully hit against corners when the electric power goes out and i'm doing stuff in my pitch black basement, or in other dark places.
After an extended and wise evaluation of other solutions like:
- remove or round off every sharp corner in the whole house,
- become a cat,
- spend an unreasonable amount of money to install commercial emergengy lights,
I come to the conclusion that, with few reclaimed electrical components and a couple of inexpensive modules, i could have made my DIY emergency lights.
After few design iterations i've also come to the conclusion that i could have not only spent a tiny amount of money, but also that i could have upcycled a lot of electrical components that would have been otherwise trashed. With the only exception of the (inexpensive) TP4056 module everything else can be scavenged from other broken electronics, so you can invest some of your time and build your enviroinmental friendly "Mostly reclaimed DIY LED Emergency Lamp".
Step 1: Materials and Tools
For this project you need basic soldering tools and few other basic DIY-electronic tools, I've collected my usual tools on this page. I've designed a dedicated case for this lamp, with the specific purpose of simplify its wiring. It's not mandatory to use but it highly recommended, so you'd better have a 3D printer. I have a (modded) CR-10 but you can use pretty much any 3D printer and whatever filament since it's a really easy print.
To built this lamp we need few other components, which can be salvaged from other electronics or purchased. First thing first: we need a power reserve to use during the blackout, we'll use a 18650 li-ion cell and, of course, its charger/controller TP4056. To control the lamp's behavior we need a three way toggle switch (on-off-on) and a single p-channel mosfet. Well, since it's a "LED" lamp we obviously need a LED and its current-limiting resistor. Add few spare wires, that's all.
Wait, last but not least: we need a wall power adapter to keep our lamp always at the ready, otherwise it won't be an "emergency" lamp. I kept a lot of my old - actually ancient- cellphone wall adapters in a box. Several times i've asked myself how could i've use them for. Too few volt or too few ampere for most applications, but they are perfect for this task, suddenly they aren't trash anymore!
If you don't want to use my 3D case you can use a simple prototyping board and whatever you like as the container. My case is nice because it helps the wiring, since it'sa real PCB. It literally is a (3D) Printed Circuit Board. ^_^
Step 2: Design Explanation
If you just want to build the lamp skip this step, but i suggest to read it since here you can understand how this works and what are its limits.
Why did i choose these components?
18650 li-ion cell: it's a standard cell that can be purchased or reclaimed from unserviceable laptop batteries. To reclaim these cells you need to understand how to check their sanity and why you really shouldn't keep the bad cells near you. Plenty of tutorials in the wild internet. If you don't want to invest time in the right reclaiming procedure just purchase it, better safe than sorry.
TP4056 module: this is a common module that can manage a single 3.6-3.7V li-ion or li-poly cell. It can control its charge and discharge. It's usually combined with another chip, the DW01, that takes care of other issues like short circuit, overvoltage, undervoltage cell's protection and other stuff. This module can't be reclaimed or replaced by something else, you have to buy it.
P-channel mosfet: It's a special transistor, aka electronic switch. This could be seen as the main "trick" of this project, because this only component can add the required "logic" in the lamp's behavior. It can "sense" the blackout and act accordingly. This mosfet can be purchased (it's really cheap, after all) or can be reclaimed from discarded electronic, with a little patience. To reclaim electrical components you'll definitely need something like my Electronic Component Tester! I've used a IRF4905 transistor in a TO-220 case. Not the optimal choice but it works fine.
Three way switch (on/off/on): It's a simple toggle switch that set the lamp in its three different configurations which are:
- always off,
- on during blackout,
- always on.
It can be reclaimed but you have to be lucky, i've found a lot of similar switches but they likely are only two way switches (basically 99% of them).
Power supply: whichever device that is able to provide at least 4.5V and 100 mA is fine. This should really be reclaimed!
LED: while this component can be easily reclaimed almost everywhere, it's actually difficult to find a "bright enough" led. The LED should provide a minimum amount of light in the whole room but the most common salvaged leds are nothing more than indicator lights, with a negligible enlightning power across a whole room. I've used dedicated dedicated 3W leds for this very reason. What's the maximum led power? 5W, but it can be properly powered only for a short time, it will be soon underpowered. And it's definitely not suggested because of heat dissipation issue. BTW, 5W will generate heat. If you don't want to melt the case you have
DC connector: this is optional, but recommended. During the blackout I still need/want to exit the basement, to restore the power or whatever, and i'd like to see what i'm doing, so i have/want to carry my emergency lamp with me. I don't like to unplug and carry also the power adapter, therefore i've added a small DC connector to create a proper portable, stand-alone, emergency light. On the other hand you could just use the USB port to charge the lamp, i only decided not to reserve a microUSB charger for this lamp.
Magnet: also optional, but maybe useful to illuminate something specific during the blackout, placing the lamp on a metallic object. There are two dedicated slots in the case for 10x1mm round magnet, just use a drop of glue to fix them.
Current limiting resistor: mandatory for every led, except if you choose the proper components (like i did). Leds have to be drived controlling the flowing current and not the applied voltage. Every led has a maximum rated current (Id) and its color defines it's rated junction voltage (Vf).
Some producers could say something different in their datasheet, in this case follow the datasheet, but these are the usual Vf for the different colors [V]:
- IR - infrared 1.3
- red: 1.8
- green 2.0
- orange 2.0
- blue 3.5
- UV - ultraviolet 4 – 4.5
To calculate the right current limiting resistor value (R) you must know your power supply's maximum voltage (Va) and use this formula:
R = (Va - Vf) / Id
The TP4056 output voltage is between 4.2 and 2.5V, so we have to use 4.2V as Va. Using the components i've previously linked we have a 3W led with a Vf of 3.5V, therefore we have an Id of 0.85A. In this case numbers are:
R = (4.2V - 3.5V) / 0.85A = 0.82 Ohm
I should add a 1Ohm resistor because i'm actually trying to teach something, in reality it's totally unnecessary, the wires resistance also helps. Moreover, at 0.85A the battery voltage sag will be relevant, so we actually should use -let's say- 3.8-4V as Va. This means that the limiting resistor is even less required.
Another example, with the same led type but 1W rated, numbers are:
Id = 1W / 3.5V = 0.285A
R = (4.2V - 3.5V) / 0.285A = 2.8Ohm
Well, this is the case of specifically chosen components with defined ratings. A generic led could usually work considering as 3V, 10mA. Obviously that's not 100% true, but without better informations...
R = (4.2V - 3V) / 0.01A = 120Ohm
Luckily 120 Ohm is a standard resistor value, if it wasn't i would have used the closest bigger standard value.
The resistor also dissipates power in form of heat, and also its rated wattage should be properly designed. Don't worry it's as easy as the Ohm determination.
W = (Va - Vf) * Id
Since 0.01A (10mA) could flow through the 120 Ohm resistor, it could dissipate 0.012W of heat.
W = (4.2V - 3V) * 0.01A = 0.012W
A common ¼W resistor will be more than enough.
Pull down resistor: this resistor should only keep the mosfet in its supposed state, suppressing any transient or noise that could be collected by the cables and accidentally trigger the mosfet. Any resistor in the 1K-10K Ohm range is fine.
How it works?
I've spent quite few hours to figure out the best design. I tried to optimize the project's cost by minimizing the required components, trying not to give up features. I could have used a microcontroller, there are very cheap basic models sold everywhere. I could have used custom PCB, there are plenty of PCB production & delivery services. I decided not to do that because it would have greatly increased the cost and the complexity. Moreover, it would be really really difficult to reclaim a microcontroller.
The TP4056 does its stuff, taking care of the battery and providing power. Its output pad is connected to the toggle switch center pin, which can be in three configuration: connected to the left pin, not connected, connected to the right pin.
When it's not connected to anything (center, off position) the behavior is quite clear, the led is OFF whether the wall adapter is providing power or not. The charge process is not depending on the switch, if the wall adapter is plugged in the battery will be charged.
Assume that the right pin is connected to the LED's positive terminal. If you toggle the switch to bridge the center and the right pins you will bypass the mosfet. The LED will be ON as long as the TP4056 can provide power.
The remain option is to toggle the switch to bridge the center pin to the mosfet source pin. In this configuration the mosfet takes control. If its gate pin sees the wall adapter voltage it won't allow current to flow between source and drain, and the LED will be OFF. When the blackout kicks in, the charger voltage will rapidly drop to zero. Now the mosfet's gate terminal will see zero volt and will let the current flow, so the LED will be ON as long as the TP4056 can provide power.
Not bad for just a mosfet and simple switch. ^_^
Step 3: Assembly
The wiring diagram is attached, R1 is the current limiting resistor, R2 is the pull down resistor.
To exploit the case's designed traces you have to modify the mosfet as i did. Basically you have to cut the top metal part and bed the central pin to let it go in the hole, to use the underlying trace. Don't worry, this mosfet is rated for way more burdensome tasks than to drive a small LED, it won't be crippled because of the less dissipating area.
Soldering on the 18650 cell IS A DELICATE TASK, be sure to know what you are doing. It's not difficult but it's dangerous. Basically you have to use the soldering iron at max power for the least possibile time, but please spend few minutes to understand a specific tutorial, there are plenty of them. Better safe than sorry.
Beside that, the wiring process is quite straight forward, you only have to follow the attached diagram and look at the photos. Try not to melt the case with the soldering iron, anyway I've printed my case in PLA, which is not tossic if heated. Once the wiring is done use few drops of hot glue to keep everything safe in place.
The DC connector is optional, you can also use the built in USB port. I'll solder a DC connector because i don't want to reserve/cut a micro usb cable for this lamp. I have to reclaim old mobile chargers!
If you want to use the USB port you can use any standard 5V USB cable.
Actually, you can also cut the old wall adapter cable and connect its GND and positive wires to a spare micro USB terminal. Just cut the USB cable and expose its wires' copper, connect the GND cable to pin 5 and connect the positive cable to pin 1 (image attached). To check which wire is pin 1 and 5 you have to use a multimeter as a continuity tester. Well, that's feasible but not recommended. You'll end with a non standard voltage USB plug, and you are putting a lot of effort to do something that could be way more easy with a simple DC connector.
Step 4: Usage
Connect the charger or the USB cable to the emergency light.
Set the switch to whatever mode you like, toggle it to auto if you want the lamp to behave as a proper emergency light.
Wait the next black out and enjoy how can you easily avoid corners! :)
Look at the video, it shows how this lamp behaves. If you like the project, thumbs up and subscribe for more to come.
PS: This is supposed to be an EMERGENCY lamp, you shouldn't use it as a standard lamp. The issue is simple and it's a TP4056 "fault". Long story short: if you use the lamp in bypass mode (led always on) and the charger is plugged in, the battery charge process won't end properly. It probably won't end at all. Yes, with lithium cell this is an issue, you can't pump charge into a cell forever! This configuration is not actually dangerous, if used for few minutes. This lamp won't trigger an explosion if you forget this issue and you just happen to be in this situation. If you need light from this lamp for, let's say, 10 min you can still use it in this mode without being in danger. Just not keep/forget the lamp in this configuration or bad things could happen.