Introduction: Automatic Night Light(Photoresistor Based)

About: I am just an electronic hobbyist and a student. I make projects for just fun I hope you will like my projects and appreciate my work.

INTRO:

This is a small but working automatic night lamp. It will turn on if there is very less light and will turn on again after 12 hrs. I hope you will like this project and appreciate my work.

Step 1: Grab Your Components!

You will need:

1. Arduino UNO x1 (you can use ATtiny85)

2. BC547 x1 (you can use any NPN transistor with higher ratings)

3. Photoresistor x1 (or commonly known as LDR)

4. Relay x1 ( I used 12v but you can use a 5v relay )

5. Piece of prototyping PCB

6. you will need two power supplies one for Arduino and one for the relay

7. 10K Resistor x1

Step 2: Make a Breadboard Prototype

Make a breadboard prototype with the schematic provided

Step 3: Upload the Code!

Upload the code provided into your Arduino. BTW you can use attiny85 instead.




CODE:

int button;
void setup() { pinMode(A0, INPUT); pinMode(6, OUTPUT); pinMode(5, INPUT_PULLUP);

Serial.begin(9600); }

void loop() { button = digitalRead(5); int val = analogRead(A0); Serial.print(val); Serial.println("val"); if (val < 20) { digitalWrite(6, HIGH); delay(43200000); }

}

Step 4: Make a More Permanent Version!

Solder everything on a piece of prototyping PCB and you are done!

Step 5: DONE!

You just made a nice project!

I will see you at my next instructable!

leave all of your queries in the comment section