|
Build a Light Watcher
by Michael Simpson

This project can form the basis for many other
projects. It demonstrates the ultra low power sleep mode of
the Athena Chip. I originally built this project to monitor my
kitchen cabinets. When a cabinet door is left open for a
period of time a small alarm will alert you that they need to be
closed. It's more of a reminder than alarm. When
the cabinet door is closed the chip goes to sleep and eats less then
.1ua of power.
You can use this for drawers, closets, fridge or any
where there is a change from dark to light.
Components
You will need an Athena, 130ohm speaker,
Photo Cell, Battery Holder and some sort of PC board. We
used the Athena Carrier #1 board for our PCB. At the end of
the application note I list all the parts and sources.
Hookup

Schematic 1
Schematic 1 shows how everything is put together.
I will show you step by step in structiuons using the Athena Carrier
1 PCB.
Note: That the Athena Chip should be
programmed before it is inserted into this circuit as there are no
provisions to program it once built. If you want to
experiment with the circuit I recommend you breadboard it.
This way you can tweak the program for your own use.
| Step 1 You don't want to
completely build the Athena Carrier. Only the 18 pin
socket, .1uf, 10uf and 10k Resistors are installed as shown. |
 |
| Step 2 break of 2 pins
from one of the headers included with the Carrier Kit.
Solder them in the location shown.
Step 3
Insert the Photo Cell as shown and solder in place. |
 |
| Step 4 This is probably
the most difficult part of the installation. Solder the
100K resistor to the points shown in this picture. We are
connecting it between port 7 and Vss. |
 |
| Step 5 Install the speaker
as shown. Its installed between port 0 and port 6. |
 |
| Step 6 In order to use the
4 cell battery holder you will need to move the positive lead.
Remove it by lifting the small tab with the point of a razor
knife and pulling the wire. Once removed just push the
wire in to the position shown. |
 |
The battery holder has a sticky pad on the back.
Peel the backing off and stick the circuit board on as shown.

Plug the Athena Chip into the socket and connect the
modified power connector to the two pin connector you placed on the
board. Note that the black lead (negative) connects to the
outside pin.

Program
(download it here)
'Light Watcher
const speaker 6
SIGNALRES = 0
dim loncount
dim dcounter
dim beepcounter
dim x
clearall
RCSTA=0
gosub lightoff
configio 0,1,2,3,4,5,6,8,9,10,11,12,13,14
p7irq 3
loop:
onportgosub 7,lightoff,lightflash
if loncount=0 then
gosub alarm
endif
if dcounter = 100 then
goto gotobed
endif
goto loop
'-------------------------------------
gotobed:
sleep
low speaker
dcounter=0
gosub lightoff
goto loop
'------------------------------------
lightoff:
setvarb loncount,100
dcounter = dcounter + 1
beepcounter=0
return
'------------------------------------
lightflash:
loncount = loncount - 1
pause loncount * 2
dcounter=0
signal speaker,6,5 'Click
return
'------------------------------------
alarm:
if beepcounter=4 then
goto beepalarm
endif
beepcounter = beepcounter + 1
for x = 1 to beepcounter * 2
gosub beepit
next
setvarb loncount,100
return
beepalarm:
gosub beepit
onportgoto 7,beepalarmexit,beepalarm
beepalarmexit:
beepcounter = 0
setvarb loncount,100
return
'------------------------------------
beepit:
signal speaker,100,50
signal speaker,200,25
return
Parts
Easy RS232 Driver
Athena
Athena Carrier 1
Photo Cell
4 Cell Battery
Holder 100k Ohm Resistor
|