$3 Smart Bulb Holder

by taifur in Circuits > Wireless

8885 Views, 62 Favorites, 0 Comments

$3 Smart Bulb Holder

Smart Bulb Holder
1.jpg
2.jpg

Most of the time I realized the necessity of controlling my room light from my bed. I can replace the bulb with a smart bulb but they are expensive. Some cheap solution is available using remote control but for this solution, I need to change or modify the switchboard. I don't like to do this because I am lazy and like to keep lazy. Suddenly I discover the smart bulb holder which can convert any lamp to smart lamp and does not require any connection change. I am sorry, these are also expensive.

Suddenly the idea came to my mind, why I am not making my own Smart Bulb Holder? I am a Maker!!!

Finally, I became successful to make my own Smart Bulb Holder by spending only $3 and going to share the recipe with you.

So, if you like to make one yourself keep reading and before going to next step watch the working video first.

What You Need to Buy...

IMG_20190516_090130.jpg
wall adapter.jpeg
b22toe27.jpg
perf.jpg
IMG_20190516_090113.jpg

To make the project you will be required a few basic components list as follows:

  1. ESP8266-01 WiFi Module ($1.15) (aliexpress.com)
  2. B22 to E27 Bulb Base ($0.45) (aliexpress.com)
  3. 5V Relay ($0.3) (aliexpress.com)
  4. 5V, 0.5A Mobile Charger (the old one will be ok) ($1) (aliexpress.com)
  5. 4N35 Optocoupler ($0.1) (aliexpress.com)
  6. 16V, 470uF Electrolytic Capacitor ($0.1)
  7. 2N2222A General Purpose NPN Transistor ($0.05)
  8. AMS1117 3.3V Regulator ($0.05) (aliexpress.com)
  9. 1K and 220R Resistor
  10. 1N4148 Diode
  11. Perfboard

You will also be required the following tools:

  1. Soldering Station (gearbest.com)
  2. Wire Stripper & Cutter (gearbest.com)
  3. 3D Printer (gearbest.com)
  4. Slide Caliper (gearbest.com)

Making of ESP8266 Relay Board (Part 1)

IMG_20190516_090534.jpg
IMG_20190516_092926.jpg
IMG_20190516_094105.jpg
IMG_20190516_100352.jpg
ESP8266_relay_switch.png
Relay-Module-Circuit-Schematics.png
Relay-Diagram.png

We will solder the ESP8266 module and the 5V relay in the perfboard in this stage. The following figure shows the connection between the relay and esp module. Without the esp module and the relay, the diagram includes a few auxiliary components. So, before start soldering let me give a brief introduction for each component for your better understanding.

ESP8266: ESP8266 is a great thing for starting any Wifi and IoT Project. It can be a very good option for any low-cost smart home devices because it is also cheap and be used for making cool projects connected to the Internet. The ESP8266 WiFi Module is a self-contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor. Each ESP8266 module comes pre-programmed with an AT command set firmware, meaning, you can simply hook this up to your Arduino device and get about as much WiFi-ability as a WiFi Shield offers (and that’s just out of the box)! The ESP8266 module is an extremely cost-effective board with a huge, and ever-growing, community. Another most important feature of the module is that you can program it using the Arduino environment.

For those above obvious reasons, I am choosing ESP8266-01 module for my smart lamp project.

Relay: A relay is an electrically operated switch that can be turned on or off, letting the current go through or not, and can be controlled with low voltages, like the 5V provided by the Arduino or other microcontroller pins. A Relay is actually a switch which is electrically operated by an electromagnet. The electromagnet is activated with a low voltage, for example 5 volts from a microcontroller and it pulls a contact to make or break a high voltage circuit.

Optocoupler: An Optocoupler, is an electronic component that interconnects two separate electrical circuits by means of a light-sensitive optical interface. The basic design of an optocoupler, also known as an Opto-isolator, consists of an LED that produces infra-red light and a semiconductor photo-sensitive device that is used to detect the emitted infra-red beam. Both the LED and photo-sensitive device are enclosed in a light-tight body or package with metal legs for the electrical connections as shown.

