top of page
Search
sianfeng18

Smart Light

Updated: Nov 28, 2020

By: ANG SIAN FENG (182020026)


A project of an automatic light. The light will light up when the surrounding light intensity is low.


INTRODUCTION

This project is designed to control the light at home using smartphones by using the internet of thing. Basically, this project can control the light to turn off or turn on through smartphones that connected to the internet which is Wi-Fi. It used ESP32 also known as Node MCU. It is a low-cost system-on-chip (SoC) series that built by Espressif Systems. The ESP32 has both Wi-Fi and Bluetooth capabilities which make it an all-rounded chip for the development of IoT projects. In this project, LDR and potentiometer also used to control the system. LDR is Light Dependant Resistor also known as Photoresistor which is used to detect the light level and change the resistance of the circuit because the component is sensitive to light. The LED will light up when the brightness of the surrounding is dim such as when cloudy weather or when dusk. A potentiometer is used to control the brightness of the LED. Hence, LDR is used to control the light to turn off or turn on while potentiometer is used to control the brightness of the light. Blynk application is used in this project to control the system using smartphones or any device that connected to Wi-Fi.


2.0 PROBLEM STATEMENT

People nowadays are too busy and sometimes when they need to leave home, they forgot to turn off the light. So, it is wasting electricity and it also may cause unwanted situation occurs such as short circuit or any else. The second problem is when people come back home late evening or night but they do not turn on the light early or set the timer to turn the light on. This situation makes the house looks dark and it may cause robbery to happen because robbers are easy to access in darker mode whenever the others do not notice them. Besides, there is a problem when people spending their time in the house watching television or movie, study and do other things in the same place. They cannot control the brightness of the light to synchronize with the activities they done.


3.0 OBJECTIVES

1. To build a system that can turn on and turn off the light using smartphone (IoT) without in the same place.

2. To build a system that can be turned on according to the surrounding situation such as cloudy or dusk.


4.0 METHODOLOGY


From the flow chart above, this project is begun by LDR to detect the brightness of the surrounding. The LDR then will change the brightness level to the electric signal which is converted by the transducer in the ESP32. The electric signal then will convert to digital reading as well to make it easier for readers to read and record. When the reading is produced, it will detect whether the value of the brightness is more than or less than 500. If the brightness value is less than 500, it means that the resistance is high and the LED will light up while if the brightness value is more than 500 which means that the resistance is low. LED will turn off when the light intensity is more than 500. The condition of checking the value of brightness will loop and continue depends on the power supply that supplies energy to LDR to detect.

In real life, this project will detect the intensity of light by putting the project whether in the house or outside the house. For the user in the house, the LDR will detect the brightness of the surrounding, if the surrounding is bright, the light will turn off while when the surrounding is dim, the light will turn on automatically to brighten up the room. If the project is situated at the outside of the house, it will be used when dusk till dawn because the brightness from dusk till dawn is darker. So, people need a light to turn in on automatically when dusk. The light will continue to turn on until sunrise and the surroundings become brighter. The light will automatically turn off if it detects that the intensity of the light is high.

4.1 SOURCE CODE (WITHOUT BLYNK APPS)


#define LDR 4 //define the pin for LDR which is 4

#define LED 2 //define the pin for LED which is 2


//setup routine that runs once when press reset

void setup() {

Serial.begin(9600); //9600 is the baudrate

pinMode(LDR,INPUT); //declare LDR as input

pinMode(LED, OUTPUT); //declare LED as output

delay(100);

}


//this is a loop routine runs over and over again

void loop() {

int LDRstatus = analogRead(LDR); //declare the LDR status

Serial.println(LDRstatus);

delay(100);

if (LDRstatus <= 400) //check condition for LDR status

{

digitalWrite(LED, HIGH); // if condition <= 400 , the LED will turn on

Serial.println("LDR is dark,LED in on"); //print

delay(100); //check condition every 1 second

}

else {

digitalWrite(LED, LOW); //if condition >=400 , the LED will turn off

Serial.println("LDR is bright,LED in off"); //print

delay(100); //check condition every 1 second

}

}





















4.2 RESULT


1) The result when the intensity is high, the LED is turned off


2) The result when the intensity is low, the LED is turned on


5.0 CONCLUSION

In conclusion, this project basically is to control the light using ESP 32 and LDR. In future, there will be more function for this project, such as to control the brightness of the light whether to make it dimmer or brighter. Besides, the cheaper and durable components will be used in next project to improve from the current project. All the components stated here is just s small prototype to the main project which is will be using the spotlight and the power supply is from the solar panel. The solar panel will trap the energy on day time then the electrical energy will be used at night when the spotlight needed power supply to on.


NOTE: I have done another smart light control with my partner in group, can click the link below :

https://freonyii0516.wixsite.com/blog/control-light-and-light-brightness

Thank you.

9 views0 comments

Recent Posts

See All

Kommentare


Post: Blog2_Post
bottom of page