Zappo The Robot Clock
This is Zappo The Robot Clock which I made for my 3 year old son: Cooper. Zappo is an Arduino microcontroller based, fully functioning alarm clock that plays sounds files, makes siren sounds and many other features:
This is my first large scale electronics project and my first Arduino project. It was inspired by Robotty and was going to be just a simple nightlight. The goal was to make it turn on/off with Cooper's bed time to help him know when to go to sleep and when to wake up his parents. After working through some experiments in the Make: Electronics book I decided I should take some of the random circuits I had collected on my workspace and combine them together. A 3 year old does not really need an alarm clock, but I figured if I was going to put in the effort I might as well make something that would serve a long term purpose. Cooper keeps me busy so I had very limited time to actually work on it. Ignoring studying and pondering I would estimate I put in around 70 hours total work time for the electronics and the wood working.
Technical Features:
Zappo's guts
The heart of the clock is an Arduino UNO Rev 3 running a custom sketch (GitHub). The first board, the main board, is connected directly to the UNO by ribbon cables that replicate all the pins of the Ardunio on the main board ( like a shield ). The main board contains the sound player circuit (SOMO-14D), the switch inputs, the rotary switch inputs, analog inputs for photoresister and sound file potentiometer, the real-time clock, the 7-segment display output, and outputs for controlling the other circuits via MOSFETs mounted on a secondary board.

The main board and the Arduino are mounted directly behind the 7-segment display on a rear door that allows access to the full boards and the MicroSD card with the sound files. I added the acrylic windows so the boards would be visible, but unfortunately they are mostly hidden behind a rat's nest of cables.

To play sounds I am using a SOMO-14D chip (visible on the lower left of the main board). I chose the SOMO-14D because it uses the least number of Arduino pins of any sound chip/board I could find. The chip requires 3.3V which is fed directly from the Arduino's 3.3V pin. As a result of the low voltage the chip needs amplification to drive the speaker. I used the circuit 4D Systems recommends in their sample circuits. The output of the chip is passed through a volume potentiometer and into a LM386 amplifier chip which is sourcing 9V from the Arduino VIN pin (circuit is visible on left of main board up to the blue screw block for the speaker wire).

The sound files are chosen by either the rotary switch or the file potentiometer depeding on the button pressed. The SOMO-14D reads sound files in the naming convention of "000#.ad4" so the rotary switch plays files 0001-0011. The file potentiometer is connected to an analog pin and mapped to an integer between 0012-0026. The files are stored on a 2GB MicroSD card which is accessible from the back panel so Cooper can change the sounds as he grows up.

I didn't want to have to reset the clock every time Zappo got unplugged so I decided to integrate a Real Time Clock. I used the DS1307 based board I bought off eBay (visible in lower right of main board). This clock is I2C based and only requires 2 pins on the arduino.

One of my favorite parts of Zappo has to be an old rotary switch I was given at a Maker's Faire. I have no idea what this thing was recycled out of but it includes 4 "digits" from 0-F and a fifth one that has words like: "data in", "data out", "shft out", "shft in", "off", etc. I use the "digits" to represent the alarm time in military time. Because the rotary switch can map to a digit that exceeds the range of a time digit anything greater than the range limit is mapped back to the highest value for that digit. The "text" switch I use for picking which sound file to play for the alarm ( "off" turns on the siren circuit instead of playing a file to allow custom alarm sounds ). This rotary switch is Binary-coded decimal (BCD) which means that each "digit" requires 4 pins to represent 1,2,4,8. That is a total of 20 pins required to read all 5 "digits" (the socket/resistors for the rotary switch are visible on the upper portion of the main board)

