Mikey's Lab

An all out assault on ignorance

Oh Sweet Nixie Goodness!

May
20

Tools Required
——————

  • Dremel
  • Soldering Iron
  • solder (leaded, lead free sucks, but do not eat it!)
  • Side Cutters
  • Multi-meter

Parts Required
———————

1 x PCB
8 x IN-12B Nixie Tubes
8 x 16K Resistor
1 x NodeMCU ESP8266 module
10 x IC Socket
10 x TPIC6B595 High voltage shift register
2 x 1000 uf Capacitor
1 x lm7805 voltage regulator
1 x Blue LED
1 x 12v to 200v high voltage module

Let’s Get Started
———————–

Lets start with the schematic of the circuit! Schematic YouTube Stats Nixie Display

If you wish to get copies of  my board made, you can find the Gerber files here: Gerber_YouTube_Nixie_Display

With nixie tubes taking around 170v DC to light, we will need a special component, enter the TPIC6B595 which we acquired from DigiKey

Once you get any custom PCB, the first thing you want to do is verify the power rails and test for any dead shorts. This is a simple process, take your multi meter and set it to continuity mode. Check between all rails and ground to verify there is no dead short. After this is complete I like to continue to test that all point that should be connected to a power rail is, and is connected to the right one.

ASSEMBLY
————–

The first part of the assembly is to connect the power to the board. I did not have a barrel jack to make this removable so I directly soldered the bare wires to the PCB. If you are doing this pay close attention to polarity! Remember the center pin is positive!

From here we are going to build out the 5v power supply, and verify we are getting a clean 5v from the circuit.

Start by soldering in the LM7805 regulator and the two filtering caps, you can also solder the LED at this point if you desire.

Okay now we use the multimeter to verify we are getting 5v out of the regulator.

When I made the board and Gerber files, I forgot to add the holes for the “nipples” of the nixie tubes, as such my next step was to use my rotary tool to drill the holes so the nixies fit.

Once all 8 holes are drilled we can proceed!

From here we proceed with the normal patter of lowest profile component to the highest, this means starting with the resistors.

Fun note since this is based around a 1950’s technology I used all through hole components.

Now we insert our IC sockets, being careful to alight pin 1, once through the boar we bend a couple of the leads to hold it in place while we inset the rest of the sockets.

After more than 200 solder joints, it is time for more components.

Here we run smack into one of the mistakes I made on this board, I used the wrong foot print for the NodeMCU I have, luckily I was able to dead bug one of the sides and it reached the pads so I could solder it, long story short lets add the NodeMCU at this point.

Now we insert and solder the Nixie tube, keep in mind, these larger pins and pads is going to take more time and heat to properly solder the joint.

Now we add wires to the input and output of the high voltage power supply and connect it to the 12V  and 170V taps on the PCB.

Now we insert the shift registers into the sockets, paying attention to pin one on the chip! If you insert it backwards, it is going to have a very bad day!

And with that done, the assembly stage is complete.

My NodeMCU came with the MicroPython firmware already burned, for yours you may need to burn this to the board. There are a lot of tutorials one how to do this and it is different for every type of ESP8266 module!

Once MicroPython is on your device, upload the two attached files to the board. I used ampy to do this, it is a great tool from adafruit.

With everything burned it is time to test!

The Code
———————–

shift.py:

from machine import Pin

class ShiftRegister:

def __init__(self, data, clk, rclk, oe, clr):

self.rclk = rclk
self.oe = oe
self.clr = clr
self.data = data
self.clk = clk
self.oe.value(0) # output enable
self.clr.value(1) # don’t reset shift regs

def clear(self):

self.clr.value(0) # clear shift regs
self.rclk.value(1) # latch data to output
self.rclk.value(0)
self.clr.value(1)

def shift(self, buf):

for i in range(10):

self.data.value(buf & (1 << i))
self.clk.value(True)
self.clk.value(False)

def latch(self):

self.rclk.value(1) # latch data to output
self.rclk.value(0)

main.py:

import usocket as _socket
import ussl as ssl
import ujson
import machine
from shift import ShiftRegister
from machine import Pin
import network
import time

data = Pin(15, Pin.OUT)
clk = Pin(14, Pin.OUT)
rclk = Pin(13, Pin.OUT)
oe = Pin(12, Pin.OUT)
clr = Pin(16, Pin.OUT)
sr = ShiftRegister(data, clk, rclk, oe, clr)
NixieNums = [0b1000000000,0b0100000000,0b0010000000,0b0001000000,0b0000100000,0b0000010000,0b0000001000,0b0000000100,0b0000000010,0b0000000001]

def do_connect():

sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print(‘connecting to network…’)
sta_if.active(True)
sta_if.connect(‘SSID’, ‘PASSWORD’)
while not sta_if.isconnected():
print(“.”, end=””)
time.sleep(1)
print(‘network config:’, sta_if.ifconfig())

def https_getYoutubeStats():

url = “https://www.googleapis.com/youtube/v3/channels?part=statistics&id=ChannelID&key=YourKey
_, _, host, path = url.split(‘/’, 3)
s = _socket.socket()
ai = _socket.getaddrinfo(host, 443)
addr = ai[0][-1]
s.connect(addr)
s = ssl.wrap_socket(s)
s.write(bytes(‘GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n’ % (path, host), ‘utf8’))
retval = s.read(2000)
s.close()
return retval

def countDigits(x):

return len(str(x))

def parseNumberToDigits(num):

num = int(num)
digits = [0,0,0,0,0,0,0,0]
numOfDigits = countDigits(num)
for i in range(0,numOfDigits):
digits[i] = int((num/10**i) % 10)
return digits

def updateNixie(number):

digits = parseNumberToDigits(number)
for i in range(len(digits)):
sr.shift(NixieNums[digits[i]])
sr.latch()

def loop():

print(“RUNNING…”);
NEXT_STATS_UPDATE = 0
NEXT_MODE_SWITCH = 0
DISP_MODE = “subs”
while True:

if NEXT_STATS_UPDATE < time.time():

YoutubeParsed = ujson.loads(https_getYoutubeStats().decode(‘utf-8’).split(“\r\n\r\n”)[1])

SUBS = YoutubeParsed[“items”][0][“statistics”][“subscriberCount”]
VIEWS = YoutubeParsed[“items”][0][“statistics”][“viewCount”]
VIDEOS = YoutubeParsed[“items”][0][“statistics”][“videoCount”]

del YoutubeParsed
NEXT_STATS_UPDATE = time.time() + 600

if NEXT_MODE_SWITCH < time.time():

if DISP_MODE==”subs”:

updateNixie(SUBS)
DISP_MODE=”views”

elif DISP_MODE==”views”:

updateNixie(VIEWS)
DISP_MODE=”videos”

elif DISP_MODE==”videos”:

updateNixie(VIDEOS)
DISP_MODE=”subs”

else:

updateNixie(SUBS)
DISP_MODE=”subs”
NEXT_MODE_SWITH = time.time() + 10

gc.collect()

def setup():

do_connect()

setup()
loop()

Uncategorized Comments Off on Oh Sweet Nixie Goodness!

Comments

Comments are closed.