ali khaled ibrahim
Created September 19, 2017

arduino HC-05 8 channel relay module

this is a 100% functional tutorial for home automation the app and the code are available....

87
arduino HC-05 8 channel relay module

Things used in this project

Hardware components

HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Arduino UNO
Arduino UNO
×1
uln2803
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
jumper wires
×1

Software apps and online services

MIT App Inventor
MIT App Inventor
arduino IDE

Story

Read more

Schematics

connecting hc-05 to arduino

use 3.3v power supply

uln2803

u use it in case the relay module work on reverse ...low high and high is low
the relayy module will be active low

connecting uln2803 to mirco controler and relay module

ground the relay module to the uln but ,,, connect jd vcc and gnd to power supply

Code

8 channel relay control

Arduino
u need is with the app i made for the sync
its the simplest code ever
int relay1=2,relay2=3,relay3=4,relay4=5,relay5=6,relay6=7,relay7=8,relay8=9;
char status;
void setup() {
 Serial.begin(9600);
 pinMode(relay1,OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3,OUTPUT);
pinMode(relay4,OUTPUT);
pinMode(relay5,OUTPUT);
pinMode(relay6,OUTPUT);
pinMode(relay7,OUTPUT);
pinMode(relay8,OUTPUT);
digitalWrite(relay1,LOW);
digitalWrite(relay2,LOW);
digitalWrite(relay3,LOW);
digitalWrite(relay4,LOW);
digitalWrite(relay5,LOW);
digitalWrite(relay6,LOW);
digitalWrite(relay7,LOW);
digitalWrite(relay8,LOW);
}

void loop() {
status=Serial.read();
 
if(status=='a')
{digitalWrite(relay1,HIGH);}
if(status=='b')
{digitalWrite(relay1,LOW);}
if(status=='c')
{digitalWrite(relay2,HIGH);}
if(status=='d')
{digitalWrite(relay2,LOW);}
if(status=='e')
{digitalWrite(relay3,HIGH);}
if(status=='f')
{digitalWrite(relay3,LOW);}
if(status=='g')
{digitalWrite(relay4,HIGH);}
if(status=='h')
{digitalWrite(relay4,LOW);}
if(status=='i')
{digitalWrite(relay5,HIGH);}
if(status=='j')
{digitalWrite(relay5,LOW);}
if(status=='k')
{digitalWrite(relay6,HIGH);}
if(status=='l')
{digitalWrite(relay6,LOW);}
if(status=='m')
{digitalWrite(relay7,HIGH);}
if(status=='n')
{digitalWrite(relay7,LOW);}
if(status=='o')
{digitalWrite(relay8,HIGH);}
if(status=='p')
{digitalWrite(relay8,LOW);}


}

Credits

ali khaled ibrahim

ali khaled ibrahim

0 projects • 0 followers
mechanical engineer student and teacher

Comments