Complete Divergence Meter

I’ve been building a Divergence Meter, as featured in Steins;Gate, using Tom Titor’s excellent design.

Perfboard

If you’ve read any of my other posts about this project, you’ll know that I hit some obstacles. First I blew up the HV power supply and the PIC chip, then the perfboard I had, had logos printed on both sides. Well I replaced both the power supply and the PIC chip. As for the perfboard, I couldn’t find any that was the right size, the right color and logo-free. In the end I followed a suggestion and spray-painted it. Here’s a before and after shot:

Before and after spray painting

That particular piece wasn’t cut very well, so I used it for practice. To cut the perfboard, I used a technique recommended by a carpenter friend. If you use a saw it is hard to get a clean edge, so I used a router instead. Here is the setup I used:

Router Jig

Case

And that is pretty much where I stopped for a while – I still hadn’t figured out how I was going to build the case. I played around with prototypes made out styrene sheet, and while I was doing that I realized that the hex standoffs used to hold the top to the case screwed easily into the plastruct rod I was using to brace the corners – it has a round hollow core:

Plastruct rod test 1

And then it suddenly occurred to me that I could drill pilot holes in the rod, and use self-tapping screws to fix the sides of the case to the rod. I tested it on some aluminum sheet I had, and it worked really well. So now all I had to do was CAD it up and get it made by Big Blue Saw. Here is a shot of the end result:

Case from the back
Drilled plastruct and some of the case parts.

I had also decided that the PCBs inside the case needed some good support, so I used 11/16″ plastic standoffs to mount the main board to the case. It needs to be this length to accommodate a 9V battery. By my calculations that meant I also had to increase the height of the case slightly, so I did.

Construction

Now I knew everything would go together I could get on with the rest of the construction. Here are a few progress shots:

Gluing the dummy components
Soldering in the tubes

For some extra veracity, I used a busted 7441 chip and a busted К155ИД1 chip for the dummy ICs:

ITT 7441 dummy IC
К155ИД1 dummy IC

I discovered that the gloopy super glue I was using (aka CA Adhesive), really didn’t want to cure. Tom had mentioned that it would be useful to have some accelerant, and I guess it is. Googling CA glue accelerator shows it is just a mild alkaline solution that neutralizes the acid used in the glue, to slow down curing. I found this article about how to make your own, so I did and it worked great.

Software

The programmer in me couldn’t leave the code alone, so I modified it a little. There are two main changes:

  1. The wordline modes will automatically go on to the next wordline after about 9s, unless a button is pressed.
  2. In clock mode, it will display a random world line twice an hour.

I uploaded the source and a hex file to GitHub.

Finished Clock

Finally, here’s a shot of the finished clock:

World Line Display

Divergence Meter Setbacks

Firstly, I only ordered one push-button instead of two. Annoying, but not a big deal.

Secondly, the perfboard had logos printed all over it. No chemical would get them off. Sanding didn’t get them off. When I used a dremel, I discovered the pigment went deep into the substrate. I figured that maybe this was just the particular supplier that DigiKey was using, so I ordered some straight from the public BOM on Mouser. It is exactly the same. So I am down $34 on perfboard I can’t use.

Perfboard
Perfboard + Logos

I have ordered yet another perfboard for $23 from DigiKey from a different manufacturer. Hopefully this one won’t be covered in logos. So $57 on perfboard alone. So far!

Thirdly, I missed that the boards on OSH Park need an additional diode near the battery switch. Fortunately I had a suitable Schottky diode lying around.

Fourthly, when I was adjusting the HV it mysteriously stopped working, and the PIC started to get hot. I guess I shorted the HV to the PIC, though I don’t recall doing so. So I am down the HV and the PIC. The HV part is $14. The shipping is $10. So I am now down an extra $60 with little to show for it. Plus I had to unsolder the HV. Fun times!

Since there is little else I can do at this point, I built a prototype case with the styrene sheet. This is so I can test the positioning of the openings on the case before I get some metal ones fabbed.

Anyway, here are the boards, with a gaping hole where the power supply should be 🙁

Divergence Meter

Divergence Meter Kickoff

Its time to actually start building this divergence meter:

Divergence Meter Kickoff

I ordered the parts from Digikey, which have arrived. I chose to program the PIC16F628A myself, by which I mean upload the hex file from Tom Titor. Partly this is because I figure I might modify the program at some point. So I bought a cheap pickit 3 copy off ebay.

I’ve also been re-familiarizing myself with SolidEdge 2D as I would like to get the case pieces fabricated, so I will need an accurate CAD model, and I have used SolidEdge in previous projects.

