Interface VFD Tubes with an Arduino

Interface VFD Tubes with an Arduino © CC BY-SA

VFD tubes are a good alternative to Nixie Tubes, especially in retro clock projects. Read about how they can be used with an Arduino.

  • 5,550 views
  • 2 comments
  • 19 respects

Components and supplies

Ard nano
Arduino Nano R3
×1
IV-11 VFD Tubes
×4
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×1
TBD62783
Transistor Array with 8 channels
×2
HEF 4017
Decimal counter
×1
Step-Up Voltage Regulator - 30V
×1
Step-Down Voltage Regulator 1.5V
For the filaments
×1

Apps and online services

About this project

VFDs (Vacuum Fluorescent Displays) were widely used in the 1970s until the early 2000s in many appliances, ranging from consumer electronics to measurement equipment. Nowadays they have been replaced more and more by modern LCD and OLED Displays, but they still live in many DIY projects like retro clocks.

How VF Displays work

A VFD works a bit like a CRT: In a vaccum, a filament emits electrons which are attracted by positively charged anodes which are coated with a luminiscent phosphor, like the screen of a TV. Anodes which are hit by electrons glow with a nice blueish-green light. By applying a positive potential to different anodes, various characters can be composed. In between the cathode and the anodes there's a thin mesh of metal called the grid. A positive potential on the grid will direct the electrons towards the anodes and so turn the whole tube on. Negative potential blocks the electrons and turn the tube off. So the characters can be multiplexed to save external components.



Advantage of VFD Tubes against Nixie Tubes

Unlike Nixies, VFDs work with a relatively low anode voltage. The russian IV-11 Tubes used in this tutorial need 25V, while Nixie tubes need around 170-200V. So VFD Tubes are much safer and easier to handle. They are also cheaper than Nixies, because there are still big stocks in Russia. So you can get a set of 4 or 6 tubes for less than 20 bucks from E**y. Because these VFD Tubes are organized as 7-Segment Displays, it is also possible to display some letters. Nixie Tubes on the other hand show only numbers from 0 to 9.

It is however not possible to connect VFD Tubes directly to the IO Ports of an Arduino or other Microcontroller, because they need 25V Anode voltage, while the IO Port only outputs 5V or less. So there is some circuitry necessary between the Microcontroller Ports and the VFD anodes.

But with the cheap and easy to use integrated open-emitter transistor array TBD62783 we have the perfect solution for this! Watch the video to learn about the details.


Code

vfdtubes.inoArduino
#include "vfd.h";

// The setup() function runs once each time the micro-controller starts
void setup()
{
  Serial.begin(115200);
  vfd_init();
}

void loop()
{
	vfd_write("12.41.34");
};
vfd.cppArduino
/*This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. 
To view a copy of this license, visit https://creativecommons.org/licenses/by-sa/4.0/deed.en 
	  _____
	 |  e  |
	c|     |f
	 |_____|
	 |  d  |
	b|     |g
	 |_____|
		a    .p  */

#include "vfd.h"
#define SEG_DP (1 << 7)
#define SEG_A (1 << 6)
#define SEG_B (1 << 5)
#define SEG_C (1 << 4)
#define SEG_D (1 << 3)
#define SEG_E (1 << 2)
#define SEG_F (1 << 1)
#define SEG_G (1 << 0)

const byte numbers[] = {
	SEG_D, //-
	0,0,
	SEG_A + SEG_B + SEG_C + SEG_E + SEG_F + SEG_G, //0
	SEG_F + SEG_G, //1
	SEG_A + SEG_B + SEG_D + SEG_E + SEG_F, //2
	SEG_A + SEG_D + SEG_E + SEG_F + SEG_G, //3
	SEG_C + SEG_D + SEG_F + SEG_G, //4
	SEG_A + SEG_C + SEG_D + SEG_E + SEG_G, //5
	SEG_A + SEG_B + SEG_C + SEG_D + SEG_E + SEG_G, //6
	SEG_E + SEG_F + SEG_G, //7
	SEG_A + SEG_B + SEG_C + SEG_D + SEG_E + SEG_F + SEG_G, //8
	SEG_A + SEG_C + SEG_D + SEG_E + SEG_F + SEG_G, //9
};

