Introduction: Control the Relays With Android App Using Bluetooth

In this Project, we will control 2 channel relays with an android app using Bluetooth(HC-05).

Step 1: About HC-05 Bluetooth Module:

The HC-05 module is easy to use Bluetooth SPP (Serial Port Protocol) module, designed for transparent wireless serial connection setup. Serial port Bluetooth module is fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with complete 2.4GHz radio transceiver and baseband. It uses CSR Bluecore 04-External single chip Bluetooth system with CMOS technology and with AFH (Adaptive Frequency Hopping Feature). It has the footprint as small as 12.7mmx27mm. Hope it will simplify your overall design/development cycle.

In this project, we use a 2-channel relay board and the MIT App Inventor 2 for developing the Android app.

Step 2: Download Android App:

Step 3: Components Required:

Step 4: Project Setup:

Step 5: Code:

const int SensorPin=7;//const int SensorPin=7;//Level input ports
const int analogIn = A0; const int ledPin = 13;

int SensorState=0; int analogVal = 0;

void setup() { pinMode(SensorPin,INPUT); pinMode(ledPin,OUTPUT); }

void loop() { analogVal = analogRead(analogIn); SensorState=digitalRead(SensorPin); if(SensorState==HIGH) { digitalWrite(ledPin,HIGH); } else { digitalWrite(ledPin,LOW); } }

Note: In Android app have a default command like controlling relays
1, 0, 2, 3. So you can put these commands in your hardware code.

CLICK: