Close

Component Selection

A project log for One Tube Nixie Clock

It is time to take my nixie hardware testbed from the breadboard stage to something that doesn't have wires sprouting everywhere.

paul-andrewsPaul Andrews 11/16/2017 at 04:400 Comments

MCU

Pretty early on, I had decided to try using an ESP8266 to drive all the functions of my clock designs. I had already used an ESP01 to provide network connectivity for an Arduino-based clock, and that had always seemed a bit like the tail wagging the dog. That is to say, the Arduino was a 16MHz, 32K device, while the ESP01 was a 64MHz, 1M device with built-in WiFi, yet the Arduino was doing all the work. One worry was that the ESP8266 would give priority to the WiFi functionality, which would mean that user code could be interrupted at any time to service possibly lengthy network tasks. The only way to find out was to actually try it, so I set about trying to find suitable dev boards. While I was doing that, I discovered the ESP8285 - a chip that combined the ESP8266 with 1M of on-board flash, meaning it was essentially a one-chip MCU solution.

Dev Boards

It was clear that this would be what I would aim to use, but in the meantime I needed some dev boards. I ended up with this shortlist:

And more recently:

All boards have an on-board antenna, except the ESP8285 dev board.

I bought them all, but I have several Wemos D1 mini pros that I use wherever I would normally use an Arduino. Again, in a finished PCB, I would aim to use an ESP8285 directly. Getting hold of these isn't straightforward, but you can get them on ebay.

Proof-of-Concept

Designing a board to directly use an ESP8285 (rather than one of the options presented above) is an interesting excercise, because you have to lay down tracks with specific RF properties, and pay attention to the placement of ground planes and through-vias. I had a couple of attempts at doing this, but wound up with this one on OSHPark.

USB-UART

Another important component is the USB port. If you are familiar with programming an ESP01, you'll know that you need a USB-UART board. Something like the Wemos D1 mini pro has one of these on board, so you can just plug it straight into a USB port for both power and programming. The Wemos also uses the NodeMCU mechanism to put the ESP8266 into program mode, so there is no fiddly holding down of buttons in some weird sequence.

In addition to doing the USB to serial conversion, I wanted something that could detect the power mode of the USB port it was plugged in to. i.e. I wanted to know how much power I could get out of it, before I start to try and draw more. This is more of a requirement for another clock I want to build, but I might as well use the same part everywhere. The only IC I could find was the CP2102N QFN28 part from Silicon Labs.

To prove that I could this to work, I built a USB-UART board that uses it. You can get it on OSHPark here. It breaks out the USB power detection pins, plus it has an adapter to directly plug into an ESP01 (or my own dev board). It implements the NodeMCU reset style, so there is no button pressing needed to program the ESP01. The voltage regulator can provide enough power to power the ESP01 too.

I like my experiments to be useful in their own right.

Nixie Controller

And by this, I mean the part that switches the HV under control from the MCU. I have attached a spreadsheet to the project that lists several contenders. They fall into a few groups:

I have a couple of aims here:

  1. Control at least the 10 digits, but preferably 10 digits + 2 dots. Some tubes have periods, or decimal points, or thousands separators. I would like to be able to control those too.
  2. Take up the smallest amount of board space possible
  3. Work with 3.3V control signals

That last point does not necessarily mean that their Vin has to be 3.3V. For example the 74141 needs +5V in, but the control lines will work fine at 3.3V.

At first glance, the MAX6920 is ideal. However it can sink at most 4mA. That isn't enough for some of the larger tubes like the IN-18 and the NL7037.

Then there is the HV5812. I have used others in this series from Microchip, so I know I can rely on them. However I was poking around and came across this post at tubeclockdb. The HV5812 can only sink 3.2mA! So that's out.

The MX877 is also very small, but I would need two of them and I don't know what the current sinking capability of these chips is. IXYS also have the CPC7701 chip but it is $20.

The 74141 might be next. I have a whole bunch of them, but it only has 10 outputs. I can't use two of them, because that would require either a shift register, or 8 GPIOs or more control hardware.

Then there is the option of just going discrete with the BF820 transistor, one for each cathode, plus a bunch of resistors and a shift register. At first I couldn't find a shift register with enough outputs, but I wasn't realizing that you can chain some of these together, so then I found the SN74HC595. I could also use an I/O expander such as the MCP23017. Both of these come in surface mount packages.

In the end I am going to go with the HV5523. It is a little expensive, has too many outputs and needs a level shifter. My reasoning here is that, electrically, it is exactly what is needed, plus I know that I am going to be using this in clocks with a greater number of tubes. However, I am going to need a level shifter...

SPI and Level Shifting

Ah. Ignorance is bliss. My testbed has used a variety of Microchip HV devices, which I have apparently been driving out of spec sometimes, in terms of sink current rating. What they all have in common is that they are 5V devices, and the ESP8266 is a 3.3V device, so I have been a good boy and used a level shifter. After I destroyed one (remember kiddies, always turn the device off before you start re-wiring it!), I ended up using the CD40109B, which has worked great. The datasheet for this on the TI site is clearly scanned from some print copy. I guess this has been around so long that they somehow misplaced the original electronic version? Who knows?

Anyway, not pausing to find out how SPI works electrically, I just used it and it all worked fine. Now, when I am faced with trying to find an SMD part, I started reading the datasheets for the candidate level shifters and they all start talking about how applicable it is for open drain busses, open collector busses, I2C, SPI, whether you should have pullups, etc. etc. etc. So there followed several days of trying to understand how SPI works v. I2C.

To summarize, SPI is push-pull. All the signals are either high or low, they are never Hi-Z, aka disconnected, aka floating, aka tri-state. Except for MISO (Master In, Slave Out: Used when the slave wants to send data back to the master). MISO is set to floating when the slave isn't sending data. This is important if:

  1. You have a slave that wants to send data, and...
  2. You have more than one slave.

What does a level shifter do with a floating signal? Who knows? It could float the other side, if it could figure out that it was floating in the first place.

The upshot is that some level shifters have internal pullups and some don't. We don't use MISO and we only have one slave anyway so we don't care about floating signals. So for us, a level shifter with internal pullups will be fine, and I'll leave concerns about how a level shifter might cope with floating signals for another day.

At least I think that is the case, so I am ordering both a QFN version and a SOIC version of the TXS0104. I will solder the SOIC version to a breadboard adapter and check that it works on my breadboard.

SPI and The ESP8266

While I am at it, figuring out how SPI actually works, I thought I would double check what the ESP8266 is doing with the pins I am using. This is complicated:

  1. The ESP8266 has internal pullups on all of its GPIOs except for GPIO16, which has a pulldown.
  2. Most boards add external pullup and pulldown resistors to certain pins so that the semantics of programming and serial communications actually work. So there are additional pullups on:
    1. GPIO0
    2. GPIO2
  3. And a pulldown resistor on:
    1. GPIO15

This only matters if we are going to float a line. We aren't, so we don't care. However my code does use the pins that are earmarked for SPI - i.e. the pins that the arduino SPI library for the ESP8266 expects them to be on. Namely:

In addition the HV chips use something variously called Latch Enable or Strobe and Blanking.

Discussions