Welcome to my second Instructable on remote control using Arduino, Bluetooth, and a relay.The first Instructable in this series was design using the serial communication software PuTTY for turning off and on the remote device from your computer. This one will be quite similar in the setup of the project but we will be using the Volthaus lab Bluetooth Controller Android phone app for control. The Bluetooth Controller App was designed using the MIT App Inventor and the source code is available below so you can import it into your MIT App Inventor console to adapt it to your needs if you wish to extend its capabilities, or just study how it works.
I recommend reading the first Instructable "Remote Control - Bluetooth - Arduino - PuTTY" to get some background on the setup. There's no need for me to repeat the steps here because there is no difference.
A word of warning: WARNING 110 volts of alternating current can kill, maim, and otherwise ruin your day so if you're not comfortable working with mains (110VAC in the USA) voltage please use this circuit to remotely turn on and off an LED instead. It is possible you could safely wire up the 110 volt AC circuit and then forget the circuit is live with powerful and deadly voltage and grab a bare wire thinking it is turned off when actually it is not. So be warned. Should you get hurt I am not responsible - You are!
Step 1: Build Your Project
I have made this project work using three kinds of Arduinos. The Arduino Uno, Arduino Pro-Mini, and Arduino Nano. Also either one of the HC-05 or the HC-06 Bluetooth modules will work. In the Fritzing example I am using a level shifter to convert the Bluetooth 3.3VDC signals to 5VDC before sending to the Arduino as well as the reverse, but my current setup is operating perfectly without it.
The things you will need.
HC-06 or HC-05 Bluetooth Module - ebay search
Arduino Uno/Nano/Pro-Mini just to name a few
Relay Module - ebay search Bread Board - ebay search
5 volt direct current source - I used a converted computer ATX power supply
Jumper wires - I use Dupont type - ebay search
3.3V - 5V Logic Level Bi-Directional Shifter Module - ebay search 3.3 volt direct current source - Again I used a converted computer ATX power supply
Step 2: The Code
Here is the Arduino sketch and the Bluetooth Controller app which is the Bluetooth_Controller.apk file. The source code is the Bluetooth_Controller.aia file.
You will have to pair your Android phone with the Bluetooth module before you can operate your relay connected device. For that you simply visit your settings page, then go into the Bluetooth settings where you search for devices, pick the one you are using and pair with the module. The information provided in the first tutorial has further info that will apply.
Once you have downloaded the app to your phone clicking it should be all you need to do for install. No permissions are required.
Quite simple. I hope you enjoy the project and if I can be of any help, post questions and I will (or someone from the Instructables community) try to assist. Happy electronic hobbying.