How to Make Sunrise and Sunset Light Switch Sensor

by Liono Maker in Circuits > Arduino

1728 Views, 1 Favorites, 0 Comments

How to Make Sunrise and Sunset Light Switch Sensor

2020-06-30 11_31_42-FRecorder.png
2020-06-30 11_29_32-FRecorder.png
2020-06-30 11_28_28-FRecorder.png
2020-07-01 06_22_53-Make_ Basic Arduino Projects - Foxit Reader.png
2020-07-01 06_24_44-Make_ Basic Arduino Projects - Foxit Reader.png
2020-07-01 06_25_15-Make_ Basic Arduino Projects - Foxit Reader.png
2020-06-30 11_31_22-FRecorder.png

Introduction:

hi,this is Liono Maker;

link to my channel:link

The Sunrise-Sunset Light circuit operates like the Smart Switch, except you don’t have to use a mini push button to start the timing function. The mini push button has instead been replaced with a light sensor called a photocell. A photocell is a variable resistor that changes its resistance based on the amount of light touching its surface. Light falling on a photocell will decrease its resistance value. No light will increase its resistance value.

Required components:

1- Resistances (10k,100,100)

2- capacitor (100uf)

3- Arduino

4- photoresistor

5- Green LED

6- Red LED

7- connecting wires

Software:

1- Tinkercad

2- Arduino IDE

2020-06-30 11_31_10-.png
2020-06-30 11_32_17-Circuit design Dazzling Waasa _ Tinkercad.png
2020-06-30 12_35_07-Dazzling Waasa - Windows Photo Viewer.png

Sunset_Sunrise Light Switch:

1- Arduino Coding:

const int lightsensorPin = 2;

const int redledPin = 12;

const int greenledPin13 = 13;

int sensorState = 0;

void setup() {

pinMode(redledPin, OUTPUT);

pinMode(greenledPin13, OUTPUT);

pinMode(lightsensorPin, INPUT);

}

void loop(){

sensorState = digitalRead(lightsensorPin);

if (sensorState == HIGH) {

digitalWrite(redledPin, HIGH);

digitalWrite(greenledPin13, LOW);

}

else {

digitalWrite(redledPin, LOW);

digitalWrite(greenledPin13, HIGH);

}

}