In microcontroller application relays usually are driven using optocouplers, which offer isolation between the analog and digital grounds to ensure that switching currents in the relay coils do not affect the noise margin of the digital circuit. For driving a large number of relays through a bus-based backplane, the onboard complex programmable logic device (CPLD)/FPGA provides the interfacing and diagnostics to the I/O board.

Flyback Diode: A Flyback diode is also called a freewheeling diode. It is also called by many other names like snubber diode, suppressor diode, catch diode or clamp diode, commutating diode. For an inductive load like a motor, relay, etc. a flyback diode is used to helps the circuit from damage. Since an inductor (the relay coil) cannot change it's current instantly, the flyback diode provides a path for the current when the coil is switched off. Otherwise, a voltage spike will occur causing arcing on switch contacts or possibly destroying switching transistors.

I hope you understood the circuit. Now place the components on the PCB board one by one and solder. I prefer to use the pin header for esp module without directly soldering it to the board. It will prevent from burning during soldering. You can also unplug and update the program easily. Use an led for the component DS1. The output of the optocoupler cannot directly drive the relay coil. For this reason, I used an npn transistor to the optocoupler output.

Making of ESP8266 Relay Board (Part 2)

IMG_20190516_102318.jpg
IMG_20190516_102423.jpg
IMG_20190516_103125.jpg
IMG_20190516_103138.jpg
IMG_20190516_103150.jpg
voltage-regulator.jpg

As we are providing the power to the ESP board from a 5V supply an ESP board required 3.3v for normal operation, in this stage, we will connect a 3.3V regulator and a capacitor with the circuit.


A large capacitor (suggest using 470 uF) across the Vcc to Gnd rails on your breadboard or PCB is a vital ingredient that will minimize reset inducing voltage fluctuations. A 0.1 uF decoupling capacitor across the ESP8266 Vcc to Gnd inputs very close to the pins (within 1/2 inch). DO NOT SKIP THIS COMPONENT! This cheap yet often overlooked component, when missing, is the root cause of ESP8266 resets.

The 3.3V regulator I have in my bucket is a SMD regulator. So, I place it on the back side.

Hacking of B22 to E27 Converter (Part 1)

IMG_20190516_175551.jpg
IMG_20190516_180058.jpg
IMG_20190517_101746.jpg
IMG_20190517_101801.jpg
IMG_20190517_101826.jpg

This is one of the important steps in making the project. We will separate two part of the converter and make some wiring in this step. To separate the metal base cap from upper E27 threaded part you need to use a knife. Using the knife carefully separate the two parts.

In the bottom part, we need to solder two wires to the connection terminals like the image attached. To make the connection strong and fixed we should use some hot glue. But during gluing you should be very careful about the separation of two wire terminal. They must be isolated from the body and as well as form each other. If required you may use insulated tape.

The next step is to connect two wires to the two terminal of the threaded part. The threaded part is connected to a plastic base with two screws. I connect two wires directly with the screws. The image will help to make a better understanding. You also need to make three holes on the plastic part. Two on the bottom side to bring out the connecting wires from metal cap and one on the side to bring out all the wires outside of the converter.

Hacking of B22 to E27 Converter (Part 2)

IMG_20190517_101854.jpg
IMG_20190517_101913.jpg
IMG_20190517_102005.jpg
IMG_20190517_155058.jpg

Now, take out two wires from the base cap through the holes of the upper plastic part as shown on the image. Then bring out all four wires (two from the bottom part and two from the upper part) through the side hole of the plastic part. If you connect each pares of the wire it will provide power directly to the bulb which actually does the holder. We will connect two-part through a relay and the relay will be controlled by esp8266.

3D Printing

IMG_20190523_151302.jpg
IMG_20190523_151325.jpg
Untitled.png

