The winter is coming, the days become shorter and shorter....
This time of the year is graceful for the burglars. The peoples are still at work, but the criminals can do their dark doings unmolested and to strike at late afternoon times. There are lot of different methods to protect your home - alarms, dogs..etc. They all can scary the burglars, but they are not always effective. There is another method, which could prevent unsolicited visits - you can try to cheat them, that you are at home. For that purpose a home presence simulators could be used - they are devices, which can switch on lights, music or TV sets automatically or remotely controlled and to try to convince the burglars that there is someone at home. The presented here apparatus is such device. It has light sensor and if the time becomes dark, it toggles randomly different color LED's, which lights create similar effect as working TV set at home.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: The Design
My desire was to make the device as cheap as possible. I wanted to use a microcontroller to be able to implement the whole complexity of the functionality. My first thought was to use Attiny85 - I was fascinated what this small devil can do (Here is example how powerful it can be). But unfortunately I understood, that it is not suitable for this project. I wanted to have 4 PWM channels, but the small guy has only two. I took the other cheap and small his brother - Attiny84. It has 4 PWM channels - exactly what I needed. The main idea here was to control 4 different color LED chains: RED, GREEN, BLUE and WHITE. I used also an analog input for the light sensor. The schematic of the device can be seen in the attached "pdf" files. I have attached also the "pdf" files, which can be used with the toner transfer method for the making of the PCB. You can use either dual layer PCB, what is more complicated because of the aligning of both metal layers, either single sided PCB containing only the bottom layer and to make the missing connections by wire bridges. I have designed the PCB in the way that these bridges are easy to solder.
The full part list can be extracted from the schematic. Here I will mention only some specific parts:
1 x Attiny84 - DIP package;
For the supply of the device could be used alternatively 3 different chips:
2)LM2825N - 5V
3)LM2825N - ADJ (3V-5V)
The light sensor is LDR (search in ebay : LDR). Mine has dark resistance ~50KOhm and light resistance<1KOhm.
The switch I used is like this.
I have used 4 NPN transistors from the type BC547, but each universal NPN transistor can work.
The LED's used are clear bright LED's bought in ebay.
For the power supply I have used a transformer 220V-->15V (I had one available extracted from somewhere). The PCB is done in the way that for rectification of the AC voltage 4 1N4000 diodes can be used, but I soldered directly a diode bridge rectifier assembling (ebay). Under desire the power supply circuit (the transformer and the rectifier) can be omitted and external AC/DC adapter (Vout>6V and Vout<30V) can be used. A power supply socket should be mounted in this case on the case. The positive terminal of this socket should be connected at the top plate of the capacitor C3. R14 shall be omitted.
For the microcontroller I put an IC socket - to be able to extract the chip for re-programming.
Step 2: The Hardware Is Ready....
Some pictures of the soldered PCB. Unfortunately I have deleted the PCB file when I updated my "Eagle" software - I do not have more the design data. I could try to redesign the PCB if I could find time for this. The good news - I have few PCB's remaining and under desire I can send you a piece. E-mail for contact : email@example.com
Step 3: The Software....
For the programming of the microcontroller I used the "Arduino: IDE.
How to program Attiny chips using "Arduino" can be seen here. I have attached the needed libraries. The source code is also attached. For the compiling I have used the following board configuration: Attiny84 (internal 1MHz clock) from the boards menu, what appear after proper installing of the "attiny-master" libraries. .After compiling the source code, the compiled "hex" file must be burned in the chip. The previous link show how the chip should be connected. For the burning I used USBtinyISP programmer. How to burn the "hex" file can be seen here. If yo do not have suitable programmer - you can try this. After burning the "hex" file, the fuses of the microcontroller must be set. Here you can calculate the desired fuses values. I have used the following :
The fuse burning process is described in the links above (the same for the burning of the "hex" file)
The embedded video shows the setup for burning and testing of the chip.
I want to insert some additional words about the code. There are two numbers, which are used for the thresholds for switching ON and OFF of the device. The OFF value is 20-40 units smaller then the ON value. This creates some hysteresis and in this way noise immunity.
How to define the ON value?
You should put the trimmer-potentiometer to a middle value. After that you should measure the voltage drop over the LDR at the level of light intensity, at which you want that the device start to work. The number for the switching ON of the device you can calculated in the following way
val = Vldr*1024/Vsup ; where Vsup is the supply of the chip (in our case 5 V) and Vldr is the measured voltage drop over the LDR.
It can be seen that the device has 3 modes controlled by the 3-positional slide switch:
1) "OFF" - the device is supplied, but there is not any function - the red "Power LED" is on;
2) "Active" - the device is sensing the light intensity and if it drops below the threshold - it starts to trigger the LED's modulating randomly their intensity by the use of PWM for random time periods. In this mode the red "Power LED" is on. A white LED in the right side indicates that the device is ready.
3) "Forced" - the LED's toggle independently on the light level.
To make some kind of real random numbers an analog input senses the changeable with the time potential in the interconnection point between both resistors R14 and R13. This is performed by the following command row:
The resistor R14 can be omitted and in such case this point is bridged to the supply through R13. This will not change sensible the performance.
Step 4: The Case
For the housing have used a plastic box bought from a local store. The device should have also a window, which should protect the LED's and diffuse the lights. As window I have used a transparent cap of aftershave.
Step 5: The Case Making
I cut a opening for the window using "Dremel" like tool. After that i shaped the opening by fine file.The cup I cut by a fine plywood saw. After that i sanded it to trim the sides. I used also fine sandpaper to mat the internal walls of the window. Finally I fixed the cap to the case with epoxy resin. I drilled additional holes for the supply cable, for the LDR, for the slide switch and for the reset button.
Step 6: Everything Is Ready....
Here is the ready made home presence simulator. On the pictures can be seen both lights : power and ready. On the side wall is seen the LDR sensor and the slot for the slide switch.
Before closing the case a final trimming of the ON light threshold should be done. This is performed at the desired darkness level turning slowly the trimmer-potentiometer.
The light ambiance effect, which this device creates is very similar to that, which my TV makes, but its power consumption is only few watts, which in comparison with the TV set is drastically reduction. The total price of the device can be calculated to be lower than 10 USD. If a rescued transformer is used, the most expensive in the whole design is the case.
If desired the design can be developed further - the microcontroller can be programmed to control a relay, which can switch ON/OFF a lamp for some period of time in this way increasing the assumption that the house is populated.
Thank you for the attention.
Participated in the
Participated in the
Homemade Gifts Contest
Participated in the
Make it Glow!