![]() |
Arduino Bluetooth Relay Control Code |
Hc05 Arduino - Arduino bluetooth module hc05 interfacing to arduino and how to control the arduino bluetooth code for Bluetooth Relay Control Code is discussing here.
Components Used
» Arduino Uno
» HC 05 Bluetooth Module
» Relay Module ( Single Channel)
» USB To DC Jack Converter
» Power Supply - 5 volt / 2 Ampere
Checkout Prices In India
Buy Arduino Uno
Buy HC05 Bluetooth Module
Buy Relay Module
Buy Jumper Wires
Note : The recommended power supply given to the Arduino DC Jack adapter is
5 volt DC with an ampere of 2 Amps.
Step 1 - Connect HC 05 Bluetooth Module To Arduino Uno
» Bluetooth 5 V is connected to ICSP pin Vcc.
» Bluetooth gnd is connected to ICSP gnd pin.
» Bluetooth TX pin is connected to Arduino pin 0
This is shown in the above figure.Positive of icsp is on top most right of arduinio board.The ground pin of icsp is bottom rightmost corner of arduino uno board.
Step 2 - Connect Relay To Arduino Uno
» Relay 5V is connected to Arduino 5 V labelling on Arduino Uno.
» Relay gnd is connected to Arduino gnd.
» Relay input is connected to Arduino pin 3 labelled on arduino uno board.
Step 3 - Light Bulb Wiring Connection To Relay
» The light bulb wiring is shown above
» Here above figure the two stripped wires should be given to the relay.
Step 4 - Connect Load / Light Bulb To Relay
» The above figure shows how the two wire points are connected to relay.
Note : The serial.begin baud rate must be changed if your module is not working
Change values like,
9600
38400
57600
etc.
The default password is 1234
Procedure
» Turn on Bluetooth in your phone and search for HC05 Bluetooth module.
» Pair Hc05 with your mobile phone, by giving default password 1234.
» After pairing go to Bluetooth app.
» Connect with HC05 Bluetooth module.
» Phone will indicates as “ Connected”.
» Turn on switch in app.Thats it.You are done.
Program
char data;
void setup()
{
Serial.begin(38400);
pinMode(3,OUTPUT);
digitalWrite(3,HIGH);
}
void loop()
{
if(Serial.available())
{
data = Serial.read();
Serial.write(data);
}
if(data== 'A')
{
{
digitalWrite(3,LOW);
}
}
if(data== 'a')
{
{
digitalWrite(3,HIGH);
}
}