The intelligent mailbox

Close up of the IR \"beam break\" circuitFor some time I have been looking to create an intelligent mailbox and security entry interface; something that has several functions, and interfaces back to a PC, which will send messages and log data. Now amongst all of this is sitting my Arduino Decimellia microprocessor, which leads me to the electronics that play with these ideas; while this may not be the perfect unit for this, it is an easy start to playing with microprocessors.

Let me start with a dream list of functions to happen at/in/near my mailbox:

  • Detect the presence of snail-mail in the mailbox: give a visual indication on the outside that I should stop and empty the mailbox, and send an alert to the network of the arrival of mail (and an alert when the mailbox is emptied).
  • Optionally count the number of deliveries of mail I have waiting, keeping count until I empty the mailbox
  • Read an RFID card to authenticate someone at the gate, and present this serial number to the network
  • Optionally read a fingerprint scan from someone at the gate, and present this as a unique serial number to the network, just like for the RFID card above
  • Read an RFID card from the vehicle in the driveway, and present this to the network
  • Detect if the gate is fully open or fully closed
  • Close the circuit to activate the gate to move (just like pressing the remote control button)
  • Detect via PIR any movement near the mailbox, and report that to the network

The next bit gets a little tricky to do with a microprocessor, so probably involves putting components in/on the mailbox, but taking the feed back to a PC for processing:

  • Have a microphone, speaker, and video camera capture the audio and video of the person, and essentially hook them up to a SIP phone that will call a SIP destination if the person is not authenticated (ie, they are a visitor pressing a traditional “doorbell”).

In theory, someone who fails authentication or presses a traditional doorbell would be connected (as in, a SIP call with the camera/mic/speaker to a call group that starts with video phones and displays in the house, and then (depending on rules such as time-of-day, etc) cascade to a 3G video cell-phone, potentially. Thus if I am home, I can see who is at the gate, and then give a response to the control system to tell the Intelligent Mailbox to throw the circuit on the gate to open it (if it is not open already), and furthermore, close the gate again.

Indeed, let’s go one better:

  • Detect the presence of an object in the path of the gate, so we know if it can be safely opened/closed
  • Detect any PIR movement inside the gate so it can send an alert to the network

I’m ignoring the “one better” bits for a “phase 2” while I concentrate on the “easier” bits for “phase 1”. So what have I got thus far:

  • An IR transmitter and receiver pair from Maplin; CH10L and CH10M
  • A pair of LEDs to visually debug if the send signal is being sent and the receive path is activating
  • A transistor, a few resistors, and voilà…

… it flashes the IR LED, reads the high values from the IR receiver and averages them a bunch of times, then goes low, reads the low values a few times and averages those, and then looks for significant deviations during the “on” cycle; a simple “beam break detection” circuit; aside from the obvious GND and +5V connections, we have one PIN of the Decimillia being used to turn the IR LED on and off, and one analogue pin used to read the IR receive circuit.

In ignoring the “count” of the mail deliveries, and just opting for “there is mail” or “there is no mail”, I can place the IR emitter no the base of the mailbox (inside, of course) and the IR receiver on the roof (inside, obviously), and any letters that are sitting in the mailbox should obscure the light path. When that happens, the Arduino does a serial write, with an API I am yet to think through, basically saying “You’ve got snail mail”.

The Arduino could live in the mailbox, and have a long, long USB or serial cable going from the mailbox, under the ground, and up the driveway (in conduit), to the house, up to the roof, and across the crawlspace to a silent low power PC (Eee box, Mini ITX, etc). Hence when the driveway comes up for replacement (its sinking all over the place, I am thinking of some heavy duty conduit runs under it (as Anand, one of my mates, has previously done). Perhaps a concrete pipe with multiple plastic conduit runs? Only needs to be around 25 metres long…

What’s next; well, I have just purchased a 555 timer and a 339 voltage comparator IC. Now, this seems geeky, even for me, but it may be possible to make the 555 and the 339 do all the logic of the timing of the flashes and the detection of the beam break, and reduce this down to just one DIGITAL pin on the Microprocessor; if the voltage is high, then the beam is broken. That reduces down the amount of code I will have loaded into the Arduino, which is a bit limited anyway, especially if I want to cram a whole bunch of other functions (see above) on the other pins.

And through all this, while I (and my family) have been having a terrible cold, all over Christmas. Oh well, only human.