Arduino Light Intensity Lamp

by 658433 in Circuits > Arduino

159 Views, 0 Favorites, 0 Comments

Arduino Light Intensity Lamp

Capture.PNG

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.

Gather Materials

Capture2.PNG

The materials needed for this project is:

1. Photoresistor

2. Arduino microcontroller

3. Light bulb

4. Relay

5. Power source

6. Breadboard

Circuit Wiring

Capture.PNG

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.

Coding

Capture2.PNG

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).