This is a joint project I did with my wife. We got to talking one day and thought it would be neat to make our own nixie clock. Nixie tubes look awesome, but we didn’t want to spend a buttload of money to buy all the tubes and circuitry required to run them. Instead we decided on making something that had the look of a nixie clock but with cheaper parts, most of which I had on hand already. My job was to get the code and electronics working while she did all the decorating. I’ll be talking only about the electronics and software.
First off, here’s the parts list for the electronics:
The parts I used for this clock make it a fairly simple build even if you have little electronics experience. The pre-fab modules make it very easy. I opted to use the Radioshack PCB as a carrier board for easy mounting of the arduino and RTC. Without the PCB, the parts would need to be individually mounted and wired.
|Fritzing Breadboard Layout||Assembled PCB Top||Assembled PCB Bottom|
The brain of this clock is the Arduino Pro Mini 5V. The Pro does not have the built in FTDI serial chip so you also need the SparkFun FTDI Breakout to program the code to it. Another option is to use the Arduino Nano which has the FTDI built in and a Mini-USB port for easy programming. The pinout of the Nano is slightly different than the Pro, but the pin numbers match up so it’s easy to replicate on the Nano (I actually used the Nano for testing on a breadboard first). Use my Fritzing Breadboard layout above as your wiring diagram.
The display and RTC both use the I2C protocol and both have easy to use libraries available. The DS1307 RTC library comes preinstalled with the latest Arduino IDE. You need to install two libraries from Adafruit to get the display working: Adafruit GFX and Adafruit LED Backback. This guide tells you how to install additional libraries.
SparkFun’s Rotary Encoder outputs a quadrature signal. This allows us to determine if we are turning the knob left or right (increase/decrease, up/down, etc/etc). The rotary encoder also has a built in button and red/green LEDS that light up the shaft. I found a good library by PJRC that uses the arduino interrupt pins (pins 2 & 3) to give accurate counting from the rotary encoder.
When powered on, the clock first checks the RTC module to see if it has a stored time and date. If time is not available, it automatically sets the time and date to when the code was compiled. Then the clock enters time mode which, obviously, displays the time (in 12 hour format). During PM hours the dot in the lower right of the display lights up. The colon between the hours and minutes blinks (on 1/2 second, off 1/2 second).
Pressing the button on the rotary encoder turns on the knob’s green LED and enters the menu. Turning the knob in the menu allows selection of “tSet” to set the time or “brt” to set the brightness. Pressing the button selects the option. In brightness mode, turning the knob selects the brightness of the display from 1-16 and pushing the button sets it, then returns to time mode. In set mode, you first set the hours by turning the knob to increase/decrease and press the button to set. Then you set the minutes and finally set AM or PM. If you enter the menu and do not turn the knob for 5 seconds it will return to time mode.
You can get my code and the Fritzing file from my github repository. The code is still a work in progress. I would like to add more features like Date Set/Display and maybe even an alarm. I will update github as I add features.
a side note… the arduino pro mini I got was from ebay and is not an actual SparkFun version, but a cheap knock off. It works just the same, BUT I did find a very important (fixable) defect with it. The ebay board had the I2C 10K pull-up resistors soldered on the bottom of the board which would normally be great since we need those. Unfortunately they were soldered on incorrectly. I could have just re-soldered the resistors in the correct orientation, but it was just as easy to remove them and use through hole resistors.