In addition I have been mulling over how to actually build the case. Ideally I would like to make my own posts with a square cross-section and tap them for screws – I really don’t like the idea of gluing things together – however that is way beyond me at the moment. I also toyed with the idea of using styrene sheets  that are used in modelling. So in the end I bought samples of various materials and practiced gluing things together:

Practice pieces for the case

The top sheet is aluminum. The bottom sheet is steel. The left hand blob of glue is JB Kwik, the right hand blob is JB Putty. I glued some aluminum rod to the sheets with an overhang so I could try and pull them off. I roughed up everything with a dremel tool before hand and cleaned it all up with Isopropyl alcohol. In the end I was surprised how strong the bond made by the JB Kwik was, so I am reasonably confident that I can glue standoffs to cut sheets to make the case.

I also glued square rod to the styrene sheets. The bond here was actually pretty good, but they peeled off if I flexed the sheet. When I examined the styrene, it had been softened by the cement. I will probably use the styrene sheets to make some prototypes from my drawings to check that I got all the measurements right.

Now I need to start some soldering.

Controlling an ITS1A Thyratron

In an earlier post, I explored how to light up an ITS1A Thyratron – this is an old seven-segment display device from the former USSR:

Glowing ITS1A

It requires some exotic voltages: -250V, +40V, +100V and logic-level signals for segment control. A high logic level can be anything between +0.4V and +4V, so a +3.3V device is perfect. The other voltages can be obtained from a 50V boost converter driven with a +5V input. I used Cockroft-Walton ladders to get +100V and -250V and a voltage divider to get the 40V. These are the pins on the tube:

Physical pin descriptions of the ITS1A

This is a description of the pins:

ITS1A pin descriptions

What I didn’t manage to do at the time was figure out how to select which segments get displayed. In my tests, they all lit up. Basically, if the segments are pulled to zero volts, they will be on. If the are raised above +0.4V, they will be off. But only if the other pins are held at the right voltages in the right sequence. Later on I found that I could set the segment voltages, then pull anode one and anode two low for a short period, then high again, then the displayed segments would latch on according to their voltages at the time the anodes were pulled low. The segments will stay that way, regardless of what is done to them, until the anodes are briefly pulled low again.

I suspected that grid two also played a role here, but I was unable to figure it out. Then I came across this archive, which had a circuit diagram and some PIC assembler. In that circuit, the +40V is obtained with a zener which is just connected to ground, with no pull up to keep the voltage at the zener voltage.

(NOTE: This paragraph has been edited from its original). The function of the second grid was revealed looking at the assembler source code. Basically, to set a display you start with the anodes at their set voltages and the second grid above 0.4 volts. Then you briefly pull the anodes to 0V. Then you set the voltages of the segments, then you briefly pull the second grid to 0V (note the line for the second grid below is incorrect, it should be inverted):

Signal sequence for setting the segments of an ITS1A

When the 2nd anode is at 100V, current also flows into the 1st anode (the 40V one) and the zener clamps the voltage to 40V. When the 2nd anode is pulled to 0V, current direction of the 1st anode is reversed, and so it is pulled to 0V too. This is what the datasheet says:

The current of the grids and the 1st anode in the non-conducting state has a positive direction, in the conducting state the direction of the current is changed.

So here is a circuit diagram:

Multiplexed operation of two ITS1A tubes

The tubes are multiplexed by setting the value of the 2nd grid individually for each tube. If the second grid on a specific tube is not pulled above +0.4V, it’s display won’t change. Note that the reset pulse only has to happen once, then you can set the display of all the tubes, one at a time by setting the segment voltages and toggling the 2nd grid on the tube(s) you want to change. Repeat the sequence the next time the display changes.

At first I was slightly annoyed that I had ITS1A tubes, which have a maximum logic level of +4.0V, v. The ITS1B tube has a maximum logic level of +5V. But it is actually a good match for modern controllers, with a +3.3V logic level. I used the trusty Wemos D1 mini Pro to test out the circuit above.

Divergence Meter

Divergence Meter

I recently acquired some PCBs for building a Divergence Meter as described on Tom Titor’s site. I’ve been meaning to build one of these for a long time.

I struggled for quite a while trying to figure out how to build the case. I didn’t like the idea of using glue as a structural element, and I thought it ought to be possible to source something other than hex standoffs to form the corner posts. I did manage to find a source for square standoffs – though not in small quantities, but that still left the problem of using glue. Ideally I wanted to use actual screws, but that would have meant tapping some small metal rods. I was getting nowhere, so I went to visit my local model shop and chatted with them about various options. I came away with some styrene sheet, some square plastruct rod and some plastruct angle. I figured I could prototype a case and see if anything came to me. I also bought some steel sheet and some aluminum sheet to see how good the glue approach was.

