Luis Malavé
Published © GPL3+

VFD Serial Futaba M202SD01 Arduino

Using an old VFD serial communication display for use with Arduino based microcontrollers.

BeginnerProtip1 hour9,362
VFD Serial Futaba M202SD01 Arduino

Things used in this project

Story

Read more

Schematics

Futaba M202SD01

Futaba M202SD01 (Back)

Allows parallel and serial communication

Setup to 9600 bauds

Jumper J1 on VFD open to select baud rates input to 9600

VFD interfacing

GND, +5V and pin RX VFD

Control code

In the first tests I connected the RX pin to the TX output of my Arduino board and using the 9600 serial monitor function I was able to print characters on the display. (I'm getting closer already).
Since Arduino offers many resources, I researched the UART communication part and got a library that helps me communicate with serial UART communication devices, and this is the "SoftwareSerial" library.
Once the communication was achieved, I needed to generate the functions in the Arduino IDE with the manufacturer's information, as shown below:

Example (Clock)

Example (Humidity & Temperarature sensor)

Code

VFD_Serial_Futaba.ino

C/C++
Main code
// Code worked for VFD Futaba M202SD01LJ
// Luis Malave 2018 @lesmalave @e_smartlabs (twitter & Instagram)
// luisbmalave@gmail.com

#include <SoftwareSerial.h>
SoftwareSerial VFD(2, 3); // (rx, tx) Only connect the TX pin of the arduino to the RX pin of the display

void setup() {
  VFD.begin(9600); // Serial port is set to 9600 bauds supported by VFD
  VFDreset();
  VFDclear();
}

void loop() {
  setCursor(3); // 4 position on VFD
  cursormode(88); //Cursor mode BLINKING
  delay(4000);
  //cursormode(0);
  VFDhorizontaltab();
  setCursor(4);
  VFD.write("W");
  delay(200);
  VFD.write("e");
  delay(200);
  VFD.write("l");
  delay(200);
  VFD.write("c");
  delay(200);
  VFD.write("o");
  delay(200);
  VFD.write("m");
  delay(200);
  VFD.write("e");
  delay(300);
  VFD.write(" ");
  delay(200);
  VFD.write("t");
  delay(200);
  VFD.write("o");
  delay(200);
  VFD.write(" ");
  delay(200);
  setCursor(23); // 2nd line
  VFD.write("e");
  delay(200);
  VFD.write(" ");
  delay(200);
  VFD.write("S");
  delay(200);
  VFD.write("m");
  delay(200);
  VFD.write("a");
  delay(200);
  VFD.write("r");
  delay(200);
  VFD.write("t");
  delay(200);
  VFD.write(" ");
  delay(200);
  VFD.write("L");
  delay(200);
  VFD.write("a");
  delay(200);
  VFD.write("b");
  delay(200);
  VFD.write("s");
  delay(2000);

  cursormode(255); //Cursor mode LIGHT

  for (int positionCounter = 0; positionCounter < 40; positionCounter++) {
    VFDbackspace (); // Clear the display to the left counting from position 40 to position 0
    delay(50);
  }
  cursormode(0); //Cursor mode NO LIGHT

  VFDclear();

  setCursor(1); // 1st line
  VFD.print("Using VFD Serial");
  setCursor(21); // 2nd line
  VFD.print("FUTABA M202SD01LJ");
  delay(2000);
  VFDclear();
  setCursor(1);
  VFD.print("    Now a sample ");
  setCursor(20);
  VFD.print("    Dimmer control ");

  for (int i = 0; i < 3; i++) { // Turn the display on and off 3 times (function "for")
    VFDdimmer(0);
    delay(250);
    VFDdimmer(255);
    delay(800);
  }
  delay(2000);
  VFDclear();
  VFDdimmer(20); // dimmer 20%
  setCursor(4);
  VFD.print("20% Dimmer");
  delay(500);
  VFDclear();
  VFDdimmer(40);
  setCursor(4);
  VFD.print("40% Dimmer");
  delay(500);
  VFDclear();
  VFDdimmer(60);
  setCursor(4);
  VFD.print("60% Dimmer");
  delay(500);
  VFDclear();
  VFDdimmer(80);
  setCursor(4);
  VFD.print("80% Dimmer");
  delay(500);
  VFDclear();
  setCursor(4);
  VFDdimmer(100);
  VFD.print("100% Dimmer");
  delay(500);
  VFDclear();

  setCursor(1);
  VFD.print("Display Characters");
  setCursor(24);
  VFD.print("Code Fonts");
  delay(1000);
  VFDclear();
  VFDreset();
  VFDchars(); // display the characters from 21 to 255
  VFDclear();

  for (int i = 0; i < 80; i++) { // function that runs a character across the VFD  
    setCursor(i);
    VFD.write(0xF4); //I got funny symbol with the Datasheet
    delay(100);
    setCursor(i);
    VFD.print(" ");
  }
  VFDclear();
  setCursor(0);
  VFD.print("Follow us  Instagram");
  setCursor(9);
  VFD.write(0xF7); // arrow symbol obtained with the datasheet
  setCursor(24);
  VFD.print("@e_Smartlabs");
  delay(5000);
  VFDclear();
  setCursor(0);
  VFD.print("Follow us   twitter");
  setCursor(9);
  VFD.write(0xF7); //right arrow symbol
  setCursor(24);
  VFD.print("@e_Smartlabs");
  delay(5000);
  VFDclear();
  setCursor(1);
  VFD.print("What is your code?");
  delay(5000);
  setCursor(1); // This achieves delete characters to the right
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(50);
  VFD.write(" ");
  delay(1000);
  setCursor(3);
  VFD.print("VFD Serial UART");
  setCursor(22);
  VFD.print("FUTABA M202SD01LJ");
  delay(20000);
  VFDclear();
}

functions.ino

C/C++
The code of the functions was separated, in another .ino file in the same project
// Functions for the operation of the VFD Futaba M202SD01LJ 


/*Resetting the module.
All the characters displayed are erased, then the write-in position will be set
on the most significant digit of the first row.
The displaying status is the same as the power on reset, and cursor mode is set
for lighting mode, the dimming level is set for 100% */
void VFDreset() 
{
  VFD.write(0x1F);
}

void VFDclear() /*All the characters displayed are erased, the write-in position moves to the most
significant digit of the first row. But the Dimming level and Cursor Mode are kept.*/ 
{
  VFD.write(0x0D); // clear display
}

void VFDdimmer(int amount) // The brightness can be controlled into six levels by using this function.
//After writing 04H, the following dimming data is written to change the rightness output.
{
  VFD.write(0x04);
  VFD.write(amount);
  switch (amount)
  {
  case 20:
    VFD.write(0x04); // clear
    VFD.write(0x20); // 20% Dimmer
    break;
  case 40:
    VFD.write(0x04); // clear
    VFD.write(0x40); // 40% Dimmer
    break;
  case 60:
    VFD.write(0x04); // clear
    VFD.write(0x60); // 60% Dimmer
    break;
  case 80:
    VFD.write(0x04); // clear
    VFD.write(0x80); // 80% Dimmer
    break;
  case 100:
    VFD.write(0x04); // clear
    VFD.write(0xFF); // 100% Dimmer
  }
}

void VFDchars() // The UFO characters run from 21 to 255 described in the datasheet
{
  for (int i = 21; i < 256; i++)
  {
    VFD.write(i);
    delay(30);
  }
}

void setCursor(byte position) /*Instead of writing a character from the first digit, the write-in starting
position can be pointed by using this function.
This function enables move the cursor from 0 to 19 and 20 to 39 in the bottom row*/
{
  VFD.write(0x10);
  VFD.write(position);
}

void VFDbackspace() /*The write-in position is shifted to the left one digit, and the character previously displayed on the digit will be cleared */
{
  VFD.write(0x08);
  }

void VFDhorizontaltab() // The write-in position is shifted to the right one digit.
{
  VFD.write(0x09);
}

void cursormode(int amount) /*The cursor is always displayed at the write-in position.
The cursor is formed by the 5dots located the bottom of 57 dot matrix character font.
The cursor will be displayed as an over writing mode and the behavior of the cursor under the lighting mode and blinking mode are explained below.
VFD cursor mode - FF Lighting/  88 Blinking/    00 No Lighting */
{
  VFD.write(0x17);
  VFD.write(amount);
  switch (amount)
  {
  case 255:          
    VFD.write(0x17); 
    VFD.write(0xFF); // Lighting
    break;
  case 88:           
    VFD.write(0x17); 
    VFD.write(0x88); // Blinking
    break;
  }
}

void VFDall() /*The full dots in all digits are displayed.
The dimming level is set for 100%.
To release this mode, the module is turned off or the RST command shall be written*/
{
  VFD.write(0x0F);
}

Credits

Luis Malavé

Luis Malavé

2 projects • 6 followers
Code apprentice. 20 years as an electronics Tech and now I start with the programming of embedded systems. Code has become my new passion

Comments