IoT Light Bulb – Remote Control Light Bulb Blynk App


In today’s post, we will design an IoT light bulb that can be remotely controlled from anywhere in the world. This project would convert an electrical A.C. light bulb to a smart bulb step by step using the ESP32 CAM, Arduino and Blynk app. After reading this tutorial post, you will learn how to control an AC light bulb via the Internet of Things (IoT) using the Blynk app and ESP32-CAM WiFi Development Board. Make sure you read all the way through to the end to fully comprehend it.

Materials and Components Needed for this project.

For this project we are going to be needing the following modules/components:

Circuit Diagram for IoT Light Bulb Using Blynk app

IoT light bulb- remote control light bulb
The circuit diagram

Explanation of  the schematic diagram of IoT Light Bulb – Remote Control Light Bulb Using Arduino And Blynk app project.

The circuit diagram shown above used the TIP41C NPN transistor to form a common emitter follower configuration. The 5V solid state relay is turned on and off without a based transistor since the ESP32-CAM dev board has a maximum out put voltage of 3.3V.

Two LEDs were connected in the circuit to show a blink without delay and also to visualize when the 5V relay is turned on and off from the Blynk app. These were tested without no current limiting resistors and they worked just fine. The PCB socket was used to connected the electrical wire plug. All Neutral lines were connected together. While the live line was controlled by the 5V solid state relay output. This is shown in the second breadboard schematic below.

The circuit diagram above works but we recommend using a method to control the 5V solid state relay to be in a two stable states, either ON or OFF; a transistor logic level inverter be created. This comprised of two 220kΩ resistor and a 10kΩ resistor configured around an NPN transistor. The setup of this logic level shifter is to convert the 3.3V HIGH on the ESP32 CAM GPIO pin to 0V and the 0V LOW to 5V.

This was noticed practically that when switching DC voltage using the 5V solid state relay, the HIGH voltage won’t be enough when using boards like ESP32, ESP32 CAM, ESP8266, Raspberry pi etc. To know more about the calculations used for this simple logic level shifter follow this link.

Breadboard IoT Light Bulb – Remote Control Light Bulb with Blynk App Project

The Breadboard Setup

Remote control light bulb
Breadboarding the Circuit Diagram

The ESP32-CAM  development (dev) board was placed on the breadboard so that it can control the TIP41C NPN  transistor through the base resistor 10kΩ.  We attached the dev board to the breadboard and used the preformed jumper wires to finish off the rest of the connection between the transistor and the 5V solid state relay.

Powering the breadboard Assembly

The 5V power needed for this bread setup was drawn from the programming CH340 adapter. The 5V of the ESP32-CAM is connected to the Vcc pin on the CH340 adapter; this is how the ESP32 Cam is connected. The emitter of the Transistor must have a common ground (GND) with the ESP32 Cam.


When working with alternating current (AC) voltages, care must be taken to avoid electric shocks. The best way to control the flow of AC voltage through the socket outlet is to use the PCB socket header and terminate the wires carefully.

 Step 1:

strip off wires for connection
strip off wires for connection

Strip off/Peel off the insulation AC wire terminals to expose the Live and Neutral wires to source the AC voltage to the PCB header. Screw and terminate these AC cables to the PCB header socket and ensure they are tight and firm.

Step 2:

Remote control light bulb

Open the lamp holder cover and safely attach the Live and Neutral cable. Ensure they are tight and firm.

Step 3:

Use the 5V solid state relay to interrupt the AC Live (L) wire. This is shown in the schematic and breadboard diagram above. The remote control would talk to the ESP32-CAM development board and it will talk to the 5V solid state relay and tell it when it should turn on the AC bulb.

Step 4:

Connect the rest of the wires to the 5V solid state relay as shown in the circuit diagram above, ensuring that all the Neutral lines (wires) are connected together.

Step 5:

Use insulation tape to insulate and isolate all exposed AC voltage wires joined together. This will reduce the electric shock when the system is powered.

Setting Up the Blynk Control.

Step 1: Download the Blynk app

download Blynk app from playstore
download the Blynk app from Playstore

Open the respective app store for your device and find Blynk legacy. Please get the Blynk legacy version because that was used for this project. If you are unable to use this version, please leave a comment in the section below so that we can tell you how to use the most recent version of the Blynk IoT app for this IoT light bulb – Remote Control Light Bulb Blynk App project.

Step 2: Installing the Blynk app

install the Blynk app from playstore
install the Blynk app

We installed the app on our android or iPhone device as shown in the picture above.

Step 3: Create New project

After successful installation, we signed up or signed since we already have an account and click on New Project as shown below.

Step 4: Pick a name for your new Project

IoT light bulb
Enter the name of the project

After setting the name of the project, we selected our device type, and clicked create.

Step 5: Retrieve the token for IoT light Bulb – Remote Control Light Bulb Project

We went to our mailbox or alternatively our Blynk dashboard to copy the token. This would be used in the Arduino code later.

Step 6: Create our GUI design

IoT remote bulb control
The GUI button

We clicked on the add button on the upper right side and add the button widget. Configure this button widget by clicking on it and selecting where the virtual pin is selected.

This was saved and it was done.

Programming the ESP32-CAM.

We removed the ESP32-CAM from the breadboard and placed it onto the ESP32-Cam programmer adapter. We connected the USB flex to the port of the programmer. The programmer used a type B USB flex to its USB programmer as shown here below. This was connected this cable to our PC, the power  LED on the programmer came on. We opened the Arduino IDE and copied the code below and compiled it successfully.

The Arduino source code for converting electrical socket to smart plug socket with ESP32 CAM Arduino Blynk app.

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

//int led_gpio = 13;

#define Authorization_key "CjMXMZ3xjcbpG7gtnSPTFisJFkJ3WxF9" //EExmWR-3B8jC7H0ttOzr9qmtAciGW8DR
#define SSID "AncII"       // replace with your SSID
#define Password "eureka26"           //replace with your password

void setup() {  
  //pinMode(led_gpio, OUTPUT); 
  WiFi.begin(SSID, Password);
  while (WiFi.status() != WL_CONNECTED) {
void loop(){;

Arduino Source code (sketch) Explanation.

The Arduino sketch given above began with including the various libraries from Blynk and WiFi connectivity;  The Authentication Key was inserted from the email sent by Blynk after creating the project; so was the Internet WiFi USSID and Password too from an existing network with good internet access.

Once these are all set, we select our port number, select AI thinker ESP32-Cam as the development board then upload code.

Testing the Final Setup for IoT light Bulb – Remote Control Light Bulb Project.

With the complete setup done, we have the following testing results as shown here.

IoT control of AC light bulb using Blynk App

The button on the phone would allow us to turn the AC light bulb into a smart AC light bulb. We can turn it on and off remotely from anywhere around the globe.

IoT control of AC light bulb using Blynk App

Once we are connected to the internet, the setup works nicely; as expected!


The project was aimed at using IoT to control an AC light bulb via a mobile app. We have successfully shown that we can convert the traditional AC light bulb to smart light bulb with ESP32 CAM, Arduino, and the Blynk app. Do you think you can do the same or even more than this? Kindly let us know by commenting below. Also, if you have any questions, leave us a message in the comment section or on our WhatsApp handle or telegram group.

Don’t forget to share this post if you like it. You can read the next post on:

See you on the next post.

Thank You.

Leave a Reply

Your email address will not be published. Required fields are marked *