Introduction: Convert $2 LED Lamp to $50 Smart Lamp
A smart bulb is an internet or Bluetooth-capable LED light bulb that allows lighting to be customized, scheduled and controlled remotely. Smart bulbs are among the most immediately successful offerings in the growing category of home automation and Internet of Things (IoT) products. In today's market many types of smart bulbs are available form price $10 to $100. But, can you think you can convert a low price led bulb to a smart bulb easily? Today I will show you how I converted a cheap Chinese led lamp to a Smart Lamp.
Before going to the details let me explain the basic features of my Smart Lamp.
1. The lamp can be controlled from Android phone using Bluetooth.
2. It can be used as true white lamp as well as color lamp and can produce 16 million colors.
3. Brightness and color can be controlled from smart phone.
4. It operates directly from AC mains.
Step 1: Collect the Materials
1. Low Price LED Light Bulb (ebay.com)
Many types of LED light bulbs are available in local market. Different types of wattage rating are also available. Select one as your requirement. I bought a $1.5, 7W LED Bulb from my local market.
As we want to include some control mechanism and communication features to our light bulb a microcontroller will be required. I selected Arduino UNO because developing prototype using Arduino is very easy. I just programmed the board, tested it and then removed the microcontroller from the UNO board. Then, I put the microcontroller to the circuit board.
For communication with the light bulb from my smart phone I want to use Bluetooth and for the reason I selected low price HC-05 module. The module is working as slave mode and my phone as master.
4. RGB-LED 4 pin 5mm (8pcs) (ebay.com)
There is some power limitation as well as space limitation and for that I used only 8 RGB LEDs. RGB leds are very cool. These have four pin. One is the common and other three pin for three basic colors. You may use datasheet for details pin configuration. Using PWM 16million color can be generated from an RGB led.
5. Optocoupler TLP627 (ebay.com)
Optocoupler has an important role in our project. In the lad light bulb all LEDs are connected in series and connected to 100 V DC. Very simple transformer less power supply is used for step down and rectification and I found enough ripple in the output. If we want to on/off and control brightness of the lamp remotely we have to use a switch between rectifier output and LEDs. A high voltage transistor can be used for the job but for driving the transistor we have to connect it to the microcontroller. As transistor are working in high voltage it may damaged the microcontroller if you directly connect the base of the transistor to the microcontroller. So, an isolation is required between transistor and microcontroller and for the reason I selected opto-transistor instead of general transistor. It is a high voltage opto-transistor and can handle 150mA current which is enough for our circuit.
6. Prototype PCB board (ebay.com)
PCB board is for making connection to all RGB LEDs, transistors and microcontroller.
7. Resistor 100ohm (24pcs, 1/4w), 4.7k (3pcs, 1/4w) (ebay.com)
8. Jumper Cables (ebay.com)
9. Old Android Phone Charger (small size)
This is one of the critical component of our project. It will power the microcontroller and all RGB LEDs. Important fact is that power supply should be small enough and the output should be ripple free 5V, 1A. So, select a good SMP supply of 5V, 1A output. I selected the charger of my old HTC phone and I found it good enough for driving the circuit. Selecting wrong power supply may damaged your circuit, so do it at your own risk.
2. Diagonal wire cutter
5. Desoldering pump (ebay.com)
Step 2: Open the Lamp
At first, take the led light blub and remove the globe shaped diffuser cap. Bring out the circuit board from the base. You will find led driver circuit is vary simple. You will get two capacitor at the bottom of the circuit board. One capacitor is voltage dropper (rectangular shape) and another is filter capacitor. On the top you will find four diode working as bridge rectifier and a current limiting resistor. So, VERY SIMPLE!
Step 3: Hack the Circuit Board
Two big sized capacitors ware placed in the bottom side of the led driver circuit. Remove these two capacitor carefully using desoldering pump. We will be required enough place in bottom side and for the reason we are removing these from bottom side. Don't be confused, we will resolder these in upper side.
Step 4: Cut the Trace
All leds are connected in series. These are connected to the output of the bridge rectifier. Using an anti cutter cut the trace between rectifier output and leds. The reason behind it is that, we want to on/off the lamp manually form smart phone and we also want to control the brightness of the lamp. So we will be required a transistor switch between these. We will drive the transistor using Arduino microcontroller. Instead of general purpose transistor we will place an optoisolator/optotransistor between rectifier and leds.
Step 5: Re-solder the Capacitors
As we removed the capacitors we have to reconnect these but in opposite side. It is the right time to re-soldering the capacitors we removed before. First solder the filter capacitor at it's original place from top side. Be careful, this is electrolytic and polarity must be correct. Now, solder the voltage dropper capacitor at it's place. It is non polarized, so you can solder it either way. At the last stage, we will connect opto-transistor. Connect collector pin of the optoisolator (pin #4 for TLP627) to the output of bridge rectifier and emitter to the leds (pin #3 of 627). Connect two wires to anode and cathode pin (pin # 1 & 2 respectively) of the optocoupler for next step.
Step 6: Cut the PCB
Take a prototype PCB board and cut it in round shape. Cut it in such a way that we can easily place it within the base of the light bulb. Don't make it too small, we will be required enough place at the bottom of it to place Bluetooth module and adapter circuit. Don't make it to big, we have to place microcontroller, RGB LEDs and white LED circuit board above this.
Step 7: Solder the LEDs
After preparing the perfect sized PCB board, it is high time to make RGB LED circuit. Solder eight RGB leds as shown in pictures. An rgb led has 4 lags, longest one is the common (common anode or common cathode) and another three is for red, green and blue color. Solder a 28 pin IC base to the PCB for Arduino microcontroller. Using IC base is good instead of directly soldering microcontroller or any IC to PCB.
Step 8: Solder the Transistors
Connect a 100 ohm resistor to red, green and blue pin of each led. Now, connect all same color pin together as shown in schematic using jumper wire. Solder three transistors to the PCB board. Connect three separate color pins to the emitter of each transistor. Base of every transistor is connected to the microcontroller I/O pin through a current limiting resistor. For error free connection follow the schematic. Optocoupler connection is also shown in the schematic.
Step 9: Open the Charger
Of-course you should use a good quality charger which has regulated 5 V, 1 A output otherwise it may not work even damaged your microcontroller and Bluetooth module. So, use it at your own risk. A android phone charger is actually a low power switch mode power supply which needs small size transformer and filter capacitor. As it requires very small size transformer, the size of the charger is small enough to place it into lamp base.
To make it prepare for our work open the plastic casing of the charger. Bring it out from the case and cut the wire connection.
Step 10: Hack the Charger
Remove the USB connector from the circuit board. Connect two wires to positive and negative output pin of the charger shown in the picture. Connect two ground together using jumper wire shown in picture.
Step 11: Upload Program to Microcontroller
It is the perfect time to upload the arduino sketch to the microcontroller. Because in the next step we will add the microcontroller to the circuit board. Upload following sketch to Arduino UNO board and then remove ATmega328 microcontroller from the UNO board and place it to the RGB circuit board.
After uploading the program you can test it either working or not.
Step 12: Connect Two Circuits Together
Bend all the RGB LEDs soldered previously as shown in picture. Connect anode pin of the optocoupler to the Arduino pin 6 through a 100 ohm resistor and cathode pin to the ground pin of microcontroller. I used extra wire to do so.
Step 13: Fix Two Circuit Board
Put white LED circuit board on RGB circuit board as shown in pic and bend RGB LEDs again according to the pictures. Do it in a way that two circuit board fixed tightly with one another. You may use hot glue to make the bond tighter.
Step 14: Connect Bluetooth Module
Connect four female headed jumper wire to the RGB circuit board according to schematic attached before to connect the Bluetooth module to the Arduino microcontroller. Don't be confused, TX pin of Bluetooth module should be connected to RX pin of Arduino microcontroller and RX pin of the Bluetooth Module must be connected to the TX pin of Arduino microcontroller. Ground pin should be connected together.
Step 15: Enclose the Circuits
Connect the charger adapter to the RGB circuit board at bottom side as like Bluetooth module. Put adapter circuit and Bluetooth module to the base of the lamp first and then put two circuit board on top. Fix all the thinks to the base as shown in pictures. Finally, attach diffuser cap to the base. Congratulation! our Smart Lamp is ready to operate.
Step 16: Make Android App (NO PROGRAMMING)
Making you own Android app is interesting. Don't be upset, we will not use any programming language. We will use very simple MIT App Inventor to make our android app. I attached complete source and .apk file in below. If you want to modify the app just import the .aia file to App Inventor Environment and change as your requirement. I hard coded the MAC address of my Bluetooth module to the app. You must replace it with your own MAC to connect your lamp with the app.
If you are new in App Inventor please take a look here.
OK, we have completed our project. It is the time to enjoy it.