/Projects/Automatic coming/leaving home light

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!

Author (sent by): Elektronika.ba

Download counter: 4,052

Rating: (2.94, votes 3013)


Date: 02-05-2010

Lokalna verzija ove stranice: Automatsko svjetlo za hodnik


Bookmark and Share Comments (15)

comment [5]

e ako ne znas procitati komponente sa sheme onda bolje nemoj ni praviti.
IP: n/a

comment [4]

eee koje swe komponente moramn uzet.odg pozzz

comment [3]

Senzor sam narucio negdje sa interneta prije 2-3 godine (ne sjecam se tacno odakle) a socivo jos ranije iz Conrad-a.
IP: n/a

comment [2]

Dali moze da mi kazete od kade e kupen senzorot?Isto taka dali senzorot doagja zaedno so socivoto ili se posebni?
IP: n/a

comment [1]

Opa, ovo se zaista otelo kontroli. Ipak, i dalje ti projekti odisu jednostavnoscu. Tnx
IP: n/a

Comment page: <12

add comment


e-mail (will not be published)


How much is = also add letter "a" at the end of your result! Eg.: 7a

Please log-in!

You can log-in on forum link: Login page. After logging-in, return to this page and click refresh in your browser.

site friends

sponsored links