Lesson 1, Topic 1
In Progress

Procedure

03/07/2022

Home Automation

Components required:

  • Knewton board – 1
  • Arduino Nano Cable – 1
  • Bright LED – 1
  • Power Bank-1
  • USB to DC jack-1
  • Bluetooth HC-05 -1

Circuit Diagram:

Arrange the circuit as shown in the image

Arduino Code:

  • Copy the code and paste it in your Arduino IDE.
  • Once you paste the code in Arduino IDE, Compile the code and upload it in the Arduino Nano.
  • QR will help you learn how to download the app and connect it with the HC-05 Bluetooth module.

Code:


const int led = 2;

void setup() {
  Serial.begin(9600);
  pinMode(led, OUTPUT);
}

void loop() {
  char c = Serial.read();
  if(c == 'a'){
    digitalWrite(led, HIGH);
  }
  else if(c == 'b'){
    digitalWrite(led, LOW);
  }
  else{
      
  }
  delay(25);
}

Output:

Once the code is uploaded, we can see that the Bright LED on pin 2 turned ON and then it turned OFF while being able to switch the LED through your selected device.