• Published on | Dec 16, 2008 | by FozzTexx

Seven's Candy Cam: How it works

I'll be posting this in multiple parts because there's so much going on. If you haven't seen it, check out Seven's Candy Cam

This all started out because I was ordering some electronic stuff and decided to order a couple of Arduino boards to see how they worked and what they could do. After I got them I was amazed with how simple they were to setup and started doing some searches of things other people had done with them. I stumbled onto a site where a guy had used a servo to ring a bell whenever someone visited his site. I thought that was cool and I might do something similar with Wishzilla.

A couple of days later I was thinking about it more and I had the idea that maybe it would be fun if I setup a web cam and I rigged up something so whenever the bell rang a treat or something would drop for Seven. And why not throw a webcam on it?

Over the last week this has evolved from bells and a webcam to watch the dog eat into a crazy mess of interactive toys, all controllable by visitors to the site.

Currently the system is using 1 Windoze laptop, 1 Ubuntu laptop, an additional 15" monitor, a LEGO RCX, an Arduino, an Elmo Live! toy, a D.J. Mixin' Santa decoration, a LEGO 9volt train, X10 for the Christmas lights, a little USB TV capture device, an automatic dog feeder, a 4 channel mixer from Radio Shack, and my ancient Sony Video 8 Pro camera. Why do I feel like I left something out?

The web server

An important consideration was making sure that the site would be unaffected by any glitches with my rig at home. This meant I didn't want the processes trying to connect to some IP at home or dependent on a daemon running locally all the time. I wanted to make it as simple as possible so I didn't have to keep coming back and checking which piece of software had crashed.

What I decided to do was make a FIFO on the web server which the Wishzilla software would attempt to open in non-blocking mode and then write a line to. Doing it this way meant it didn't have to open any sockets or have an IP address hardcoded into it that might change. The software running at home does an ssh into the Wishzilla server and does the reading from the FIFO. Very simple.

To be continued...

In the coming parts I'll show how the components are wired up and what software is running on them.

Join The Discussion