Introduction: Home Lighting Automation - Light Sensor
In this project I made an application of an arduino controlled light sensor, by building a model of house and the idea is to keep the house lit at all times by light automation and window control. When it is light outside the windows open to allow sunlight into the house and when it is dark, lights turn on and the windows shut.
This could possibly be integrated to a real life application, where a larger system could provide the necessary power to automate actual home lighting and window curtains, thus serve the same purpose of this simple project idea.
This model is only to demonstrate the application, consequently thats why I don't have windows covering all the window slots.
Why make it automated?
Serves to illustrate the advantage of making the certain processes automated, such as reducing cost due to power wastage and making it convenient for people.
This simple project is perfect for anyone getting started in Arduino, or for a school or university project.
Step 1: Circuit and Supplies
Now let's get right into the circuit. Don't worry it's really straight forward.
Above is a simplified circuit diagram I made of the connections and components used.
You can follow along and check out the components on the sample circuit I made on Tinkercad. You can even virtually simulate the circuit within Tinkercad.
1) Arduino Uno
3) LDR sensor
5) Servo motor
6) Resistors (220 ohm and 10k ohm)
7) Jumper wires
Component Connections Description:
The LED's negative (short end) is connected to the common ground and the positive (long end) is connect to digital pin 7 of the arduino in series with the 220 ohm resistor.
- LDR (Light Dependent Resistor)
One end of the LDR is connected to the common 5V, and the other end is connected to pin A0 of the arduino and there is also a 10k ohm resistor connect in series, and then connected to the common ground.
The Servo's orange wire is connected to digital pin 4 of the arduino. Red wire is connected to the common 5V. Black wire is connected to the common ground.
*Note the resistor on the right is 220 ohm and the resistor on the left is 10k ohm. Also I suggest adding multiple LEDs to achieve reasonable lighting.
Step 2: How the Sensor Works
The main component responsible for driving the whole system is the the light sensor.
The light sensor that I used is an LDR which stands for Light Dependent Resistor. It is a sensor whose resistance changes with changing light intensity falling on it. When it is dark the resistance of the sensor increases and when its light the resistance of the sensor decreases.
LDRs are made from a semiconductor material that works by the principle of photoconductivity. Photoelectrons become excited as more light falls on them thus making flow easier.
Step 3: Working of the Arduino Light Sensor System
I connected an LDR to an arduino analog input to read the value coming from the LDR, depending on the value the arduino reads the program will then set the LEDs on or off, and power the servo motor to close the window.
The arduino reads the analog values coming from the LDR in the range of (0 to 1023). By turning the lights on and off in a room, a threshold value was chosen based on the numbers appearing on the serial monitor by experimenting and determining a certain value to be between turning on and off (light and dark).
The value of the threshold can vary. You will need to find out the particular value at which the light bulb should turn on. This needs to be done after testing it empirically.
However, when I was working on the project I decided on the threshold value to be 650. If the analog value is less than 650, the arduino will turn the LEDs on and motor to close the window. If the analog value is greater than 650, then the LEDs will turn off and the motor opens the window.
Step 4: Code
Connect your arduino to your computer and upload the code, and once it has been successfully uploaded, click on the serial monitor (magnifying glass on the top right of the arduino window), make sure you select 9600 baud from the drop down menu at the bottom of the window. You should be able to see a stream of numbers arriving on the serial monitor window, these are the readings taken from the LDR sensor.
You can play around with LDR reading threshold if you like, or just use it as it is.
Step 5: Test Your Circuit
If everything is connected properly, your circuit should work as shown in the video above.
Also you should be able to see that if you place your hand over the light sensor, the numbers on the serial monitor will drop. If you shine a light on the sensor, the numbers should increase. This is a measure of the instantaneous light level detected by the sensor.
Step 6: Constructing the House Model
After making sure your circuit works well, it is now time to construct the house.
Making the house model is fairly simple, all you need is;
- Exacto knife
- Glue gun
Use the ruler to measure and mark distances on your foamboard as well as to guide your exacto knife (or utility knife) for precise cutting.
You can design the house however way you want, but here are the dimensions of my model, if you wish to follow.
The dimensions are as follows:
- Front and back: 15 x 30 cm
- Sides: 15 x 20 cm
- Floor and ceiling: 20 x 30 cm
*Note: The cut out dimensions of the door and windows is shown in the images above (units are in cm).
Once you have all the pieces cut, glue them together using a glue gun to form the model.
Step 7: Assembling
It's time to assemble everything. Place your circuit in the house model.
For the window closing/opening mechanism, cut out a piece of foamboard and stick it onto your servo.
Do not forget to place the LDR sensor outside of the house model for it to respond to change in outside light intensity.
Step 8: Conlcusion
And now you are all done! I hope you enjoyed working on this project.
Light sensors are useful devices in wide range of applications and are very common in automatic control systems. Other applications include solar tracking, security systems, street lights and they are also used in almost all cars nowadays to control interior and exterior lights.
Thank you for your time and don't forget to leave your comments.
Participated in the