Email Clock - Version 2
|For the second version of the email clock, I wanted to simplify the networking aspect of it. I also wanted to make a prettier clock. So I changed technologies. For the controller, I used an Arduino module, which is an open source microcontroller module based on Atmel's ATmega8 microcontroller. For the net connection, I used a Lantronix Xport serial-to-ethernet module. And for the mail client, I wrote a perl script.
The wiring between the Arduino module and the Xport was simple: Arduino serial receive connects to the Xport's serial send, and vice versa. I also connected LEDs to some of the Arduino pins to use as indicators for debugging. You can see in the code below when I was using LEDs to figure things out.
|To connect the Xport to the Arduino module, I designed an Ardduino shield printed circuit board (PCB). I designed it in Eagle, a great shareware schematic and board layout program. Cadsoft have a great tutorial on the site, if you've never made a PCB. Here's the board schematic:
And here's a picture of the board layout:
And here's a link to the Eagle files. To get the board manufactured, I recommend sending the gerber files to Advanced Circuits or Sparkfun. Advanced Circuits is a bit more expensive, but they've got a good circuit checking service online, FreeDFM. Sparkfun's a bit slower, but their rates are lower, and they're great people.
Here's a parts list for the board:
|The system works like this: The Arduino opens a TCP socket to port 80 on the CGI server every few seconds. It makes a HTTP call for the CGI script. The script checks all my mail accounts, and returns the number of kilobytes. The clock then ticks forward one tick for every kilobyte of mail.|
|Here's the Arduino code for the microcontroller, and here's the CGI script.|