How to make a Bluetooth control lamp | Step by step instructions
Hello, welcome back. In this tutorial, we will learn how to make a Bluetooth control lamp using Arduino. This project is mainly based on a Bluetooth module. Also, this can be easily controlled using our smartphone. We can mainly use this project for our home. Also, you can make this lamp at a very low cost.
Bluetooth control lamp process
When a signal is received through a Bluetooth control app on a smartphone, it is captured by the Bluetooth module. The value is then transmitted to the Arduino board via serial communication. If the value is related to the program, the relay will turn ON or OFF. That is we can turn on or off the bulb.
So, let’s do this project step by step. The required components are given below.
- Arduino UNO board x 1 — Our Store / Amazon
- Bluetooth module x 1 — Our Store / Amazon
- Relay module x 1 — Our Store / Amazon
- AC bulb x 1 — Amazon
- AC bulb holder x 1 — Amazon
- Jumper wires — Our Store / Amazon
- Cardboard — Amazon
Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.
Step 1
Firstly, identify these components.
Step 2
Secondly, cut two pieces of cardboard measuring 5 * 4 inches and 5 * 2 inches. After, glue them as follows. Then, adjust the 5 * 2 piece of cardboard to fit the Arduino board as shown below and glue it to the other piece.
Step 3
Thirdly, attach the Arduino UNO board and relay module to the base cardboard.
Step 4
Next, connect the relay module and the Bluetooth module to the Arduino board. To do this, use the circuit diagram below.
Step 5
Now, connect this Arduino board port to the computer. After, let’s create the program for this project. It is as follows.
- The complete program of this project – Download
/* Bluetooth-activated table lamp.
--------230v AC power. You must carefully---------
created by the SriTu Tech team.
Read the code below and use it for any of your creations
Home Page
*/
char value;
void setup() {
Serial.begin(9600);//enable serial monitor
pinMode(2, OUTPUT);//define relay pin
}
void loop() {
if (Serial.available() > 0) {
value = Serial.read();//read serial value
}
if (value == '1') {
digitalWrite(2, LOW);//lamp ON
} else if (value == '0') {
digitalWrite(2, HIGH);//lamp OFF
}else{
digitalWrite(2,HIGH);
}
}
Code explanation
In the setup, the serial monitor is enabled and the relay pin is set as an output pin.
void setup() {
Serial.begin(9600);//enable serial monitor
pinMode(2, OUTPUT);//define relay pin
}
In the loop, the values are taken from the serial communication and put into a variable named “value”. After this value is 1, the relay module is turned ON. Otherwise, if the value is 0, the relay module is turned OFF.
void loop() {
if (Serial.available() > 0) {
value = Serial.read();//read serial value
}
if (value == ‘1’) {
digitalWrite(2, LOW);//lamp ON
} else if (value == ‘0’) {
digitalWrite(2, HIGH);//lamp OFF
}else{
digitalWrite(2,HIGH);
}
}
Step 6
Now, remember to remove the RX and TX jumper wires. Afterward, select the board and port. Then, Upload this code.
Step 7
Then, reconnect the RX and TX jumper wires. Afterward, connect the AC power wires to the relay module and pull them out through the piece of cardboard.
Step 8
Now cut two 4 * 2-inch pieces of cardboard and a 5 * 2-inch piece of cardboard. After, glue it to the main piece of cardboard.
Step 9
Afterward, cut a 5 * 4-inch piece of cardboard and drill a hole in the middle, and insert the wire to connect the bulb holder. Then, glue this piece of cardboard to the top.
Step 10
Now, connect the bulb holder and the AC power connector.
Step 11
OK, now let’s set up the mobile phone application. For that, use the steps below.
- Firstly, download and install the app below. For that, use the Play Store or App Store.
- Secondly, run this application. After, click the Settings button on the right. Then, click the “Command Button Configuration” button.
- Thirdly, click the “A” button and enter “1” for this. Then click the “B” button and enter “0”
Step 12
OK, this application setup is done. Now, connect the power to the project. For that, connect a voltage of 7v to 12v to the Arduino board and a 230v voltage to the relay module. Be careful when you deal with AC power.
Step 13
Lastly, connect the mobile app to the Bluetooth module. To do this, use the steps below.
- First, enable Bluetooth on your mobile phone and select the name of your Bluetooth module. Afterward, enter the password. For that, use the “0000” or “1234”.
Step 14
Now, run the mobile app we prepared earlier. After, select your device and click the “Button & Slider” button. OK, now click on the A and B buttons. The full video guide is below. So, we will meet in the next tutorial. Have a good day.
How to make a Bluetooth control lamp | Step by step instructions