As I messed around with prototypes, I discovered that #4 screws (such as the screw part of the hex standoffs used on the perfboard) screw into the plastruct rod perfectly, so I went to my local hardware store and picked up the smallest self-tapping screws they had – some #2 – 1/4″ screws, drilled pilot holes in the plastruct rod and tried fixing them to some of the metal sheet I had bought. It gripped really well, so I decided that I would CAD up some parts for a case and get them made at Big Blue Saw.

I also decided that I would support the PCBs on plastic hex standoffs, they needed to be well fixed to the case. 11/16″ standoffs work for the main board, with 10mm standoffs between the main board and the display board. For the screws that screw into the bottom of the plastruct rod, I used #4-40X1/8. I have node idea where I bought them – I can’t find them in my ebay, DigiKey or Mouser orders. They need to be short to clear the self-tapping screws.

I have just finished putting together a case using the parts made by Big Blue Saw, and it works great. I had 10 sets made as each set is then a lot cheaper, so I have many left over I currently have two left that I would be willing to sell for $59 + shipping.

Divergence Meter case design

The following pictures show the case in various stages of construction. This first one shows the plastruct rods and angles. The pilot holes in the rods are 1/16″, the holes in the angle are 7/64″, and not shown – but the holes for the hex standoffs in the perfboard are at least 1/8″.

Drilled plastruct and some of the case parts.

Big Blue Saw offer several finishes. The one below is raw. The edges are very rough, and there are marks left over from the water cutter, so I ordered the rest in basic finish instead.

All the case parts in raw finish
Corner detail, showing how it all fits together

In the photograph below, I have yet to paint the plastruct angle – I was just checking that everything went together.

Front view
Back view
Bottom view

The stencil that Tom provides is slightly different for this case. The holes for the hex standoffs are back where they were with his build #1. In the PDF below I also show cutouts for the tubes with a diameter of 14mm. This is a standard size for things like Forstner bits and it gives you some room for error in drilling these holes!

Perfboard Stencil

Trials and Tribulations

This was supposed to be a quick build of one of my one-tube-clocks, with a few tweaks to try and improve some of the features. This is what an earlier version looked like:

All my other builds had taken around 3 hours, and the worst that went wrong was a few dry joints. This build was very different:

  1. I had three attempts at getting the solder paste applied – that is three complete wipes and restarts.  It kept smudging, or leaking onto adjacent pads. This was an omen.
  2. Finally I had something I could work with, but I had to touch up some teeny tiny pads on the CP2102N footprint – a QFN28. They were right next to a trace I had cut. I got solder-paste in the cut. I had to get it out, otherwise it would short the two halves of the trace back together. Cue some very fiddly cleaning using a magnifier.
  3. Finally got everything in place, and transferred the board to my hotplate. It was almost cooked and I realized I had forgotten a component, so I had to take it off and let it cool and then add the missing component.
  4. When transferring the board back to the hotplate, I spilled the whole lot on the floor! Fortunately most stayed put, but I had to spend quite a bit of time inspecting things to make sure it was OK, moving some items back into place, and replacing others that had vanished into the carpet.
  5. Second cooking. Looking good.
  6. First test: Plug it into a USB port on my computer. No beeping sound. Nada. I check voltages on the board in a few places, they are all fine, what is going on? I decide to try another device in the same USB port. Nothing. Now this is worrying: had I blown the port? Then I remembered I had the laptop connected to bluetooth audio. The receiver was switched off. So I disconnected bluetooth and plugged my second device into the USB port to check the port, nice noise, port was fine. Now I’m thinking that my new board is probably fine too. Plug that in, no noise. Nada. So, check the soldering. Looks fine, but I touch up the pins on the USB/UART chip that handle the USB connections and now I get the happy sounds from the laptop, so I solder on some indicator LEDs and some connectors.
  7. Next test: Program the ESP8285 on the board. No go. Laptop can’t talk to the ESP8285. I spent quite a while trying to trouble-shoot this. I touched up the pins on the USB/UART chip that interface to the ESP8285. No difference. I wondered if maybe the second cooking had broken the ESP. It looked like there was a blister on it. However I figured I should check some of the signals on the ESP, so I start counting clockwise from pin 1. When I got to the pin that should have been GPIO0, something didn’t seem right. It shouldn’t have been on that side of the board. Then I realized: I had soldered the chip on the wrong way! Arghhhhhh. I was resigned to just salvaging what components I could on the board and throwing it away, but I was tempted to heat the board back up again, pull the ESP and solder a new one on. To do that I would have to unsolder those connectors and LEDs. Not a trivial task. Then it occurred to me: I have a heat gun (not one specific to PCB work, just a regular old heatgun like you might use for stripping paint). I figured I might as well see if I could use it to de-solder the ESP, and amazingly it worked. I fitted a new chip in the right orientation and used the heat gun to solder it. I tried to program it again, and it worked! I can connect to my web server running on the ESP and mess with the controls.
  8. So I plug in a Nixie tube adapter and nothing. Oh come on! I start checking voltages and there is no 5V. 5V is used for two things on this board: Lighting up the LEDs and driving the HV switch. I quickly narrow it down to a dry joint on a diode from the USB power line to my 5V circuit.
  9. OK. Plug in the nixie adapter again and it lights up. We are in business! Wait, though. The LEDs on the adapter aren’t lighting up. This is getting ridiculous (maybe that should be more ridiculous). These aren’t just regular LEDs, they are NeoPixels. I just checked the power above, so I look at the signal lines. They go through a 3V3 to 5V level converter. The signal was non-existant. It was 0V on the 3V3 side and weirdly it was 5V on the 5V side. This is not an inverting level converter, so it should have been 0V too. Except it shouldn’t be 0V at all, it should have a PWM signal on it. I check the connections from the ESP to the level converter, it is all good. There is a pull-up resistor in that line, so something was driving it to zero. All the signals to the HV chip go through the same level converter, and they were working just fine. Finally, though, I decide it has to be the level converter, because 0V should not become 5V. Time to de-solder that chip (another QFN-type package) and replace it.
  10. Plug in the Nixie adapter again, and now I have LEDs. But now the Nixie tube is blank! It has to be the level converter again, so I start tracing signals and yes, I have a dry(ish) joint on one of the pins. I touch that up, plug in the adapter and, finally, everything works.

