arduinosingh26
Published

Arduino voice control smart home

This project will help to on and off lights with our phone

IntermediateFull instructions provided2,830
Arduino voice control smart home

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
relay module
×1
Jumper wires (generic)
Jumper wires (generic)
×1
LED Light Bulb, Frosted GLS
LED Light Bulb, Frosted GLS
×1
Bulb Socket, Type B
Bulb Socket, Type B
×1

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)
Soldering Iron Tip, Blade
Soldering Iron Tip, Blade
Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Schematics

home automation

wiring

Code

home automation

C/C++
#define fan 2    
#define bulb 3
#define light 4


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(fan, OUTPUT);
  pinMode(bulb, OUTPUT);
  pinMode(light, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  if(Serial.available() == 1)
  
  {
    String val = Serial.readString();
    Serial.println(val);
    if(val == "fan on")
    {
      digitalWrite(fan, HIGH);
    }
    if(val == "fan off")
    {
      digitalWrite(fan, LOW);
    }
    if(val == "bulb on")
    {
      digitalWrite(bulb, HIGH);
    }
    if(val == "bulb off")
    {
      digitalWrite(bulb, LOW);
    }
    if(val == "light off")
    {
      digitalWrite(light, LOW);
    }
    if(val == "light on")
    {
      digitalWrite(light, HIGH);
    }
    if(val == "all on")
    {
      digitalWrite(fan, HIGH);
      digitalWrite(bulb, HIGH);
      digitalWrite(light,HIGH);
    }
    if(val == "all off")
    {
      digitalWrite(bulb, LOW);
      digitalWrite(fan, LOW);
      digitalWrite(light, LOW);
    }
  }
}

Credits

arduinosingh26
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.