Christmas Intruder Alert

The Christmas Intruder Alert system is a wireless device lets parents know if their kids have been peeping in the present stash. A small egg is set up with the presents that is sensitive to light. When there is light, a remote unit will show that the space has been breached. This warning light will stay lit until it is reset by the parent.

 


It’s that simple! And now you can know when your children are trying to spoil the magic of Christmas!

One of the more difficult things about making this was fitting the entire Xbee apparatus into the egg. The egg contains the Xbee, a photocell, two AA batteries, and an on/off switch.

In this image you can see out first attempt a holding the batteries in place. The standard AA case didn’t quite fit into the egg, so we attempted to create our own smaller one. This seemed to be working, but eventually became extremely unreliable, causing power to be shut off depending on the exact position of the wire. Another solution was needed.

Using a heated knife, we cut down the plastic of the standard AA holder until it fit in the egg. The other elements fit snugly around it.

The receiver box contains the other Xbee, the arduino, a power source, two red LEDs, and a push button. When the egg senses light, the red LEDs light the “STASH BREACH” panel on the box. The lights are covered with styrofoam balls to diffuse the light.  Once the LEDs are lit, they will stay lit until the button is pressed. Although the arduino will continue to get information from the egg, it is essentially ignored until the receiver is reset.

And here’s the arduino code:

#include "ST7565.h"
<div>
<div>#include <NewSoftSerial.h></div>
<div>NewSoftSerial mySerial(2, 3);</div>
<div>int alert = 12;</div>
<div>int safe = 11;</div>
<div>void setup()   {</div>
<div>Serial.begin(9600);</div>
<div>mySerial.begin(9600);</div>
<div>pinMode(alert, OUTPUT);</div>
<div>pinMode(safe, OUTPUT);</div>
<div>pinMode(4, INPUT);</div>
<div>}</div>
<div>int analogValue;</div>
<div>void loop() {</div>
<div>// read several bytes from XBee in API mode</div>
<div>if (mySerial.available() >= 21) {</div>
<div>if (mySerial.read() == 0x7E) {</div>
<div>delay(10);</div>
<div>// read the variables that we're not using out of the buffer</div>
<div>for (int i = 0; i<18; i++) {</div>
<div>byte discard = mySerial.read();</div>
<div>}</div>
<div>int analogHigh = mySerial.read();</div>
<div>int analogLow = mySerial.read();</div>
<div>analogValue =  analogLow + (analogHigh * 256);</div>
<div>}</div>
<div>Serial.println(analogValue);</div>
<div>}</div>
<div>// if door/drawer is opened, turn on light</div>
<div>if(analogValue < 1023) {</div>
<div>digitalWrite(alert, HIGH);</div>
<div>Serial.println("show light");</div>
<div>}</div>
<div>// if button is pressed, turn off light</div>
<div>if(digitalRead(4) == HIGH) {</div>
<div>digitalWrite(alert, LOW);</div>
<div>Serial.println("resetting");</div>
<div>}</div>
<div>}</div>
</div>