Introduction: Arduino Light Intensity Lamp

In This Project you will learn how to automatically turn on a lamp when its dark


What will you need:

  • TinkerCAD Software
  • LDR ( to detect the light/dark conditions)
  • Arduino microcontroller
  • Lightbulb
  • Relay (because the lightbulb takes 120 V compared to the Arduino that provides 5V)
  • A power source
  • Breadboard (optional)
  • Write the Arduino Code down

Step 1: Construct the Circuit

Make sure your circuit is matched up correctly as in the one thats shown

Step 2: LDR Sensor

As shown in the picture , the relation for the LDR sensor is linked. One end is attached to the base and the other end is linked to the VCC resistor. The LDR output signal is connected between the leg of the LDR and the leg of the Resistor.

Step 3: Relay and Lamp

Make sure everything looks as in the picture shown

Step 4: Coding

For this the coding part is fairly straight forward. The first line shows that we read the input from the analog pin A0 and print it onto the serial monitor, as you can see. Next we do conditional formatting, through which we test the A0 meaning. Whether the value of A0 is equivalent to or greater than 500, the digital pin 4 is set to LOW, and if the value is less, the pin 4 is set to HIGH. The relay 's linked to pin 4.

FYI: Copy whats shown on the code

Step 5: Result of the Tutorial

This is what your Tutorial should look like once after

Watch this video on how to operate it: