Sponsored links

Displaying a single digit number with the beautiful and transparent VFD display tube IV-27M

Sponsored links

This time I would like to control the IV-27M with ESP32 and display the numbers. Here is the previous experimental article where I tried this out and turned on all the lights.

Sponsored links

Examining the pin assignments

With all the lights on, I pulled out the pins one by one to find out which pin was connected to which segment or grit.

Pin assignment of the right side

The right side has 11 pins.

  1. NC
  2. NC
  3. Grid 1
  4. Heater
  5. Heater
  6. Grid2
  7. Grid6
  8. Grid7
  9. Grid5
  10. Grid3
  11. Grid4

The pins were as shown above. Grid 1 is the rightmost digit, and the larger the number, the further left it is.

Pin assignment of the left side

There are 15 pins on the left side.

  1. Grid8
  2. Grid9
  3. Grid10
  4. Grid11
  5. Grid12
  6. Segment a
  7. Segment f
  8. Segment b
  9. Segment g
  10. Segment e
  11. Segment c
  12. Segment d
  13. Segment dp(dot)
  14. Grid14
  15. Grid13

Driver IC for VFD

HV5812

HV5812DataSheet

I found a very useful driver IC, Microchip's HV5812, which can drive up to 80V on 20 channels. It has a built-in shift register and can be controlled via SPI.

It comes in a PLCC package, which is rare nowadays. I would like to use it to drive the IV-27M.

However, since this is a 5V driver IC, it cannot be directly controlled via SPI from an ESP32 running at 3.3V, so I will use a 3.3V to 5V level conversion IC.

Circuit

IV27M回路図

The SPI signal from the ESP32 is converted to a 5V signal using a level shifter, and then input to the HV5812, and the output of the HV5812 is connected to each grid and segment of the IV-27M.

The 24V power supply of the IV-27M is obtained from the 5V output of the ESP32 using a boost-type DCDC converter.

Program

#include 
#define SPI_FREQ 2000000
#define STROBE_PIN 5

long long data = 0x0000000000000000;

const int GRID[14] = { 0 , 1, 5, 6, 4, 2, 4, 20, 21, 22, 23, 24, 34, 33};

//                    a   b   c   d   e   f   g  dp
const int SEG[8] = { 25, 27, 30, 31, 29, 26, 28, 32};
const int SEG_NUM = 8;

//                            a  b  c  d  e  f  g
const bool CHAR[18][7] =   { {1, 1, 1, 1, 1, 1, 0}, {0, 1, 1, 0, 0, 0, 0}, {1, 1, 0, 1, 1, 0, 1}, {1, 1, 1, 1, 0, 0, 1},
  {0, 1, 1, 0, 0, 1, 1}, {1, 0, 1, 1, 0, 1, 1}, {1, 0, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 0, 0, 0},
  {1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 0, 1, 1}, {1, 1, 1, 0, 1, 1, 1}, {0, 0, 1, 1, 1, 1, 1},
  {1, 0, 0, 1, 1, 1, 0}, {0, 1, 1, 1, 1, 0, 1}, {1, 0, 0, 1, 1, 1, 1}, {1, 0, 0, 0, 1, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1}
};

void setup() {
  Serial.begin(115200);
  delay(100);
  Serial.println("start");

  SPI.begin();
  SPI.setFrequency(SPI_FREQ);
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(MSBFIRST);

  pinMode( STROBE_PIN, OUTPUT );
  digitalWrite( STROBE_PIN, LOW );
}

void loop() {
  gridON( 0 );
  for ( int i = 0 ; i < 10 ; i++)
  {
    char str[2];
    sprintf( str , "%01d" , i );
    setChar( str[0] );
    show();
    delay(1000);
  }
}

bool gridON( int gridNum )
{
  data |= (long long)1 << GRID[gridNum];
}

bool gridOFF( int gridNum )
{
  data &= ~((long long)1 << GRID[gridNum]);
}

//set charactor pattern
void setChar( char charctor )
{
  int id = 0;
  switch ( charctor ) {
    case '0':  id = 0; break;
    case '1':  id = 1; break;
    case '2':  id = 2; break;
    case '3':  id = 3; break;
    case '4':  id = 4; break;
    case '5':  id = 5; break;
    case '6':  id = 6; break;
    case '7':  id = 7; break;
    case '8':  id = 8; break;
    case '9':  id = 9; break;
    case 'A':  id = 10; break;
    case 'B':  id = 11; break;
    case 'C':  id = 12; break;
    case 'D':  id = 13; break;
    case 'E':  id = 14; break;
    case 'F':  id = 15; break;
    case ' ':  id = 16; break;
    case '-':  id = 17; break;
    default:   id = 16; break;
  }
  Serial.printf("%c %d\n",charctor , id);

  for ( int i = 0 ; i < 7 ; i++ )
  {
    if ( CHAR[id][i] == 1 )
    {
      data |= (long long)1 << SEG[i];
    }
    else
    {
      data &= ~((long long)1 << SEG[i]);
    }
  }
}

bool show()
{
  uint8_t transfarData[5];
  transfarData[0] = ( data & 0x000000FF00000000 ) >> 32;
  transfarData[1] = ( data & 0x00000000FF000000 ) >> 24;
  transfarData[2] = ( data & 0x0000000000FF0000 ) >> 16;
  transfarData[3] = ( data & 0x000000000000FF00 ) >> 8;
  transfarData[4] = ( data & 0x00000000000000FF );

  Serial.printf("data:%x %x %x %x %x\n", transfarData[0], transfarData[1], transfarData[2], transfarData[3], transfarData[4]);

  SPI.writeBytes(transfarData, sizeof(transfarData));
  digitalWrite( STROBE_PIN, HIGH );
  delay(1);
  digitalWrite( STROBE_PIN, LOW );
}

This is a modified version of the program from the previous VFD experiment.

The data variable is the variable that holds the content you want to display, and you set ON and OFF for each grid and segment in it. After that, the contents of the data variable are sent to the HV5812 using SPI.

Numbers are now displayed

Only one digit is displayed!

Since only one digit is displayed, it is quite bright. I'm going to modify the program so that it lights up all digits dynamically.

タイトルとURLをコピーしました