Nixie Clocks for CNC Creations
CNC Creations final product

Nixie Clocks for CNC Creations


Clock Electronics Design
Fred M. Niell, III
10/25/2006
fred.niell@gmail.com
www.niell.org

[Home][Research]


Testing the timing of the tubes
Another nixie tube clock?

In August 2005, I started a nixie clock project that evolved into the 25-clock limited edition Retro Nixie Tube Desk Clock. That project was a lot of fun, and I learned a lot about making robust clocks. As usual, the NeoNixie Group at yahoo all helped out with pointers and experience for that clock project. All the clocks sold quickly (they sold at about 1 clock per day!). As a result lots of people were interested in my clocks. I got lots and lots of emails from people wanting more clocks, but I was out of tubes. I decided to wait until I had more tubes available until I made more clocks. I put the clock projects on the back burner for a while, and focused on other stuff.

Then I was contacted by Leigh Aitken at CNC Creations in Australia regarding the manufacture of 25 clocks. Leigh had just finished tweaking a CNC routing machine that was capable of making very nice clock cases, and he was looking for the clocks to fill the cases. Leigh had in mind a rather small clock with lots of features. I said I would be willing to do the work on the project because it seemed like an interesting, difficult task to fit all the stuff Leigh wanted onto a circuit board only 2” x 4”. The project was a success and now Leigh has the clocks for sale at his website in the CNC Creations Products page.

Leigh had a list of challenging requirements including the following:

4 digits, readily available side-view nixie tubes, decent size and lifetime tubes
4-hour minimum power outage backup of clock time
reversed polarity power input protection
high accuracy
high reliability
low parts count for manufacturability
9V-12VDC unregulated input
5-level software brightness setting
slot-machine effect
clock board and components excluding tubes must be 14mm x 2” x 4”


All 25 finished clocks
Hardware Design Specs

Working with Leigh, we came up with a general design plan, and selected the tubes. Leigh wanted a readily available tube in large-ish quantities (pointing to a russian surplus tube). He wanted a side-view tube with a large digit size and a correctly shaped “5” digit. It was also important that the tubes have wire-leads, to facilitate soldering. That pointed to the ИН-8-2 wire-leaded tube, which are usually easy to find in quantity on ebay. The requirement for a power-outage timekeeping ability pointed to a separate RTC-chip instead of the typical software Bresenham algorithm that I use. Due to cost and size requirements, the clock is operated with a 2x2 mux scheme. The entire clock had to fit into the footprint of the board outline; RTC, backup capacitor, HV power supply, cathode driver circuitry, anode switching circuitry, mode select and time setting buttons, input filter and DC power supply. The small physical size constraint made the entire design rather difficult. Everything on the board is surface mount except for electroltyic caps, the mosfet, and the PSU chip. The anodes are switched with PNP transistors, and the cathodes are driven by a Supertex HV5122 chip in a qfp-44 package. The PSU is controlled with a MAX771 using a very small footprint inductor. The RTC is a STMicro M41T81 I2C chip, powered by a 0.1F backup capacitor, and timing is set by a 32kHz tuningfork watch crystal from Seiko. The microcontroller for this clock is a Microchip PIC16F87. The Supertex chip wants to run on a high-voltage version of TTL, so I had to add level-shifting transistors. The PIC operates at its' own 4MHz internal RC clock with no trimming or anything. In essence, the I2C protocol is loose enough, and the rest of the clock simple enough, that I could tolerate a rather unsettlingly wide variation in clock speed on the PIC. Thus, the only thing on the board with any precise timing is the RTC chip and accompanying crystal.

Code Sample: See? PIC Assembly isn't that bad!

Software Design Specs

