I wanted to play with electronics and home automation. This is what I came up with.
The following sequence of events is not just a dramatization. It happened yesterday.
- The UPS delivery guy delivers a package and pushes my doorbell button.
- The button rings my doorbell and switches a relay.
- The relay drives a pin high on the GBA port on the Nintendo DS.
- A homebrew app runs on the DS which reads from EEPROM every frame, effectively polling the relay state.
- The DS connects to my wireless access point, sends an HTTP request to my server, and then goes offline again.
- The HTTP request executes a CGI script which connects to a chat server I've been working on, sends a message, and then disconnects.
- The chat server stores the message and sends it to any connected clients.
- One of the clients, which was the result of an AJAX request, returns the new message to a web browser.
- Cory, in his web browser, is notified that a package has arrived.
- My front and rear doors are monitored separately, hence the two relays.
- There are two pulldown resistors on the GBA port pins. I think they're unnecessary if I cause the DS to drive them low before I start reading.
- The DS app is a trivial modification of the httpget demo.
- This isn't in fact useful, but it was fun, easy, and made almost entirely with stuff I already had.
- The DS is a neat alternative to a microcontroller, if you happen to have a spare or two lying around. It doesn't draw much power, as an ARM chip or two running with the screens off, and it has its own battery back-up.