const byte letters[] = {
	SEG_B + SEG_C + SEG_D + SEG_E + SEG_F + SEG_G, //A - 10
	SEG_A + SEG_B + SEG_C + SEG_D + SEG_G, //b - 11
	SEG_A + SEG_B + SEG_C + SEG_E, //C -12
	SEG_A + SEG_B + SEG_D + SEG_G + SEG_F, //d - 13
	SEG_A + SEG_B + SEG_C + SEG_D + SEG_E, //E - 14
	SEG_B + SEG_C + SEG_D + SEG_E, //F - 15
};
uint8_t chrtable[127];

// Port mask for the 7 segments + decimal point D5
#define PORT_C_MASK 0x3f //A0..A5
#define PORT_D_MASK (1 << 4) + (1 << 5) //D4..D5
// Multiplex
#define RESET 6 //D6
#define CLK 7 //D7
#define MULTIPLEX_MASK (1 << RESET) + (1 << CLK) 

void vfd_init() {
	//serial.println("-->vfd_init");
	DDRC |= PORT_C_MASK; 
	DDRD |= PORT_D_MASK + MULTIPLEX_MASK; 
	memcpy(chrtable+45, numbers, 13);
	memcpy(chrtable+65, letters, 6);
}

//Set the Segments (val) and devimal point (dpoint)
void write(uint8_t val, bool dpoint) {
	val = toupper(val);
	//Serial.println(val);
	PORTC &= ~PORT_C_MASK;
	PORTC = chrtable[val] & PORT_C_MASK;
	PORTD &= ~(PORT_D_MASK + MULTIPLEX_MASK);
	PORTD |= (chrtable[val] >> 2) & PORT_D_MASK;
	dpoint ? PORTD += (SEG_DP >> 2) : PORTD;
}

//Perform the multiplexing
void vfd_write(const char *val) {
	static uint8_t strpos, tube_nr = 1;
	static uint32_t _mills;
	uint32_t mills = millis();
	write((uint8_t)val[strpos], val[strpos + 1] == '.');

	//Multiplex
	if(mills >= _mills + 1){
		_mills = mills;
		if(val[strpos + 1] == '.'){
			strpos++; //Skip decimal point
		}
		strpos++;
		if(tube_nr++ >= NUMBER_OF_TUBES){
			tube_nr = 1;
			strpos = 0;
			bitSet(PORTD, RESET); //Get back to first tube
		};
		bitSet(PORTD, CLK); //enable next tube
	}
}
vfd.hArduino
/*This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. 
To view a copy of this license, visit https://creativecommons.org/licenses/by-sa/4.0/deed.en */

#ifndef VFD_H
#define VFD_H

#include <Arduino.h>

//Enter the number of tubes you have here
#define NUMBER_OF_TUBES 6

void vfd_init();
void vfd_write(const char *val);

#endif

Schematics

Schematic
Schematic txawfuyp9i

Comments

Similar projects you might like

VFD Serial Futaba M202SD01 Arduino

by Luis Malavé

  • 4,280 views
  • 1 comment
  • 2 respects

Arduino Shield NCS314 NIXIE Tubes Clock IN-14

Project tutorial by Team GRA_AND_AFCH

  • 34,693 views
  • 9 comments
  • 91 respects

How to Drive Nixie Tubes

Project tutorial by Marcin Saj

  • 6,448 views
  • 1 comment
  • 9 respects

4-Stroke Digital Clock With Arduino

Project showcase by LAGSILVA

  • 18,447 views
  • 15 comments
  • 48 respects

Arduino Clock on IN-18 Nixie Tubes NCS318 LONG Service Life

Project tutorial by Grisha Anofriev

  • 26,125 views
  • 7 comments
  • 58 respects

Adjusting Clock on 128×64 Monochrome Display (ST7920)

Project tutorial by FLORICA Tudor-Nicusor

  • 15,750 views
  • 3 comments
  • 31 respects
Add projectSign up / Login