So, eight hours later and I’m actually quite please that I managed to trouble-shoot this. Plus I learned how to do re-work using a hot air gun (BTW, the gun does have various temperature and ‘ferocity’ settings).

I have yet to clean up though:

 

Display the Time on an Old Frequency Counter

A while back I bought an old frequency counter that has a Nixie tube display. It is a Japanese SF-87A made by the Sansei Electronics company. I bought it for the tubes – eight CD66 – however, when it arrived, it was in very good condition and worked just fine, so I decided not to harvest the tubes from it. I subsequently used it to display the frequency of my Nixie power supply, but that was just looking for an excuse, I didn’t actually need to use it for that:

Displaying the frequency of my Nixie power supply.

This left me in a bit of a quandry, but not too long ago Alic Loeliger suggested on the Nixie Clocks Fan Page on Facebook that I could get it to display the time by just sending the right number of pulses to it in a given time. This was such a simple idea that I had to try it.

The maximum gate time of the counter is 1 sec, and the largest number I would need to display would be 125959 (aka 12:59:59) for a 12-hour clock, or 235959 (aka 23:59:59) for a 24-hour clock. In other words, I would need to generate (at most) either a 126KHz signal, or a 236KHz signal. As I was doing this in software, because I am a software engineer, I went for the lower of the two numbers – I wanted to make sure that one of the processors I had available would be able to do it. I had a choice of an Arduino Uno, or an ESP8266. I ended up going with the ESP8266, which I programmed using the Arduino ESP8266 toolset.

At first, I split the number of pulses evenly over the gate time. i.e. if I needed to display 10:00:00, I would send send one pulse every 0.00001s. Then I realized that the counter just counted the number of pulses that occurred within the gate time, then divided that count by the gate time to get the frequency.  In other words, all I had to do was generate the right number of pulses in less than one second. However, when I tried this, it didn’t work – I assume the pulses were too close together for the counter to detect them. So, back to sending them spread over the gate period.

The result is kind of, sort of OK. The higher the frequency gets, the less able it is to accurately display the seconds – there is some ’rounding’ involved. Here is a video of it displaying 03:07:21 – note I have no control over the placement of the thousand separators:

Here is the source code:

#include "Arduino.h"
#include 

// Use pin 0
#define PIN 0

volatile unsigned long scaledPeriod = 0;
unsigned long oldMicros = 0;
unsigned long counter = 0;

/*
 * generate the pulse train in a timer interrupt. The function uses
 * the period, rather than the frequency. This is in 1/100,000,000s
 * units
 */
const int counterPeriod = ESP.getCpuFreqMHz() * 10;

