Introduction: Arduino Light Sensor
Hi guys today I am gonna show you how to make a light sensor with Arduino.This sensor turns on a LED when there is darkness you can use this as a power backup tool when there is a power outage.This is my first instructable hope you like it.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Things You Need:
1. 1x ARDUINO UNO
2. 1x mini BREADBOARD
3. 1x LDR
4. 1x 10K resistor
5. 9V Battery:optional
6. 9V Battery clip with barrel jack:optional
7. some Wires or Jumpers
8. A LED
1.Computer with Arduino IDE
Step 2: The Circut
In the picture the LED's negative is connected to the ground of the Arduino and positive to digital pin 13 of the Arduino.The LDR's one pin is connected to 5V of the Arduino and second pin is connected to A0 of the Arduino and there is a resistor connected to the second pin of the LDR and then the resistor is connected to ground.Check your circut carefully or the Arduino might burn up.
Step 3: The Code
First upload the code then open the serial monitor of the Arduino IDE .The numbers that are displayed in the serial monitor is the amount of current the A0 pin of the Arduino is getting it depends on the light the LDR is getting if the LDR gets less light the number displayed in the serial monitor will be less if it gets enough light the numbers will be higher so switch on all the lights of your room and note the number displayed in the serial monitor if the numbers displayed every time is same then change the number 100 in the if condition of the Arduino code to the number displayed in the serial monitor.If the number displayed in the serial monitor every time is not same then change 100 to the number lowest of all the numbers displayed in the serial monitor my numbers was sometime 173 and sometime 180 and sometime other numbers so I typed 100 in the if condition lowest of all those numbers.
Step 4: Finished
Have fun with this sensor.This is my first Instructable I will try to make better instructables .Thank You.
Participated in the
Arduino All The Things! Contest