Maker Pro

How To Control a 5V Relay With Bluetooth Using an Arduino and an Android Smartwatch

September 06, 2018 by Reginald Watson

Take your Android smartwatch to the next level by connecting it to a 5V relay with an Arduino over Bluetooth.

Do you want to use your smartwatch to control things around you? This can be done very easily within a few hours! In this tutorial, I will show you how to control your home appliances with an Android Wear watch. I’ll be using the Moto360 watch, but you can install the app in any Wear OS (formerly Android Wear) watch. At the end of this project, you will be able to control any electrical device with the flick of your wrist.

Hardware Requirements

Arduino UNO

5V relay

HC-06 Bluetooth module

Any Wear OS watch (I'll be using my Moto360 watch for this tutorial)

Hardware Assembly

Connect the hardware as shown in the schematics below.

Connect your Arduino UNO to the HC-06 Bluetooth module.

Please be careful with this step! Remove the electric supply first. This will work as a switch, so remove the physical switch and connect to relay pin NC and COM and tighten the screw.

Install Arduino Software

You can install Arduino IDE by on Arduino's website.

Once installed, open Arduino IDE and connect your Arduino UNO with a USB cable.

Upload the Source Code

This code uses Arduino’s serial communication protocol with the Bluetooth module. The RX and TX pins of the Arduino connect to the TX and RX pins of the HC-06 Bluetooth module, respectively.

The Bluetooth module receives data from the paired Android smartwatch and triggers the relay based on the received data.

The code behind this is pretty simple. If the received data is the character "1", the relay will be triggered and turned on, and if the received data is the character "0", the relay will be turned off.

//--------BT app control---------//
//Program for four switches but in our case we are using pin 11

int switch1=11;
int switch2=12;
int switch3=8;
int switch4=7;

int Received=0;
int switch1_state =0;
int switch2_state =0;
int switch3_state = 0;
int switch4_state = 0;

void setup(){

void loop(){
    Received =;


if (switch1_state == 0 && Received == '1')
if (switch1_state ==1 && Received == '1')

if (switch2_state == 0 && Received == '2')
if (switch2_state ==1 && Received == '2')
if (switch3_state == 0 && Received == '3')
if (switch3_state ==1 && Received == '3')
if (switch4_state == 0 && Received == '4')
if (switch4_state ==1 && Received == '4')

Install apk in Wear OS

Download the apk file for the smartwatch app.

Using ADB over Wi-Fi, follow these steps to install the app on your smartwatch:

  1. Go to dev setting on your watch, and turn ON ADB and Bluetooth ADB.
  2. Go to Bluetooth setting in Android Wear app on your phone, and Turn the ADB over the Bluetooth.
  3. Get basic adb on your computer:
  4. Connect your phone with the computer and turn on the ADB USB option in Developer
  5. After this setup In your computer, open the console in the folder that contains the ADB files and apk.
  6. Perform the command: adb Devices, adb forward tcp:6666, localabstract:/adb-hub, adb connect localhost:6666
  7. After establishing a connection with the watch choose "adb -e install apkname.apk".
  8. Replace apkname with BluetoothWatch-debug.apk with the right path if you are outside the directory containing the file.

The menu you need to access in the second step listed above.

How the commands will look after proper installation of the app.

How to Pair Your Bluetooth Device

After installation, connect your smartwatch to the HC-06 module.

You need to pair the HC-06 Bluetooth module with your Android smartwatch before you can use it in the app.

You should see the HC-06 device available on your smartwatch.

Now follow these steps:

  1. Open your device's Bluetooth settings and search for new devices, make sure the LED on the HC-06 module is blinking continuously (Pairing Mode).
  2. Select HC-06 (or you'll see an address ending with "C" as shown in the pictures).
  3. Enter the PIN "1234" and press OK.
  4. Open the "Wear OS” app and click the Bluetooth button on the top of the screen.
  5. Select "HC-06" from the list.
  6. Use the switch with the icon of a lightbulb or shake the watch to turn the relay ON/OFF. Make sure your Arduino is already uploaded with the code above.
  7. Click the settings icon if you want to adjust the shaking calibration.

And that's it! Your smartwatch is now connected. You can now control the 5V relay through your watch via Bluetooth.

To watch the project take shape from start to finish, watch the video below.


Reginald Watson

I love challenging myself by creating new projects using different microcontrollers to see what I can come up with.

Related Content


You May Also Like