I am a Maker More About AR Builder »
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.
Hardware:
- ARDUINO UNO
- mini BREADBOARD
- LDR
- 10K resistor
- 9V Battery:optional
- 9V Battery clip with barrel jack:optional
- some Wires or Jumpers
- A LED
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 circuit carefully or the Arduino might burn up.
Step 3: The CodeFirst, 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 sometimes 180, and sometime other numbers, so I typed 100 in the if condition lowest of all those numbers.
Comments