The encloser of the circuitry is 3D printed. I designed the encloser in Tinkercad. Tinkercad is an easy-to-use, browser-based 3D design tool for all. From kids to designers to hobbyists, with Tinkercad you can create 3D printable items: toys to play with, decoration to light up your home or jewelry to express yourself. If you’re looking to get into 3D design, TinkerCAD is a great place to start.

The STL files attached. You can modify the files if you feel or required for housing your custom made circuit. Tinkercad is also a good tool for modifying an STL file.

Setup Blynk App & Upload Sketch

Screenshot_2019-05-24-12-02-15-999_cc.blynk.png
Screenshot_2019-05-24-12-02-41-730_cc.blynk.png
Screenshot_2019-05-24-12-03-43-967_cc.blynk.png
Screenshot_2019-05-24-12-05-16-090_cc.blynk.png
Screenshot_2019-05-24-12-51-08-384_cc.blynk.png
Screenshot_2019-05-24-12-51-17-926_cc.blynk.png

What's Blynk? Blynk is a Platform with iOS and Android apps to control Arduino, Raspberry Pi, and the likes over the Internet. It’s a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets. (Source: Blynk website).

To set up the Blynk App, you should follow the steps below :
1. Download the Blynk app on your smartphone and create an account. To do this:

Download Blynk apps:

• iOS: https://itunes.apple.com/us/app/blynk-control-ard...

• Android: https://itunes.apple.com/us/app/blynk-control-ard...

2. Create a new project, select from the list your hardware (NodeMCU).

3. Select connection type (USB,Wifi,Bluetooth...).

4. Add a widget to your control panel by clicking on the plus icon on the top right.

5. Select the Button widget, and double tap on it to edit its settings.

Note: Authentication key is sent to your email.

Upload the following program in ESP8266 module and try with the Blynk app. Before uploading don't forget to replace your own Auth Token sent to your email. For successfully compiling you need to include the Blynk Arduino library.

/*************************************************************
  Download latest Blynk library here:
     https://github.com/blynkkk/blynk-library/releases...

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials:  https://github.com/blynkkk/blynk-library/releases...
    Sketch generator:            https://github.com/blynkkk/blynk-library/releases...
    Blynk community:             https://github.com/blynkkk/blynk-library/releases...
    Follow us:                   https://github.com/blynkkk/blynk-library/releases...
                                 https://github.com/blynkkk/blynk-library/releases...

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example runs directly on ESP8266 chip.

  Note: This requires ESP8266 support package:
     https://github.com/blynkkk/blynk-library/releases...

  Please be sure to select the right ESP8266 module
  in the Tools -> Board menu!

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include 
#include 

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}

Assembling of the B22 to E27 Converter

IMG_20190523_151506.jpg
IMG_20190523_151548.jpg
IMG_20190523_151535.jpg
IMG_20190523_151851.jpg
IMG_20190523_151856.jpg

After making all the required circuits and printing the encloser it is the right time to assemble the parts. First I placed the modified converter to the central hole keeping the wires in the cut side. Then I bring out each pair of wires through two separate side hole.

Assembling of Power & Relay Board

IMG_20190523_152036.jpg
IMG_20190523_152635.jpg
IMG_20190523_152646.jpg
IMG_20190523_154208.jpg
IMG_20190523_154922.jpg
IMG_20190523_154935.jpg
IMG_20190523_155406.jpg
IMG_20190523_155418.jpg
IMG_20190523_155431.jpg

This is the most tricky part of assembling. You need to make connection among relay circuit, power circuit and the base. Power circuit should be connected to the parallel to the bottom part of the converter and the relay circuit should be connected in series with the converter. Follow the schematic for the connection. The 5V output of the power circuit is connected to the 5V input of the relay board. After connecting all the boards I placed two circuit board in two sides of the hole as shown on the image.

Make a test without placing the top part of the enclosed. If everything goes well esp should power up. If it power up successfully then Congratulation!!! Connect the lamp and enjoy.