Using a Samsung 20T202DA2JA 5-pin 20x2 VFD Display

Has anyone successfully used a 20T202DA2JA vacuum fluorescent serial display on their arduino? A typical example of which can be found detailed in www.egochina.net.cn/e-shop/ebay/Datasheet/20T202DA2JA.pdf at the moment.

Mine is a five-pin unit, although there are similar units with a 14 pin connector, which isn't the one I have. The connections are:

  • gnd
  • +5Vcc
  • SIO: input/output terminal for display or control codes
  • /STB: strobe input terminal
  • SCK: shift clock input terminal of shift register

Hi, i'm trying to use the same VFD display (coming out from an old HP plotter), wonder if you've had any success with it?

I'll be trying the SPI interfacing later today.

I bought one of these on eBay* and the seller had some demo code on their page for some microcontroller I hadn’t ever heard of. I ported it over to arduino and the VFD works fine.

*Not affiliated just where I picked mine up

//VFD  to  Arduino
// 1         GND
// 2         VCC
// 3-SIO     D11-MOSI
// 4-STB     D10-Slave Select
// 5-SCK     D13-SCK

#include <SPI.h>
const int slaveSelectPin = 10;

  unsigned char UDF[13][8]=
  {
    0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,
    0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
    0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
    0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
    0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
    0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
  };

  unsigned char i,j,k;

unsigned char Seril_Demo_Line1[]={
' ',' ',' ',' ','V','F','D','-','D','I','S','P','L','A','Y',' ',' ',' ',' ',' ',
};
unsigned char Seril_Demo_Line2[]={
'M','O','D','E',':','S','E','R','I','A','L','-','D','E','M','O',' ',' ',' ',' ',
};


void setup()
{
  pinMode (slaveSelectPin, OUTPUT);
  SPI.begin();
  SPI.setDataMode(SPI_MODE3);
}

void cdelay(unsigned int t)
{
    while(t--);
        delay(100);
//        delay(t);
}

void DATA(unsigned char temp_1)
{
  digitalWrite(slaveSelectPin,LOW);
  SPI.transfer(0xfa);
  SPI.transfer(temp_1);
  digitalWrite(slaveSelectPin,HIGH);
}

void COM(unsigned char temp_2)
{
  digitalWrite(slaveSelectPin,LOW);
  SPI.transfer(0xf8);
  SPI.transfer(temp_2);
  digitalWrite(slaveSelectPin,HIGH);
}

void loop()
{
  //

  COM(0x01); //clear all display and set DD-RAM address 0 in address counter
  COM(0x02); //move cursor to the original position
  COM(0x06); //set the cursor direction increment and cursor shift enabled
  COM(0x38); //set 8bit operation,2 line display and 100% brightness level
  COM(0x80); //set cursor to the first position of 1st line
  COM(0x0c); //set display on,cursor on,blinking off
//  COM(0x06); //set display on,cursor on,blinking on (this is a guess)
  delay(10);
  
  for (j=0; j<13; j++)
  {
    COM(0x40); //CGRAM ADDRESS SETTING
    
    for (k=0; k<8; k++)
    {
      DATA(UDF[j][k]);
    }
    
    COM(0x80); //DRAM ADDRESS SETTING
    
    for (i=0; i<80; i++)
    {
      DATA(0x00);
    }
    cdelay(20000);
    cdelay(20);
  }
  
  COM(0x80);
  for (i=0; i<20; i++)
  {
    DATA(Seril_Demo_Line1[i]);
  }
  
  COM(0xc0);
  for (i=0; i<20; i++)
  {
    DATA(Seril_Demo_Line2[i]);
  }


  cdelay(50000);
  cdelay(50000);
  cdelay(50000);
  cdelay(50000);
  cdelay(50000);
  cdelay(50000);
  cdelay(50000);
  cdelay(50000);
  cdelay(50000);
  cdelay(50000);

  COM(0x80); //DDRAM ADDRESS SETTING
  for (i=0; i<20; i++)
  {
    DATA(0x2a);
    DATA(0x20);
  }
  for (i=0; i<20; i++)
  {
    DATA(0x20);
    DATA(0x2a);
  }
  cdelay(50000);
  cdelay(50000);

  COM(0x80); //DDRAM ADDRESS SETTING
  for (i=0; i<20; i++)
  {
    DATA(0x20);
    DATA(0x2a);
  }
  for (i=0; i<20; i++)
  {
    DATA(0x2a);
    DATA(0x20);
  }  
  cdelay(50000);
  cdelay(50000);

  COM(0x40); //CGRAM ADDRESS SETTING
  
  for (k=0; k<8; k++)
  {
    DATA(0xff);
  }
  
  COM(0x80); //DDRAM ADDRESS SETTING
  
  for (i=0; i<80; i++)
  {
    DATA(0x00);
  }
}

Used arduino0021 for this. It’s not the best looking code but it works just fine.

I wrote up some simple code to take whatever comes in from the serial port and prints it to the VFD. It takes the first 40 characters it gets and just discards the rest.

//VFD  to  Arduino
// 1         GND
// 2         VCC
// 3-SIO     D11-MOSI
// 4-STB     D10-Slave Select
// 5-SCK     D13-SCK

#include <SPI.h>
const int slaveSelectPin = 10;

void setup()
{
  pinMode (slaveSelectPin, OUTPUT);
  SPI.begin();
  SPI.setDataMode(SPI_MODE3);
  Serial.begin(9600);
}

void DATA(unsigned char temp_1)
{
  digitalWrite(slaveSelectPin,LOW);
  SPI.transfer(0xfa);
  SPI.transfer(temp_1);
  digitalWrite(slaveSelectPin,HIGH);
}

void COM(unsigned char temp_2)
{
  digitalWrite(slaveSelectPin,LOW);
  SPI.transfer(0xf8);
  SPI.transfer(temp_2);
  digitalWrite(slaveSelectPin,HIGH);
}

char serin1[40] = {'                                        '};

void loop()
{
  int availableBytes = 0;
  boolean change = false;
  int i = 0;
  
  while (availableBytes == 0)
  {
    availableBytes = Serial.available();
    delay(75); //this gives the buffer time to fill
  }

  availableBytes = Serial.available();

  for(i=0; i<availableBytes; i++)
  {
    if (i < 40)
    {
      serin1[i] = Serial.read();
    }
    else
    {
      Serial.read();
    }
    change = true;
  } 

  if (change == true)
  {
    for(i=availableBytes; i < 41; i++)
    {
      serin1[i] = ' ';
    }

    COM(0x01); //clear all display and set DD-RAM address 0 in address counter
    COM(0x02); //move cursor to the original position
    COM(0x06); //set the cursor direction increment and cursor shift enabled
    COM(0x38); //set 8bit operation,2 line display and 100% brightness level
    COM(0x80); //set cursor to the first position of 1st line
    COM(0x0c); //set display on,cursor on,blinking off

    COM(0x80);
    for (i=0; i<20; i++)
    {
      DATA(serin1[i]);
    }
  
    COM(0xc0);
    for (i=20; i<40; i++)
    {
      DATA(serin1[i]);
    }
  }  
}

My plan is to make this ‘Matrix Orbital’ compatible to use LCD Smartie with this VFD.

EDIT: If you just use “testdriver.dll” in LCD Smartie it sorta works. Multiple line things are still a little odd.