Introduction: Light Intensity Lamp W/ Arduino

In this project, I explore how to utilize the arduino to create a lamp that changes depending on the time of day. At the user's request, the lamp will change it's brightness when they quantify or reduce the resistance of the LDR -light detecting resistor-. This project was completed on tinkercad and utilizes a relay in order to outsource power into the circuit that the arduino cannot fulfill for the lightbulb. Here's what you need!


1 Relay

1 kilo-ohm resistor

1 LDR (Photoresistor)

1 Power supply

1 Arduino

1 Breadboard

1 Light Bulb

Step 1: Step 1: Set Up Your Breadboard Layout Like the Following

In order to conceive a similar look to the tutorial it is imperative to follow the breadboard layout not only for it's neatness but the efficiency.

Step 2: Step 2: Add the Relay, Wires, Power Supply, and Resistors

Please keep the power supply on the default tinkercad settings (5 volts, 5 amps of current).

Step 3: Step 3: Use the Following Code in Order to Program the Circuit to Function Based on the Resistance of the LDR

Let's give some context to the code. The arduino language is very unique and resembles the block code scratch in it's simplicity. First off, we need to declare our ports which we use to connect the terminal 5 of the relay and terminal 2 of the LDR. I personally used the ports 5 for the relay and A0 for the LDR, however, you can choose any of the analog pins for the LDR and any of the digital pins for the relay. We need to access the value that the LDR returns given different levels of light. So we apply an if statement which is "if(analogRead(A0)> 500)" then that would mean that once a certain darkness is reached the light bulb will start to turn on, becoming brighter the less light there is.