Introduction: Mahogany & Brass Nixie Clock (with IR and UART Control)
update: My contest entry was accepted. If you like the clock, I will appreciate if you vote for it!
In this instructable I'll show you the process of making an awesome, steampunk-alike nixie clock.
There are lots of nixie projects on the Web, but most of them focus mainly on the hardware/software part. Some of them are closed in not-so-nice plastic casing (or don't have any). And these beautiful nixies deserve a proper casing, don't you think? :) I decided to show you complete worklog of my clock, from designing, through programming and building the casing, to the final result.
I used IN-12 nixie tubes because they look cute ^^, and are rather cheap. The clock is powered by 12V DC power supply and it contains battery powered RTC, which makes it still counting time even if no power is supplied. It can be controlled by a dedicated IR remote controller. It has two small indicating bulbs at front (for interfacing with user), and a light sensor, because nixies' brightness can be controlled both manually and automatically. I also used UART to control the clock with a dedicated PC application written in Visual C#. And I wrote another app as a bootloader.
The casing was made with FR4 laminate and mahogany veneer, finished with brass labels etched in ferric chloride. As you can see, it's a pretty complex project, but I'll try to describe every process clearly. Okay, enough talking, let's start!
P.S. If you like this project, perhaps you may like some of my others. Check it out at https://www.youtube.com/user/mopsiok . Thanks!
Step 1: Concept & Design
I wanted nixies to be partially hidden inside the casing, because I found them too deep. I also designed two small bulbs on the front side. First one indicates whether the alarm is active, and the second one - when user is currently setting some values by remote controller. The bottom is mounted on screws and can be removed in case of rapair or something... There is also a 2 pin header mounted on side wall, which is used to connect UART. It can be used to control the clock with the PC application, or even upgrade software with a dedicated bootloader. Typical UART bootloaders use 3 lines (TX, RX and GND) - I couldn't use hardware TX line, because it was already used, so the bootloader requires a special adapter (it makes RX line to act as half-duplex UART). I will describe it later.
I used mahogany, because it nicely fits with nixie light. I decided to use regular FR4 laminate as side walls and join it with solder. It's easy to work with, but still durable, which is great. Then I could glue mahogany veneer to it.
I designed the clock in Blender (yep, not a great CAD tool :D), you can download it and look around. Most of the dimensions are critical, mainly distances between casing laminate and PCBs, so when you will be building the clock, pay close attention to that.
Step 2: Clock Circuit
About the circuit, callibrating information
The clock is controlled with ATmega168P using internal RC oscillator. It is set to 8MHz because nixies' anodes are multiplexed. For this, I used typical HV switching circuits (SMBTA42 and PMBTA92 on the schematics). Cathodes are controlled by 4028 (BCD to binary decoder) which drives SMBTA42 transistors. IN-12 nixies require about 150V to work properly - I'm using typical application of MC34063 switching regulator. While IRFR220N switches, load is supplied with high voltage which can be adjusted (150-170V) using HVC0 and HVC1 inputs. When R41 and R42 are still unsoldered, power the circuit and use R34 potentiometer to calibrate the regulator (it should give about 164V).
The RTC circuit is a typical application of PCF8563. It uses a 3V CRC2032 battery, which will still power the RTC in case of power supply accident. The C4 is used to calibrate the counter and you need to choose its value experimentally. That is because it depends on many things, but you can start with 44pF. Before you calibrate the circuit, you need to solder copper shieldings (the big one for switching regulator, and the small plates under the board). When you finish, you should also solder the shielding for RTC circuit. I needed to desolder it (and didn't solder it back), which makes some troubles now: +-4s a day is not a best result. It gives 24 minutes a year, and it's far too much. I need to solder it back someday ;).
Anyway, there is also a small PCB mounted to the front panel of the casing. It contains a phototransistor which is used to automatically lower the voltage at night. Furthermore, nixies' brightness can be adjusted with remote controller. You may need to change R29 value (default 270k) if you use other phototransistor. Apart from that, there are 2 small bulbs which are described earlier. They are controlled with PWM, so their brighness changes with nixies voltage. There is also a TSOP2236 - it is used to receive IR remote controller signal. It works best with 36kHz carrier, but it should work good enough with 34-38kHz. You should solder all this parts thoroughly, otherwise it could be a problem with fitting it with laminate and veneer.
Important note about UART socket
On one of the side walls, there is a UART socket. It has a GND line and RX line, because TX line is used to switch the anodes (the clock itself doesn't send any data, so it's ok). It was a problem, because I needed to implement an UART bootloader to easily upgrade the firmware; and the bootloader needs to communicate in both ways. I used a solution presented here (you can read about the principle of operation): http://nerdralph.blogspot.ca/2014/01/avr-half-dup... So, in a normal operation, I can use my UART socket as a regular RX signal, but when I want to run a bootloader, I just connect a small PCB and then it can be used as a standard TX/RX UART. The catch is, when I need to send some data from AVR, I have to reconfigure the pin as a GPIO, then programmatically send data, and again configure the pin for RX interrupt. But I'll describe it in another step.
Here you can download all necessary files:
- clock_Kicad.rar: schematics and PCB in KiCad (version 2013-07-07)
- clock_partlist.lst: partlist generated for this project
- fusebits.png - program these values before sending the HEX file
- complete.hex - both application and bootloader code, ready to use solution
- application.hex - just application code
- bootloader.hex - you can program bootloader only and then send application.hex via UART
Step 3: The Casing - Main Base
As I wrote in intro, I used laminate as a main base of the casing. You can download the necessary drawing below. When printing, make sure you don't scale it (or set scale to 100%). First of all, you need to transfer it on the copper, as if it was a standard PCB. It is very helpful when it comes to cutting and sanding.
To mount the PCBs to laminate, I used M2 screws and nuts (nuts can be soldered to the copper). Make sure nuts are soldered exactly where they should be, because it will affect the final result. When soldering the laminate, try to set the sides as perpendicular as possible. You can use additional boards and distance spacers, as shown on the pictures.
Step 4: Etching Labels
Here comes the time for brass labels. I decided to etch them with ferric chloride (FeCl3) instead of B327, because it worked better with the brass plates I had. I cleaned the plate with sandpaper and acetone, then I thermo-transfered the printout (see attachments below). I covered any unused surfaces with adhesive tape to prevent them from etching. As you can see on the pictures, after etching in FeCl3, there were some pitting. That's why you should etch at least two pieces of every label. You just pick this one which looks better.
After etching, I sanded the labels one more time and painted with black marker. When it dried, I removed any excess with sandpaper (~400-600). Then I started to shape the labels. I used a Dremel-like tool to do that. After that, I finished it with spray lacquer - it has to be applied in several very thin layers. When it dries, black paint is kind of dissolving, so you can't move the labels. Otherwise the paint will pour out of etched pattern.
Step 5: Finishing the Casing
Veneer and labels
Magohany mounting process was difficult, so I decided to finish it before I glue it to the laminate. I cut 5 pieces, sanded it with 600 sandpaper and finished with the same spray lacquer. I printed drawings (see files below) and attached them to the other side of the verneer pieces. When I cut it to expected size, I used super glue to connect it with the laminate base.
Upper and bottom walls (made of wood)
I have no skill in woodworking so I've choosen balsa, because it's very easy to work with. I needed to combine two pieces since they were too narrow. At the end I sanded it and also decided to soften the edges.
I made many tests with mahogany rustic stain. At first, I tried to put it on some piece of balsa, wait until it dry, and then finish it with acrylic lacquer. The result was... not very nice :). Then I mixed stain with lacquer and applied two layers of it. And that was a lot better! Eventually, I ended up with stain and lacquer in 1:1 volume ratio, applied three times (1.5-2h intervals).
When the wood was dry, I glued the upper wall to the casing. Then I drilled four holes in the bottom wall (for mounting screws). At the end I added anti-slip pads and glued four brass corners to hide the junctions.
Step 6: Remote Controller
Remote controller is using ATtiny13 with internal RC oscillator set to 1.2MHz. It is powered from onboard CR2032 battery. In normal operation AVR is in powerdown mode - the battery should last for several years. Any switch on the keyboard wakes the AVR up and then it starts to transmitting the corresponding keycode in slightly modified SIRC protocol. There is also a red LED which is blinking when transmitting.
The controller can be used to:
- set date, time and alarm
- change display between date, time and alarm (default is time)
- run a timer
- change display brightness (both nixies and indicating bulbs)
- turn off the alarm (or set a nap)
- turn on/off the display
Download the HEX file attached below. Before using, make sure you changed fusebits to default values (lFuse: 0x6A; hFuse: 0xFF).
The casing is made in the same way as clock. The only difference is that instead of mahogany I used american cherry veneer. Buttons' tips are stamped from 0.2mm brass sheet and polished. Just follow the pictures :).
Step 7: PC Control Panel (Visual C#)
You can control the clock using a dedicated PC application. It is writen in Visual C#, so you need .NET Framework (4.0 or later) to use it. The file attached below contains both project directory and final, ready to run application.
Configuring the application
First, turn on the clock and connect UART lines using the external PCB described earlier. You can connect GND and RXD lines only (without the PCB), but you won't be able to use bootloader.
Then run the app - on first run you need to change some settings. Set the proper port name (click refresh button if needed) and leave the baud rate on 10k - it is preprogrammed in the clock's firmware. Now choose the bootloader's path by clicking the Open button, and then click OK to save the settings.
Using the application
First, you need to open the port - to do that, click the Connect button. Now you can enter the Set window, which allows you to set the clock's date, time and alarm. You can also temporarily set every nixie's digit, e.g. for presentation. It will return to time display after ~20s.
In main window, there's a special icon named de-poisoning. It scrolls over each digit of each lamp - that's called cathode depoisoning and it is used to extend nixies' life. The clock does depoisoning automatically once an hour, but I thought this effect is quite nice and decided to run it on demand :).
When you want to use a bootloader, you can click Run bootloader button which is placed in settings window. It will run the program and fill all necessary info for you.
Step 8: Half-duplex UART Bootloader (Visual C#)
For this project I wrote a second application, also in Visual C#. It is used to upgrade the firmware of the clock without opening it. To use this app, you need to connect the external PCB to make the RX line half-duplex. The file attached below contains both project directory and final, ready to run application.
Bootloader is program which is executed before the main program starts. That means, if you want to upgrade the software, you need to restart your device and run the application before timeout occurs. This can be difficult, and that's why you should use "software reset" option. When the clock receives a special command, it restarts itself (and run the bootloader). You need to set the correct command (for the clock it is \x00060402\x0A) and baudrate (10000), otherwise the device won't restart.
If you don't want to use software reset, you can still use the app, but you have to restart the device manually before clicking "read from device", "info" and "send" buttons.
Using the application
Before using the application, you need to choose a correct port name (click refresh button if necessary). All other settings should be loaded automatically when you run the bootloader from the control panel (by clicking Run bootloader button).
First of all, to check if everything works fine, click the Info button. It will restart the clock and show you all info about its bootloader. Then, select the HEX file by clicking "Flash (.hex)" button, and click Send to write the new firmware to the clock. You will see a progress bar below - when it comes to end, the clock will restart with new firmware.
Upgrading EEPROM from the app is not supported in this version. I just made the button and textbox for future use.
Step 9: Final Thoughts
It was a nice project! I spent about 7 months to make it, but I think the final result is good :). Total cost was about $35, but I "wasted" a lot more by prototyping etc.
If I were to change something, I would add a small WiFi module and use it to sync with an NTP server. I mean... look at that! Isn't she a beauty? :D It works via UART, so maybe I'll use it someday...
Feel free to ask, I'll be glad to answer your questions. And one last thing: if you like this clock, maybe you would be interested in my other projects. Check out my Youtube channel: https://www.youtube.com/user/mopsiok . See you!