The tutorial shall help us build a circuit and control it through the mobile app.
Let's say you will be able to control lights of your home? So, not really the lights but for brevity's sake we will be controlling an LED for now and you can add all kinds of circuitry later!
Step 1: Parts Required
Before we begin, here is a parts list of everything we will need for this Instructable. You can also purchase the parts from your local vendor or online from Amazon or ebay.
- Arduino Board
- HC-05 Bluetooth Sensor
When designing this circuit we made sure to select common components that can be found just about anywhere that sells electronic parts. Link for purchasing from Amazon.in is enclosed.
Step 2: Theory
How does it work?
HC 05/06 works on serial communication. The Android app is designed to send serial data to the Arduino Bluetooth module when a button is pressed on the app. The Arduino Bluetooth module at the other end receives the data and sends it to the Arduino through the TX pin of the Bluetooth module (connected to RX pin of Arduino). The code uploaded to the Arduino checks the received data and compares it. If the received data is 1, the LED turns ON. The LED turns OFF when the received data is 0. You can open the serial monitor and watch the received data while connecting.
Step 3: Connecting the Arduino Bluetooth Hardware
This circuit is simple and small.
Follow the connections to be made between the Arduino and Bluetooth module!
Connections Of Bluetooth module HC05 :-
- VCC – to VCC of Arduino.
- GND – to GND of Arduino.
- RX – to digital pin 0(TX pin) of Arduino.
- TX – to digital pin 1(RX pin) of Arduino. (connect RX & TX pin after uploading the code)
- Positive terminal – to pin 13 of Arduino.
- Negative terminal – GND of Arduino.
Step 4: Procedure
- Make the connections as shown in the above image.
- Download the app called Arduino Bluetooth Control from Play store/ App store (It’s free).
- Open the app (It will automatically turn on the device’s Bluetooth).
- Go to options. Click and Choose the device – HC 05.
- When you are connecting to the Bluetooth module for the first time, it will ask you the password.
- Enter 0000 OR 1234.
- When the device gets successfully paired with the sensor, the LED lights on sensor will start blinking at a slower rate than usual.
- Check the video for proper working
- Copy the code given below in the sketch. Upload to arduino and test it out !
Note: Don’t connect RX to RX and TX to TX on the Bluetooth and Arduino. You will receive no data. Here, TX means transmit and RX means receive.
Step 5: Now, It Works!!
So, now we have our app and hardware working.
Your app has 2 buttons and they switch the lights on and off and also let your manage your connection with the bluetooth module. Play with these, your work is over.
The next step will be to adding a relay instead of the LED and control your home's lights through a remote control or voice commanded.