Arduino Light Intensity Lamp

by NIxkNagir in Circuits > Arduino

140 Views, 0 Favorites, 0 Comments

Arduino Light Intensity Lamp

Circuits_Glorious_Esboo_Tinkercadd.png

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

Supplies

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

Construct the Circuit

Circuits_Glorious_Esboo_Tinkercad.png

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

LDR Sensor

Circuits_Glorious_Esboo_Tinkercada.png

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.

Relay and Lamp

Circuits_Glorious_Esboo_Tinkercaddd.png

Make sure everything looks as in the picture shown

Coding

Circuits_Glorious_Esboo_Tinkercads.png

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

Result of the Tutorial

Circuits_Glorious_Esboo_Tinkercadd.png

This is what your Tutorial should look like once after

Watch this video on how to operate it:

https://youtu.be/tBVq6cvgnmU