Those days when I come home at night and strait into the darkness are finally over. This is a very practical device and I built it so that it is a module to my Dual Channel IR Remote Control. Because of that I ended up with a definite overkill of what is supposed to be a simple switch with a timer when I open/close my door. Anyway, it is modular+wireless and that's what I like.
You can download the project files (including the ASM source code for the PIC) at the bottom of this page by clicking on red "download" button.
Project separated into two PCBs (PSU+PIC and UI board)
This add-on consists of a few key parts:
- Dual power supply with two outputs: 8.4V for IR LEDs and 5V for everything else - Ambient light level measurement with CdS cell on A/D converter of PIC12F675 so that the lights don't turn on during the daytime (for power saving feature - we must think green) - Sharp IS471F obstacle detection sensor with two transmitting IR LEDs, plus an additional IR focus lens for longer range - Third IR LED for RC5 code transmission for "remote controller" emulation by the PIC
How does it work As I mentioned before, this is an add-on or a hack to my Dual Channel IR Remote Control (IR Remote Switch) project and after reading the description of that project it is clear that for it's operation IR remote controller is required. No problem here since we can emulate RC5 remote controller with PIC and one IR LED. With this PIC we need to send IR codes for ON and SLEEP functions on every obstacle detection so that the IR Remote Switch turns the lights ON and sets them to SLEEP - meaning that they will turn off in about 1-2 minutes. That's about all that this device does, besides measuring ambient light level and it also has a button to send 5 IR codes for programming the IR remote switch.
Setting up communication between these two IR devices After putting this whole thing together make sure that the RC5 IR LED is pointed to the IR Remote Switch's TSOP receiver. Next put IR Remote Switch to programming mode, and press the Sw1 button on this device. Now IR LED will start to send 5 IR RC5 codes that the IR Remote Switch will learn. Those codes are for channel A - ON and SLEEP.
Circuit schematics
Two pots to set In the schematics you can see two potentiometers. One is for setting the range of IR obstacle detection (VR2) and the other one is for the ambient light level (VR1). You must set this light level pot so that the device thinks it is nighttime even if/when the lights in the hallway are ON. I was lucky with this because CdS cell can recognize this variation in light level. There is also a software threshold when switching from nighttime to daytime that is 4 minutes long. This is enough time to trigger the two RC5 code sending again when the door closes, even when the lights turn on after opening the door for the first time (the IS471F sensor sends the trigger signal twice every time, once the door opens and the other time when they close - mostly quickly after opening them).
Optics for obstacle detection sensor Here we have two transmitting IR LEDs and IR focus/filter lens on the IS471F receiving sensor. This combination enables more range especially with the external more-powered supply for the IR LEDs.
Optics arrangement (note that IR LEDs are actually angled a bit - not shown in the picture)
IR optics on PCB along with the CdS cell, button, RC5 IR LED, red system LED and trim pots
The other side of the user interface PCB (IR optics and the rest)
PCB with optics and user interface mounted in the fuse-box cover located above the door
This is pointing DOWN towards the obstacle to be detected (the door)
User interface Here is the "user interface" with all gizmos sticking out of it explained.
User interface - explained (I got a little carried away while drilling the big hole)
Controller and PSU PCB The PIC microcontroller does all the hard work, it emulates remote controller by sending some custom RC5 codes, measures ambient light level and decides whether it is day or night and receives trigger-signal from the IS471F sensor. On this PCB there is a power supply unit with two voltage outputs. One is unregulated and comes directly from the bridge rectifier. It's value is around 8.4V DC and comes from 6V AC multiplied by square root of two (that's the rule when we rectify from AC to DC). We need this higher voltage to run those IR LEDs for the obstacle sensor and this way we get more power from them - hence more range. The other voltage source is regulated with LM78L05 down to 5V.
PCB with dual output power supply and PIC
Completed setup inside the fuse-box cover
Testing procedures
Now when I come home at night - the lights turn on immediately after I started opening the door AND when I leave home I don't need to turn them off because they will turn off automatically!
Drago mi je da ti se svidja projekat. Vidi, taj LM78L05 dolazi u vise pakovanja. Imas ga kao
tranzistor u TO-92 i imas ga kao integralno kolo u SO-8 pakovanju. Ja sam ovdje koristio upravo
to SO-8 pakovanje (izgleda kao SMD verzija NE555 integrala). Pogledaj ovdje:
http://users.ece.utexas.edu/~valvano/Datasheets/LM78L05.pdf
Tebi je svejedno koji ces koristiti, ja sam koristio ovaj SMD jer sam njega imao pri ruci. IP: n/a
Pozdrav, radim ovaj projekt kao zavrsni rad u skoli i nije mi jasna samo jedna stvar, u popisu
komponenti pise IC1 LM78L05, a kako mi se cini na shemi i na slikama nije ta komponenta. Koja
komponenta je koristena, hvala puno unaprijed. IP: 95.178.247.107
Hello!
It is not a good practice to use the "MOVFW var" instruction to restoring the W
register at the end of the ISR routine.
MPASM 'knows' it but always s a "MOVF var, w" instruction instead, which sets (or
clears) the Z flag, ie the previously restored STATUS will be altered.
This 'trifle' can cause from time to time inexplicable runtime errors.
Your other HEX files (eg. the IR dimmer and the 2ch IR controller) also contain this little
mistake.
Thank you for sharing these great projects. I will be happy to studying the whole ASM source
(for the others too).
Greeting
István (sorry for my poor English) IP: 89.132.205.5
Pozdrav još par pitanje
Grec koliko A,TR1 koliko A i V i dal radi an AC/DC i ovaj SW1 radi na sitem kad se pritisne
radi ponovo endati ? Sistem prekidača? IP: 93.138.113.29
Cek cek kako si iz penjata uspio prenet na plocu,ja sam uvijek radio u eagl-u i pez problema,al
za ovdje par komponenti,eagl ih nema,pa mi je tu nasto problem imaš još koju šemu osim te d
ami na email pošalješ ili program koji sadrži sve te komponente ? IP: 93.136.6.216