Due to the rotary switch's excessive requirements for input pins plus a large number of additional switches I quickly exceeded the number of I/O pins of the Arduino UNO ( 14 digital + 5 analog ). Rather than switch to an Arduino Mega for twice the price I decided to use bit-shift registers to increase the input/outputs. For output I used a single 74HC595 chip as described in the Arduino ShiftOut library. This gave me 8 outputs for the cost of only 3 pins of the Arduino. I used 4 daisy chained CD4021B chips as described in the Arduino ShiftIn library. This gave me 32 inputs for the cost of only 3 pins on the Arduino. (barely visible - hidden under the pile of green wires connecting the CD4021Bs to their switch sockets) In the end I used nearly all the inputs with the rotary switch, DIP switches, other switches and buttons.

For the time display I used a 7 Segment Backpack from AdaFruit Industries. This was amazingly simple! Like the real-time clock it is I2C based so it required no additional Arduino pins beyond the 2 already being utilized for the the RTC. I added a photoresister to an analog pin of the Arduino which maps to a brightness integer for the display. So as the light dims the 7 segment display dims with it.

The "siren" noisemaker is a hacked version of a 555 Police Siren circuit. It is stand-alone and the Arduino's only connection to it is power control via a MOSFET. The "frequency" potentiometer controls the resistance between the discharge pin (7) and trigger/threshold (2/6) pins of the first 555 timer. The "tone" potentiometer controls the same resistance for the second 555 chip. The "delay" potentiometer controls the resistance for a single capacitor between the first chip's output (3) pin and the control (5) pin of the second chip. The "dump" button bypasses the "delay" potentiometer forcing a quick dump of the capacitance which causes a sliding change in frequency. The circuit includes 2 fast, color-changing LEDs that backlight the frosted acrylic under the knobs. I wanted the siren to be used at anytime so the "siren" switch is a DPDT switch that switches the siren and mouth from the MOSFET controlled power directly to 9V turning them both on immediately.

Main Board
MOSFET Board
Siren Board
I am a computer programmer and I knew I would use the Arduino as a crutch, so I forced myself to learn traditional circuitry first. Several of the "head" circuits I had laying around from previous experiments so I resued them for Zappo. In addition I did not want to use up the I/O pins and processing power of the Arduino for anything I could make a stand-alone circuit. However, I still needed to allow the Arduino to control their power supply so they could be turned on/off based on clock time and for certain events. The power control is handled using 4 MOSFETs to switch 9V direct to the "head" ( on a single board ), "siren" and "mouth". The 4th MOSFET feeds 9V to four red LEDs in the body to light up the "guts".

The "head" circuits and "body" LEDS are turned off between 8PM and 8AM to allow Zappo to sleep so it doesn't bother Cooper while he is trying to sleep. The "siren" is turned on if it has been selected for the alarm sound and the alarm is active. The "mouth" is turned on whenever a sound file is played or the "siren" is activated.

The "mouth" is a simple "knight rider" LED chaser based on a 555 timer and CD4017 decade counter. The "mouth" uses edge lit acrylic to make it light up but still allow visibility to the circuit below. The LEDS are drilled into a 3/4 piece of acrylic with a "wave" pattern cut into it.

The fading LED on top of the head is Experiment 14 of Make: Electronics book that I had laying around. It is a Programmable Unijunction Transistor and a couple of capacitors.

The eyes are slow, color changing LEDs who's power is controlled by a small PIR sensor disguised as the "nose" connected to a transistor.

The "ears" are a sound-to-light circuit that I built from the schematic of a Velleman Kit I had used for another project ( cross-fading LED light show ). The circuit consists of an electret microphone disguised as the antenna on his head. The microphone is amplified through a series of transistors and eventually a transistor controlling power to 4 LEDs hidden behind ping-pong ball "ears".

The Arduino is delivered 9V from a standard 9V 1000mA wall-wart.

Mouth
Head Board
The body is made out of cherry wood finished in a clear gloss lacquer ( not polyurethane ). The neck and legs are a recycled garage door spring. The arms are some miscellaneous springs and wood I shaped to look like clamps. The gears for the eyes and nose are recycled from an old clock. The 7 segment display and circular hole below it are made with clear acrylic I recycled from a local plastics cutting company. The background for the siren is the same acrylic roughed up with sand paper for a frosted effect.
He sees you. RUN!