Introduction: Arduino Light Intensity Lamp
This project is to create a lamp that only turns on when it is dark. The image above is the final product and was made in TinkerCAD.
Step 1: Gather Materials
The materials needed for this project is:
2. Arduino microcontroller
3. Light bulb
5. Power source
Step 2: Circuit Wiring
These are the steps to wiring the circuit:
1. Connect the 5 volts from the Arduino to the power line of the breadboard along with the ground from the Arduino to the ground line of the breadboard.
2. Put the photoresistor into the breadboard and connected the 1st terminal to the ground line, then connect the 2nd terminal to A0 on the Arduino. Finally connect a 1000 ohms resistor to the 2nd terminal and the power line.
3. Put the relay on the breadboard and connect its 8th terminal to the ground line, then connect the 7th terminal of the relay to the 1st terminal of the light bulb. Next, connect the 5th terminal to the 5th output on the Arduino and finally connect the 1st terminal to the negative output on the power source.
4. Finally connect the positive output on the power source to the 2nd terminal of the light bulb.
Step 3: Coding
The code for this project is:
1. Start with identifying the inputs and outputs under void setup.
2. Create an if statement that determines the amount of light along with what to do under different circumstances (if light, light bulb off else if dark, light bulb on).