void ICACHE_RAM_ATTR isr() {
    uint32_t ccount;
    __asm__ __volatile__("esync; rsr %0,ccount":"=a" (ccount));
	timer0_write(ccount + counterPeriod);

	unsigned long newMicros = micros();
	// micros is millionths of a second. Our period is in 
	// 100,000,000 of a second, so we multiply the difference
	// by 100
	unsigned long diff = (newMicros - oldMicros) * 100;
	if (scaledPeriod > 0 && (diff > scaledPeriod)) {
		digitalWrite(PIN, HIGH);
		oldMicros = micros();
	} else {
		digitalWrite(PIN, LOW);
	}
}

void setup()
{
	// Set to some arbitrary time
	setTime(3, 7, 20, 1, 2, 2018);
	pinMode(PIN, OUTPUT);
	timer0_isr_init();
	timer0_attachInterrupt(isr);

	timer0_write(ESP.getCycleCount() + counterPeriod);
}

unsigned long  oldTime = 0;

void loop()
{
	unsigned long newTime = hour() * 10000 + minute() * 100 + second();

	if (newTime != oldTime) {
		oldTime = newTime;
		if (newTime != 0) {
			// Need a numerator that is >> newTime could be
			scaledPeriod = 100000000/newTime;
		} else {
			scaledPeriod = 0;
		}
	}
}

This code has some problems! As newTime gets larger, scaledPeriod loses more and more precision. Furthermore, because the interrupt routine is called at a fixed periodicity, it is essentially sampling the waveform. Both of these things mean that the displayed time gets less accurate as the absolute size of the number being displayed is increased.

In retrospect, it would be better to adjust the periodicity of the interrupt routine to match that of the waveform we are trying to generate. That would be an improvement, but we would still have problems caused by the rather coarse granularity of the timer we have available.

Still, the result isn’t too bad.

ITS1A Power Supply Part II

As I delved more into making a power supply for the ITS1A thyratron, the design became more complex. For example, to produce 100V from the inductor I would need an external FET. To switch the FET properly, I would need another transistor. If I was going to do that, I would use a completely different chip in the first place. So I re-considered what I was trying to achieve, which was simply to light up one of my tubes, just to prove that I could. So I used an existing 50V power supply I had built using the MC34063, and just built two Cockcroft -Walton ladders – a regular voltage doubler for the +100V, and a ridiculous ladder with 12 diodes for the -300V. Actually the data sheet (which I translated with the help of an online OCR and google translate) says that should be -250V. So that is what I used. Here is a picture:

A 6x voltage multiplier

I verified all the voltages, then the next step was to figure out what pins did what. Careful examination of the tube showed that two pins were cut short – this correlated with two pins described as ‘free’ on the data sheet and that allowed me to figure out what went where:

Physical pin descriptions of the ITS1A
Translated description of what the pins are

So with this I was able to wire the tube up and get it to glow:

Glowing ITS1A

You can clearly see the detail of how the phosphor is activated.

What I haven’t been able to do is to control which segments are on an which are off! It is clearly something to do with grid two, but I haven’t been able to figure it out yet.

ITS1A Power Supply

I have been meaning to get some ITS1A thyratron display tubes for some time, and finally bought some a few weeks ago. These are a seven segment display tube that looks a little like a VFD tube when on – they use the same phosphor – but they are driven entirely differently.

An ITS1A on ebay

Although they can be controlled with logic-level signals (roughly 1V to 5V), they require a bizarre set of voltages to actually activate them. The data sheet specifies around 40V, 100V and -240V. Others have apparently driven them with 50V, 100V and -300V. Yes, that’s right, that is minus 300V.

Now I don’t happen to have a power supply lying around that can produce that range of voltages, but it is surprisingly easy to build one. Or at least design one. I haven’t built it yet. The principle is to first build a simple boost converter, then use  a Cockcroft-Walton voltage multiplier driven from the un-rectified output of the inductor, to get the negative voltage. I simulated one in LTSpice. I set the output voltage to 100V. Built a diode/capacitor ladder for the -300V and used a 50V zener diode voltage clamp to create the 50V. This is what it looks like:

A boost converter that will produce the voltages needed to drive an ITS1A

This is what the simulation looks like:

Voltage plots for the boost converter

The part numbers for the diodes are just examples. I haven’t actually chosen them yet. Both the diodes and the capacitors in the ladder need to be able to handle over 100V. The capacitors should be low ESR types. The inductor needs to be able to handle the expected current, though I haven;t figured out what that is yet. However my aim with this is to just be able to test that the tubes work, and maybe have a little fun with them. An actual clock will come later.

 
Contact me
close slider