Challenge

Project 1

1. Question

Smart Home: Using NodeMCU,

Switching ON / OFF Lights based on light intensity

Switching ON / OFF Fan based on Temperature

Switching ON Fire alarm, based on smoke detection

Solution: 

NodeMCU is an open source firmware for which open source prototyping board designs are available.

In this IoT project, I have shown how to make IoT-based Smart Home Automation using Multiple NodeMCU ESP8266 network to control all the home appliances . If the internet is not available, then you can control the home appliances from manual switches. During the article, I have shown all the steps to make this smart home system.

 Program:

const int light = 5;

const int fan = 4;

const int fire = 2;

int lightbase = 25;

int lightval;

int tempbase = 16;

int tempval;

int firebase = 5;

int fireval;

 void setup()

{

      lightbase = analogRead(A0);

      tempbase = analogRead(A1);

      firebase = analogRead(A2);

      pinMode(light,OUTPUT);

      pinMode(A0, INPUT);

      pinMode(fan, OUTPUT);

      pinMode(A1, INPUT);

      pinMode(fire, OUTPUT);

      pinMode(A2, INPUT);

}

void loop()

{

      lightval = analogRead(A0);

      if(lightval < lightbase)

     {

            digitalWrite(light, HIGH)

      }

     else

     {

            digitalWrite(light, LOW)

      }

     tempval = analogRead(A0);

      if(tempval > tempbase)

     {

            digitalWrite(fan, HIGH)

      }

     else

     {

            digitalWrite(fan, LOW)

      }

     fireval = analogRead(A0);

      if(fireval > firebase)

     {

            digitalWrite(fire, HIGH)

      }

     else

     {

            digitalWrite(fire, LOW)

      }

}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.