top of page

Want to make a Smart Lighting System with 3 LEDs using HC-05, RPi, and mobile?

Updated: Apr 6

Nowadays, the idea of a #Smart Lighting System is getting emerged rapidly. You would have watched the advertisements on television that a man will be controlling home lights from his workplace.

Do you know how that works? It's nothing but an integrated work of #Bluetooth and mobile application. As you proceed, you will get to know about the working of the Bluetooth device and how this circuit works?


However, this article provides step by step guide to perform the #interfacing, starting from the list of required components.


APPARATUS REQUIRED:


The following list provides the hardware and software components required to perform this interfacing.

Hardware components:


1.Bluetooth Module [HC-05]:

This module follows the IEEE 802.15.1 Standardized protocol. It helps us to construct a Wireless Personal Area Network (PAN), and for the transmission of data, the device employs frequency hopping spread spectrum (FHSS). To interact with other devices, it uses the mode of serial communication. The module consists of 6 pins and it can be operated either in master or slave configuration.

Bluetooth Module [HC-05]

2.Raspberry Pi 3:

We are using #Raspberrypi to connect with the Bluetooth HC-05 module and display the output. It contains several I/O pins using which we can connect the module and then by coding the Raspberry pi, we will receive the commands/signals that are sent from the mobile.

Raspberry Pi 3


3.USB Cable:

This cable is used to connect the #Raspberrypi to the power supply. It also helps in the transmission of data.

USB Cable

4. Jumper wires:


These are simple connecting wires, that are used to connect the ends without any soldering. The male wires have the ends that can be connected to other ends and the female wires are the ones that have the receiving end.

Jumper wires


Software components:


5.SSH Terminal:

The SHH Terminal is used in this project to connect the Raspberry Pi module to the terminal of another computer.

SSH Terminal

6.Python IDE:

Python Programming is done in an IDE (Integrated Development Environment) is a platform where we can write the code, run, and test the working.


CIRCUIT:



First, we shall connect the Bluetooth module HC-05 with a raspberry pi device.


What goes where?

  • The RED wire connects the VCC of the Bluetooth module to the 5V (VCC) of the raspberry pi.

  • The BLACK wire connects the ground pin of HC-05 to the ground pin of the raspberry pi.

  • The YELLOW wire connects the transmitting pin [TX] of HC-05 to the receiving pin [RX] of the raspberry pi device.

  • The BLUE wire connects the receiving pin [RX] of HC-05 to the transmitting pin[TX] of the raspberry pi.


After finishing this, we shall connect the LEDs fixed in the breadboard to the interface of HC-05 and raspberry pi.

We can connect the LEDs in any of these pins but should be mentioned accordingly in code files. In the above-given circuit, the PINK wire is connected with GPIO 27 pin and that shall be our first LED. The BLUE wire connects the second LED with GPIO 17 pin. And the ORANGE wire connects our third LED with GPIO 18 pin. The overall ground is then connected to the GND pin of the raspberry pi.


Then power supply is given to the circuit, the raspberry pi gets the boot-up and the LED of Bluetooth module HC-05 flashes rapidly indicating that it is ready to connect.


Code:



Note: This file is in the text format and should be converted to python-format (.py) before downloading.


Working:


The Bluetooth terminal HC-05 is the mobile application employed here to establish a connection with HC-05. In that application-specific buttons are created to perform the operations.

The application is now configured with buttons related to this experiment such as LED 1, LED 2, LED 3, all LED off, all LED on. The ASCII command of LED 1 On is 1 and LED 2 On is 2, LED 3 On is 3.

For all LEDs on, the command is 4 and all LED off its 5.

After making these configurations, we can check the credibility of this setup by giving the necessary commands in mobile application and the glow of LEDs respectively.


After the execution of code, according to the input commands given in the mobile application the LED glows.

The ASCII command is given as 1,

And the first LED glows,


The ASCII command is given as 2,


The second LED glows,


The ASCII command is given as 3,


The third LED glows,


The ASCII command is given as 4,


All LEDs are glowing,


The ASCII command is given as 5,


And no LED is glowing,


The practical implementation of this interfacing is presented here as a video.


Video credits: Sai Parimal


As mentioned before, nowadays the demand for a smart lighting system is getting increased. By experimenting with this prototype of controlling LEDs using mobile apps, we can understand the concept of controlling our smart home appliances from workplaces. Energy conservation is a big advantage of this theme.


See also:



225 views2 comments
bottom of page