The software for this clock definitely ended up being the hardest part of the project. Had I chosen a different PIC, things might have been easier, but not too much. Previous clocks I've made are quite basic, with very bare-bones features. This clock needed a somewhat fancy slot-machine effect to spin the digits at pre-set times, and communicate with an RTC instead of dividing the PIC clock to make time. Unfortunately, this particular PIC doesn't have a proper I2C master module that I could access from software easily, so I ended up bit-banging my own I2C communication protocol. That way I could talk to the RTC chip and get the current time. Since the Supertex chip also had its own com protocol, I had to write that one too. Anyone looking for a rather dumb implementation of the I2C bus protocol for the PIC16F87 chip should check out the source code (further down the page). I wrote a couple of subroutines based on an early appnote from Microchip.com. The relevant ones start at memlocation 0x0300 and go until memlocation 0x0400 as declared in the source code. I say “dumb” because it doesn't check for errors or bus contention and doesn't have any error registers at all. I just assume the connection works all the time. If I drop a data packet because the slave isn't listening, this code doesn't do anything special. Since there was only 1 chip on the bus, and it was less than 1cm away, I figured I could get away with it. And it worked fine basically on the first try. The code snippet shown in the text box to the left is actually the relevant code section, showing the I2C routines.

The slot machine effect, as I have been referring to it, is actually a tube-life enhancing feature. Tubes that display a single digit for too long will actually burn that particular cathode until it becomes poisoned. The remedy is to display other characters occasionally. The clock is designed with a setting button that allows the user to define how often the digits on the clock should cycle. The cycling is what is referred to as the slot machine effect. The current time is put into some registers, and 1 is added to each digit's value, and displayed. This is repeated 10 times, at which time the tens - hours digit is back to the correct number. That digit is frozen at the correct value. 1 is still added to the ones-hours, tens-minutes, and ones-minutes digits until the ones-hours is at the correct time. That one is frozen, and the process is repeated similarly for the minutes digits. This slot-machine effect can be set to occur every minute, every 10 minutes, every hour, or every 12 hours. The effect is best shown with a movie.

Early development slot-machine effect, early_slot_machine.mov, 4s - 1.4MB .mov file
Final production slot-machine effect, slot_machine.mov, 5s - 1.51MB .mov file



PIC and RTC
Click for larger. PIC and RTC and input power supply
HVPSU
Click for larger. 180V power supply
Cathode driver, anode multiplexer
Click for larger. Cathode driver and anode multiplexers
Schematics

Here are the schematics for the clock. Page 1 has the PIC microcontroller and the RTC chip. Note that I have included 3 schottky diodes on this page. The first one is the reverse polarity power input protection diode. The second is for the charging of the backup capacitor for the RTC chip. The third one is for the ICSP socket for the PIC. I find that the ICSP is basically invaluable in the software development phase of these projects. Basically, without it, I would have to purchase a real ICE and development environment, which is no fun and very costly. With the ICSP, I just have to write code, compile, burn it on to the chip with the power off, and I'm ready to test. The entire code-to-test cycle is about 20s, so it's very easy to debug code problems.

Page 2 has the MAX771 boost mode power supply. I have used a very small 100uH inductor here, as the current draw for a 2x2 mux clock is quite small.

Page 3 has the HV5211 Supertex chip and the anode multiplexer transistors. There is a mistake on this page, which was easily fixed by populating two resisitors in a non-standard orientation. Basically, R26 should power nixie 2, not 4, and R24 should power nixie 4, not 2. It is obvious from the layout how this was fixed by just turning the two resistors 90 degrees during assembly.

Layout was done with ExpressPCB as usual. The board ended up just being 2 layers, and copper fills on both sides. There were a few ground plane islands that were fixed with simple vias to the other side. The performance of the board was quite a bit better in terms of noise than I had expected. With all the things going on on the board, I had expected lots of noise coupling. But, good attention to grounds and tracelengths helped out.

Top Layer layout
Click for larger. This is the top layer artwork.
Bottom Layer layout
Click for larger. This is the bottom layer artwork.
All layers artwork
Click for larger. This is all layers, including silkscreen.

Here's one later version of the clock source code in .asm form. The final is slightly more polished, and if anyone wants it, you can ask for it in email.

-Fred Niell

Design, text, programming copyright 10/2006 Fred Niell