This blog entry helps you designing your very own OpenVFD from scratch. Patiently and step by step. It's easy to follow me if you have some basic electronics knowledge already, but don't worry if not. I'll do my best to keep everything short and simple. You ready?
1. GETTING TO KNOW IV-11
It all begins with this old Russian IV-11 tube. How do I light up the tube? More specifically, what kind of voltages do I need to turn a segment off? And what about turning on a segment? What is the pin layout of the tube?
Let's answer the questions by looking at the pinout diagram placed right.
Pin 1 and 11 belong to the heater (cathode). Either pin can be tied to ground (0V) and the other one receives the cathode voltage of around 1.5 volts. The latter voltage needs to be on all the time to make segments glow
Pin 2 is the grid pin. Giving this pin 30V (anode voltage) enables the display
All the other pins (pin 3 to pin 10) are anode pins for the segments called 'a' to 'g'. 30V will turn the segment on, 0V will turn it off. It's really that simple.
That prehistoric drawing on the left found in this datasheet illustrates the tube as its schematic symbol. If you are somehow familiar with tubes you'll surely notice that the IV-11 tube is just a fancy triode. In fact, that's what all VFD tubes and displays are!
STEP 2: GENERATING THE RIGHT VOLTAGE LEVELS
Now that we've found out what voltage levels our VFD tube needs to work properly, it's time to make sure that we generate them from a base supply voltage, let's say 5V. (5V is the TTL logic level, just the most common voltage to work with as a hobbyist).
The idea: Buck and boost converter!
Just two fancy ways to describe circuits that step a higher voltage down to a lower and vice versa. We could use one of each, since we have to get 1.65V from the buck and 30V from the boost converter. The chips we'll be using will depend on an important question. How much current will our tube array draw? A glace at the datasheet gives you an idea of how much current parts of the tube will draw at maximum load. Let's do some simple math. We have six tubes. Each tube has 8 anodes, one grid and one heater. A good guess will be:
Cathode voltage current requirement (worst case):
6 * Cathode current = 6 * 110 mA = 660 mA
Anode voltage current requirement (worst case):
6 * (6 * Working anode current + Grid current)
= 6 * (6 * 5.0 mA + 17.0 mA) = 228 mA
This will be a total power dissipation of around 7 watts anode and about a watt for the cathode. That's some decent dissipation and the reason why we won't torture linear regulators for the step down path. Our ICs of choice:
LM2576-ADJ for step down (5.0 V to 1.65 V)
LM2577-ADJ for step up (5.0 V to 30.0 V)
Alternative design: Any switching regulator fulfilling the current requirements will do it. You can e.g. use the LM2596 instead of LM2576 for higher switching frequency which results in a smaller footprint
In case you're wondering what's up with the two circuits - they are the result of calculations based on the some given equations in the datasheet (LM2576, LM2577). You can either do the calculation yourself or just use the values here or modules like shown in the picture above.
Got the voltage levels right? You can now put the tubes on breadboard and play with turning segments on and off. Can you tell which pin belongs to which segment and which pin the decimal dot is? Tried displaying all numbers 0 to 9, maybe even some letters?
Got the voltage levels right? You can now put the tubes on breadboard and play with turning segments on and off. Can you tell which pin belongs to which segment and which pin the decimal dot is? Tried displaying all numbers 0 to 9, maybe even some letters?
STEP 3: GAINING CONTROL
Since you now know how your VFD displays the characters by applying the right volts to the anodes, it's time to do even more. So the controlling mind behind the VFDs won't be a person or some crackhead you hire who does un- and replugging segment voltages real fast, but a microcontroller switching in a highly precise manner. But there's one little issue that keeps us from connecting the tube segments to the microcontroller directly:
The typical microcontroller (TTL) switches between 0 and 5V, while 5V means a logical '1' or 'HIGH' and 0V a logical '0' or 'LOW'. Remember we need 30V and more than 15 mA at 30V? I mentioned the current because a microcontroller can only switch a very limited amount of current (typical: 20 mA @5V). Sometimes that's sufficient to switch a green LED but not a VFD. So we'll have to come up with a circuit that gives the desired 30V to our VFD segments when we use 'HIGH' to tell a segment to turn on and 0V to the segments when we go 'LOW'.
1. A Discrete Approach
But how exactly do we toggle the segments with just 5V? The initial circuit I came up with is, I believe, simple and intuitive. It builds upon an NPN-PNP bipolar transistor pair, where the NPN receives 0-5V in, and swiches 30V over the PNP. See how it works:
Say we want to turn a tube segment off. So we apply 0V to the control input. The base voltage is 0V, so the NPN transistor is turned off, right? That means no current can flow through the path with R2, and the PNP transistor gets pulled up to 30V (VDD) over R3. Because of this we know that our PNP won't turn on either, and our segment is off since it doesn't get any current
Now let's see why 5V on 'CONTROL' will turn on the segment. With a positive voltage, Q1 will turn on. This makes R2 and R3 into a voltage divider where the base of Q2 will certainly receive a voltage (much) less than 30V. So Q2 will open up as well, switching 30V to the anode of the tube. The segment now lights up!
Together with port extending shift registers (I'll talk about them later), you can see the tube control prototype board with 48 of those NPN-PNP pairs on the laaarge picture above. I've shown this circuit to you since I believe that everyone has at least a few BC547 and BC557s lying around. So if you have some, don't hesitate to put this control circuit on breadboard using a few of them now!
2. The Integrated Solution
If you're a bit familiar with soldering, you know that soldering more than 70 SMD transistors is no fun at all. So we have to modify our discrete circuit, moving towards higher integration. Simultaneously, I'm happy to tell you that we're getting closer to OpenVFD's final tube circuit.
The idea behind it is that we try get a very similar NPN-PNP pair under the hood. Why? Because we still have to switch 30V to the segments. Found out that the UDN2981 8x TTL, so called high side switch is a good choice for this.
If that's on breadboard too, feel free to send TTL-level inputs to the UDN2981 you just got (TD62783 will do exactly the same thing). But be careful and don't short any outputs. This will burn the internal transistors immediately since they have no protection at all.
STEP 4: INTERFACING THE MICROCONTROLLER
Awesome, we are almost done with fundamental stuff for the tube circuit. What you see in the picture is the completed tube circuit of OpenVFD as found in the final schematics.
And where's the magic? Right. All I did was to copy and paste the circuit in step 4 exactly six times, since we need six tubes. Now it's finally time to reveal the functionality of the 74HC595. Previously mentioned and seen, the 74HC595 is a shift register. We use it because the microcontroller only offers a very limited amount of I/O pins. Shift registers lets you connect more stuff with just three pins: All of our data is shuttled through a serial pin into shift registers, controlling high side switches that we met before to turn the tube segments on and off.
Now if your tube circuit sort of set up, get your microcontroller ready! We are going to microcontrol the six VFD tubes for the very first time. If you want to use an Arduino board, like I did, connect
clock pin of the 74HC595 (pin 11), SCK to pin D2 of the Arduino® Uno
latch pin of the 74HC595 (pin 12), RCK to pin D3
and serial data pin of the 74HC595 (pin 14 of the first shift register), SER to pin D4 of the Uno
Have some fun with the little block of code I've written for a test drive. It's just a simple and stupid counter which starts at zero and counts up to 999,999. The right Fritzing® picture shows how the first 74HC595 is supposed to be connected. All output pins will go to the UDN2981 except for pin 9 (serial out), which has to be connected to serial in of the next 74HC595.
VFD Tube Circuit Test Drive: 6-Digit 7 Segment Counter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
#define CLOCK_PIN 2 // ATMEGA: 4 74HC595 SPI Clock Pin, SCK #define LATCH_PIN 3 // ATMEGA: 5 74HC595 SPI Latch Pin, RCK #define DATA_PIN 4 // ATMEGA: 6 74HC595 SPI Data Pin, SER uint32_t counter = 0; void setup(){ pinMode(CLOCK_PIN, OUTPUT); // Output Pin Initializer pinMode(LATCH_PIN, OUTPUT); pinMode(DATA_PIN, OUTPUT); } void loop(){ if(counter < 999999) counter++; // Increase if possible else counter = 0; // Reset else uint8_t codedOutput[6] = {0}; // Create output array uint32_t cExtract = counter; // Backup copy of counter uint8_t cIdx = 0; // Index while(cExtract > 0){ // Break down number into digits uint32_t d = cExtract / 10; codedOutput[cIdx] = charConvert((uint8_t)(cExtract - d * 10)); cExtract = d; cIdx++; } // Get the shift register ready! digitalWrite(LATCH_PIN, LOW); for(int i = 0; i < 6; i++) shiftOut(DATA_PIN, CLOCK_PIN, LSBFIRST, codedOutput[i]); digitalWrite(LATCH_PIN, HIGH); delay(100); } // Takes char value (0 to 255) and converts to 7 segment display pattern uint8_t charConvert(char input){ uint8_t output = 0; // I/O Logic switch(input){ // Decimal numbers case 0: output = 0b11111100; break; case 1: output = 0b01100000; break; case 2: output = 0b11011010; break; case 3: output = 0b11110010; break; case 4: output = 0b01100110; break; case 5: output = 0b10110110; break; case 6: output = 0b10111110; break; case 7: output = 0b11100000; break; case 8: output = 0b11111110; break; case 9: output = 0b11110110; break; } return output; } |