Introduction: Arduino Light Intensity Lamp - Jyothir
The Arduino has many fun and interesting projects you can do at home/school, the "Light Intensity Lamp" is a fun little project you can do at your home with very minimal supplies and it is a great project for beginners. Making the Light Intensity Lamp is very fun, especially if you make it yourself, and it has lots of practical uses too so if you really play around with it you can even implement this into your house lighting to save you some money. This project controls the Lamp depending on the light if it is dark the light will turn on, and if it is bright the light will be off.
This is the tutorial that will guide you from beginning to end with an easy step of course. Let's get started!
- Light Dependent Resistor (LDR)
- Arduino microcontroller
- Standard Lightbulb
- LU-5-R Relay
- 5V Power source
- 1x 1kΩ Resistor
- 12x Wires
Step 1: Circuit Diagrams
Step 2: Light Dependent Resistor (LDR) Connection
Our first step into this project is to connect the LDR, to connect the LDR you are going to need 3x wires, 1x 1kΩ resistor, and an LDR. First, take one wire, connect one end to pin A0 on the Arduino and the other end to terminal 2 of the LDR (positive end). Then connect another wire to terminal 2 of the LDR, and connect the other end to Arduino power supply pin (5V). Now finally, connect terminal 1 of the LDR (negative end) to the Arduino ground pin using a wire. Now you have your LDR set up!!!
Step 3: Light Bulb and Relay Connection
Now we are almost done, the next step is to connect the Light Bulb using the Relay. For the people who don't know the function of a relay, it basically is an electromagnetic switch where it uses small amounts of voltage to provide higher amounts, which is exactly what we need for this project! For this connection, you are going to need a Variable Power Supply, a Lu-5-R relay, a 120V light bulb and 4x wires. First grab a wire, attach one end of it to the negative terminal of the power supply and connect the other end of it to terminal 1 of the relay. Grab another wire, attach one end of it to the positive terminal of the power supply and connect the other end to terminal 2 of the light bulb. Now from the terminal 1 of the light bulb, connect a wire to terminal 7 of the relay. Now connect terminal 5 of the relay to Arduino pin 4 using a wire. Finally, connect terminal 8 of the relay to ground and you successfully made the Light Bulb and Relay connection!!!
Step 4: Coding
Now we are all done with the circuit connections, our final step is to now actually do the coding to make this circuit function. I have attached to code for this circuit above, but let us understand what this code actually does.
First, in the setup() we initialize all our pins (A0 and 4) for our circuit we initialized pin A0 to input (receiving from the LDR) and pin 4 to output (sending voltage to relay), then the serial.begin(9600) basically tells the Arduino to get ready to exchange messages with the Serial Monitor at a data rate of 9600 bits per second.
Now in the void() we basically tell the Arduino to take input and do something based on it. So the input is received through the pin A0 (LDR connection), in this case the input is going to be dark (above 500) or bright (below 500), then using an if and else statement we tell the Arduino to send voltage through pin 4 to the relay. If the input is dark we tell it to send voltage to the relay, which turns the switch on, making the bulb on, but if the input is bright we tell the Arduino to not send voltage to the relay, making the switch off, which results in the bulb being off.
Step 5: Enjoy
Hopefully, you enjoy it, and be proud of what you achieved by your self today!!