Header Ads Widget

Arduino Bluetooth home automation in Telugu | Arduino UNO, HC-05 Bluetooth

Arduino is a versatile platform that can be used for a variety of purposes, including home automation. With Arduino, you can build devices that can control things like lights, fans, and temperature in your home. This can be a great way to make your home more comfortable and efficient.

One of the easiest ways to get started with Arduino home automation is to build a device that controls your lights. You can use an Arduino to control your lights using either switches . For switches, you can use a simple relay board to control your lights. This board can be controlled using your Arduino, and it will allow you to turn your lights on and off using simple commands.

Arduino Bluetooth home automation in Telugu video:





components :

Below components are using to make this project
  • Arduino uno                            BuyNow
  • HC-05 Bluetooth module        BuyNow
  • Relay module                          BuyNow
  • Bread board                            BuyNow
  • connecting wires                    BuyNow
If you want to buy Arduino components, I am giving my affiliate links. If you buy the components using my affiliate links, it will help to our channel and website growth. so do these small help.


Arduino Bluetooth home automation  circuit:

click here to Download


Arduino Bluetooth home automation  code:

#define relay1 4  
#define relay2 5  
#define relay3 6  
#define relay4 7 

#define Switch1 10 
#define Switch2 11  
#define Switch3 12 
#define Switch4 13  

bool SwitchState_1 = LOW;
bool SwitchState_2 = LOW;
bool SwitchState_3 = LOW;
bool SwitchState_4 = LOW;

char bluetooth_data; // variable for storing bluetooth data

void relayOnOff(int relay){
 switch(relay){
      case 1:
            digitalWrite(relay1, !digitalRead(relay1)); 
            
            delay(100);
      break;
      case 2:
            digitalWrite(relay2, !digitalRead(relay2)); 
            
            delay(100);
      break;
      case 3:
            digitalWrite(relay3, !digitalRead(relay3)); 
            
            delay(100);
      break;
      case 4:
            digitalWrite(relay4, !digitalRead(relay4));
            
            delay(100);
      break;
      default : break;      
      }  
}

 

void bluetooth_control()
{
  if(Serial.available()) {
    bluetooth_data = Serial.read();
    Serial.println(bluetooth_data);
    switch(bluetooth_data)
        {
          case 'A': digitalWrite(relay1, LOW);   break; // if 'A' received Turn on Relay1
          case 'a': digitalWrite(relay1, HIGH);  break; // if 'a' received Turn off Relay1
          case 'B': digitalWrite(relay2, LOW);   break; // if 'B' received Turn on Relay2
          case 'b': digitalWrite(relay2, HIGH);  break; // if 'b' received Turn off Relay2
          case 'C': digitalWrite(relay3, LOW);   break; // if 'C' received Turn on Relay3
          case 'c': digitalWrite(relay3, HIGH);  break; // if 'c' received Turn off Relay3
          case 'D': digitalWrite(relay4, LOW);   break; // if 'D' received Turn on Relay4
          case 'd': digitalWrite(relay4, HIGH);  break; // if 'd' received Turn off Relay4
          case 'Z': all_Switch_ON(); break;  // if 'Z' received Turn on all Relays
          case 'z': all_Switch_OFF(); break; // if 'z' received Turn off all Relays
          default : break;
        }
        delay(20);
  }
}



void all_Switch_ON(){
  digitalWrite(relay1, LOW);delay(100);
  digitalWrite(relay2, LOW); delay(100);
  digitalWrite(relay3, LOW); delay(100);
  digitalWrite(relay4, LOW); delay(100);
}

void all_Switch_OFF(){
  digitalWrite(relay1, HIGH);  delay(100);
  digitalWrite(relay2, HIGH); delay(100);
  digitalWrite(relay3, HIGH);  delay(100);
  digitalWrite(relay4, HIGH); delay(100);
}

void manual_control()
{
  if (digitalRead(Switch1) == LOW && SwitchState_1 == LOW) {
    digitalWrite(relay1, LOW);
    
    SwitchState_1 = HIGH;
  }
  if (digitalRead(Switch1) == HIGH && SwitchState_1 == HIGH) {
    digitalWrite(relay1, HIGH);
    
    SwitchState_1 = LOW;
  }
  if (digitalRead(Switch2) == LOW && SwitchState_2 == LOW) {
    digitalWrite(relay2, LOW);
    
    SwitchState_2 = HIGH;
    Serial.println("Switch-2 on");
  }
  if (digitalRead(Switch2) == HIGH && SwitchState_2 == HIGH) {
    digitalWrite(relay2, HIGH);
    
    SwitchState_2 = LOW;
    Serial.println("Switch-2 off");
  }
  if (digitalRead(Switch3) == LOW && SwitchState_3 == LOW) {
    digitalWrite(relay3, LOW);
    
    SwitchState_3 = HIGH;
    Serial.println("Switch-3 on");
  }
  if (digitalRead(Switch3) == HIGH && SwitchState_3 == HIGH) {
    digitalWrite(relay3, HIGH);
    
    SwitchState_3 = LOW;
    Serial.println("Switch-3 off");
  }
  if (digitalRead(Switch4) == LOW && SwitchState_4 == LOW) {
    digitalWrite(relay4, LOW);
    
    SwitchState_4 = HIGH;
    Serial.println("Switch-4 on");
  }
  if (digitalRead(Switch4) == HIGH && SwitchState_4 == HIGH) {
    digitalWrite(relay4, HIGH);
    
    SwitchState_4 = LOW;
    Serial.println("Switch-4 off");
  }
}  

void setup() {
  Serial.begin(9600);
  // Start the receiver

  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);
  pinMode(relay3, OUTPUT);
  pinMode(relay4, OUTPUT);

  pinMode(Switch1, INPUT_PULLUP);
  pinMode(Switch2, INPUT_PULLUP);
  pinMode(Switch3, INPUT_PULLUP);
  pinMode(Switch4, INPUT_PULLUP);

  //During Starting all Relays should TURN OFF
  digitalWrite(relay1, HIGH);
  digitalWrite(relay2, HIGH);
  digitalWrite(relay3, HIGH);
  digitalWrite(relay4, HIGH);
  
  delay(500);
 
}

void loop() {

  
  bluetooth_control();
  manual_control();
}

click here to Download  


Post a Comment

0 Comments