Introduction: Arduino Light Intensity Lamp - Jasdeep
In this project, we will be creating a simple circuit in which a light bulb will turn on if it is dark. However, when it is bright, then the lightbulb will turn off.
1. LDR (1)
2. Arduino microcontroller (1)
3. 120V Lightbulb (1)
4. Relay (since the lightbulb takes 120 V and the Arduino only provides 5V) (1)
5. A power source (1)
6. Breadboard (1)
7. 1 kΩ Resistor (1)
Step 1: Connect GND & 5V
The first step to creating this project is to connect the 5V and GND pins to the breadboard (as seen in the image).
Step 2: Place the Relay
Next, select and place the relay in the center of your breadboard. Also, connect terminal 8 on the relay to GND. Next, connect terminal 5 on the relay to pin 4. We must use the relay as the Arduino can only provide 5V, and the light requires 120V
Step 3: Insert the Photoresistor
Next, we must connect the Photoresistor to the circuit. This will allow the circuit to know when it is dark, and when there is light. We must connect terminal 2 of the photoresistor to A0, on the Arduino.
The photoresistor is so significant, as it determines how much light there is. It determines when the light bulb (which we will insert later) should be on/off.
Step 4: Insert the 1kΩ Resistor
In this step, we must insert the 1kΩ resistor. Terminal 1 must be connected to the resistor, and Terminal 2 must be connected to GND.
Step 5: Insert the Light Bulb
Finally, we must connect the relay to the light bulb. Terminal 1 on the relay must be connected with the negative side of the power supply, while the positive side of the power supply is connected to terminal 2 of the light bulb. To finalize the connection, we must connect terminal 1 of the light bulb to terminal 7 on the relay.
Step 6: Coding
Once we are done with the hardware, we can move to the software. We must type in the correct code in order for the project to work correctly.
How The Code Works: When the value of pin A0 is more than 500, the code changes pin number 4 to low. However, when the value is less than 500, pin number 4 is high.