3. Circuits and clock wiring
This clock uses Arduino Uno R3 microcontrollers. More information, including PCB files can be found on the official page. As this was already stated in the overview page, some hardware choices (like using two Arduinos) might seem inappropriate. This is because I did this project in order to discover Arduino, its possibilities, language, libraries, etc.
Let's first see how the shields work. These shields are circuits with a specific pinout pattern, which is designed to be directly plugged onto a specific Arduino board (here, the UNO R3), with which it shares all its pins.
Page summary3.1 ArduiNIX shield 3.1.1 Multiplexing 3.2 Wave shield 3.3 Xbee radio module 3.4 General clock wiring 3.4.1 Power supply 3.4.2 Pin use 3.4.3 Remote control
3.1 ArduiNIX shield
The ArduiNIX shield is a 4*20 multiplexed driving circuit for nixies. It controls up to four anode pins and carries two K155ID1 demultiplexing chips, which have ten outputs each. It can therefore drive up to eigth tubes. It was initially made for the IN-17, but will naturally work with every tube with similar current/voltage requirements.
Figure 3.1 — Schematic of the ArduiNIX shield. Click here to download the Eagle schematics. [PCB design credits : CC-BY-SA Bradley Lewis and Jeremy Howa]
On this schematic, the digital pins of the Arduino are located on the lower left corner (J1 and J3 boxes). The orders from the program will arrive by there. The J2 box contains the analogue pins (unused by the shield) and the JP3 box contains the power supply pins (5V, Vin and Gnd used by the shield). The CATHODE1 and CATHODE2 boxes contain the pins which are directly connected to the nixie cathodes (i.e. the digits) while the JP2 box contain the pins which are connected to the anodes, via a current-limiting resistor (see previous page).
The rightmost part provides the 180V tension required by the nixies. The current can be set with the R19 potentiometer. The middle part, with the Q1 to Q8 transistors, is concerned with the anode switching. This is controlled by the Arduino pins, which are the pins 6 to 3 on the J3 box. When one of these pins goes HIGH, it will allow the current from the supply section to go to one of the pins of JP2 though the transistors. The leftmost part show the connection between the Arduino pins and the driving chips. Each chip receives a 4-bit (4 input pins) signal from the Arduino and grounds the corresponding cathode according to a truth table (see chip datasheet, link above).
A more thorough review of the circuit can be consulted here. As far as this clock is concerned, the circuit is able to light up the six IN-18 tubes without problems, but I have noticed the Q10 component (an IRF740 MOSFET) tends to overheat, which doesn't happen in other nixie driving circuits I've used (see e.g. RLB Designs' clock).
A multiplexed design, only two tubes are lit at any moment (as there are two driving chips) : there are two nixies connected at each anode pin, and there's only one anode pin ON at any given time. When its is ON, the correct high voltage is applied to the tube's anodes while the driving chips grounds the required cathodes : these tubes both display a lit digit (not necessarily the same). The circuit remains in this state for a very short interval of time. After that, the same thing happens to the next pair of tubes : its anode pin goes ON and the driving chips ground the digits that have to be. The cycle goes on quickly enough so that the human eye can't resolve the individual time frames (persistence of vision) and all tubes seem lit all the time. The coordination of these operation is assured entirely by the Arduino program (see next page).
It will perhaps be clearer on this little GIF animation. On this example, we use only three anodes (like in this clock). The tubes connected to the anode pin 1 will respectively display 9 and 0 ; those connected to the anode pin 2 will display 2 and 5 ; and those connected to the anode pin 3 will display 8 and 1. So, if these tubes pairs are all adjacent, the number 902581 will be displayed. Note that I haven't respected the actual truth table of the chips, this is only an example.
3.2 Wave shield
The Wave shield is designed to read music files from an SD memory card and play it on speakers or headphones. The circuit comes with a library that will tell the Arduino how to perform these tasks. The library requires the SD card to be formatted in FAT-16 or FAT-32, the audio file has to be an uncompressed .wav file, with a sampling rate of maximum 22kHz, a resolution of maximum 16 bits, and must be encoded in mono pulse-code modulation (PCM). The acoustic quality of such a file isn't great, but good enough given the limited Arduino processing capabilities.
With the unmodified library and default circuit wiring, this shield will use digital pins 10 to 13 for SD card reading and digital pins 2 to 5 for the DAC (see below).
Let's have a quick overview of how it works. The music file is stored in a SD card. The Arduino will access this file though a series of pins on the SD card, via the buffers in the 74125 chip (IC4 on the schematic). In addition to the audio itself, the file has headers that contains informations such as the sampling rate and the resolution of the file, which will indicate to the program how to play the file. A digital waveform is a series of intensity levels played for a short interval of time, (it looks like stairs, in other words) and needs to be converted to smooth, natural waveforms in order to be listened to. This is the job of the digital-to-analogue (DAC) chip (the MPC4921 in this case, IC2 on the schematic) ; the Arduino sends it the (digital) though a series of pins and a proper audio waveform (analogue) emerges on the other side. Then, this signal is send to an amplifier (the TL072, IC3) though a potentiometer. The amplifier will increase the amplitude of the signal by a fixed amount, and the volume will be adjustable with potentiometer. In addition to all this, there's a series of voltage dividers for logic levels conversion as well as low-pass filters to decrease the electronic noise.
Much more details can be found on Limor's design page, which explains very clearly how the circuit works. I invite you to consult it.
3.3 Xbee radio module
Last but not least, the Wireless shield/Xbee module ensemble that allow the clock to communicate with the remote. Nothing fancy here, it's just plain old serial communication, only the data is sent wirelessly.
The Wireless shield itself is nothing more than a carrier, which connects the serial pins of the Arduino to the DOUT and DIN (data out/in) pins of the Xbee module and supplies current to it. It has also a limited programming capabilities by allowing the data coming from the USB to be poured into the Xbee, although the programming of these modules is usually done on a more complete circuit (see next page).
Xbees are a large family of radio chips manufactured by Digi. They are widely used within the Arduino community for wireless projects (but they are not open-source). When the Arduino sends data through its TX pin, the Xbee will emit carrier wave which will be modulated by the digital signal of the data. This modulated waveform will be intercepted by another Xbee, which will extract the data and gives it to the Arduino via its RX pin. These modules requires some internal programming to work, which will be discussed in the next page.
3.4 General clock wiring
This clock uses two Arduino Uno boards, each one with its shield(s), as it can be seen on the next picture.
Figure 3.3 — The clock case opened ; the dark areas on the breadboard are the connections to the nixies themselves. Clock general schematic (shields not shown) ; see text for comments.
The left one, which will be called primary board, is responsible for time and date count and modification (through inputs), alarm matching, and multiplexing. It is connected to the ArduiNix shield, which supplied the nixies with the required current and voltage. The second one, the secondary board, plays the alarm and receives the lightning order from the remote control. It is connected to an Xbee radio module and the Adafruit Wave shield. Their function will probably become clearer in the section section, which will present their source codes.
The boards communicate through two general-purpose input/output (GPIO) pins, as shown in fig 3.4. When the alarm is to be played, the primary will send a pulse to secondary, which will actually play the alarm. When the secondary receives the lightning order from the remote, it will send a pulse to the primary, which will actually lit them. This criss-cross configuration might seem unpractical, but it was necessary given the number of inputs and outputs available on an Uno (this could have been avoided using the 54-pin Arduino Mega).
3.4.1 Power supply
The primary board carries the ArduiNIX shield, which requires 9 or 12V to operate. The Arduino is supplied with 12V DC ; the board itself uses the 5V coming from the regulator while the shield accesses the 12V via the Arduino Vin pin. The second Arduino is supplied via the first : the 5V and Gnd pins of each board are connected.
3.4.2 Pin use
Figure 3.4 — All the inputs of the clock.
Digital pins 1 to 13 are used for the nixie driving and communication with the other board. The Analog pins are used (mostly) for the inputs. Here is the complete pin use for information.
|Digital pins 2...12||Used by the ArduiNIX shield for nixie driving.|
|Digital pin 1||Receive the "lightning" order from the secondary board.|
|Digital pin 13||Sends the "alarm" order to the secondary board.|
|Analogue pin 0||Mode button, switches between the displays modes listed earlier.|
|Analogue pin 1||Alarm LED, ON when the alarm is set to go, OFF if not.|
|Analogue pins 2 and 3||Setting switch, determines which pair of tubes (left, middle of right)
has to see its value modified.
|Analogue pin 4 and 5||Respectively the increase and decrease scrolls, which alter the selected value.|
This board carries the Wireless shield (connections to the Xbee radio module), through which it receives the commands from the remote, and the Wave shield, which plays the alarm music file.
|Digital pins 2...5, 10...13||Used by the Wave shield for SD card reading and music playing.|
|Digital pin 0 (RX)||Receive the "light" order from the remote control via an Xbee radio module.|
|Analog pin 0||Receives the "alarm" order from the primary, which tells him to play the music.|
|Analog pin 1||Sends the "light" order to the primary, which will turn on/off the nixies.|
3.4.3 Remote control
Outside the clock, the remote control is used to turn on/off the digits when the clock is in Sleep mode. I use this to save nixie lifetime during the night : in Sleep mode, they are lit only when this remote send a signal.
It is a very simple component : an Arduino Uno, an Xbee module, and only one button. This button grounds the A0 pin when pushed (see next page for functioning). It is powered by a common 9V wall-wart though the Arduino barrel (which is connected to the voltage regulator). It's likely that I'll build a small Attiny-based circuit in order to save the hardware on this one - the use of an Arduino is really excessive here.
It is now time to see how the clock really works. We are now done reviewing the hardware and general wiring. See next page for a presentation of the source code uploaded in each microcontrollers.