ESP-IDF driver for the Futaba 8-MD-06INK Vacuum Fluorescent Display (VFD) module. This 8-digit VFD display communicates via SPI and supports customizable characters and brightness control.
- 8-digit alphanumeric display support
- SPI communication (up to 500 kHz)
- Adjustable brightness (dimming) control
- Custom character definition (CGRAM)
- Decimal point control for each digit
- Standby mode for power saving
- Direct segment control
| VFD Pin | ESP32 Pin | Description |
|---|---|---|
| VCC | 3.3V/5V | Power supply |
| GND | GND | Ground |
| DIN | MOSI | SPI Data In |
| CLK | SCLK | SPI Clock |
| CS | GPIO (CS) | Chip Select (Active Low) |
| RST | GPIO (RST) | Reset (Optional) |
Note: The SPI interface uses LSB-first bit order with CPOL=1, CPHA=1 (SPI Mode 3).
idf.py add-dependency "ftb-8-md"Copy the ftb-8-md folder to your project's components directory.
#include "ftb-8-md.h"
#include "driver/spi_master.h"
void app_main(void)
{
// Initialize SPI bus
spi_bus_config_t bus_cfg = {
.mosi_io_num = GPIO_NUM_23,
.miso_io_num = -1,
.sclk_io_num = GPIO_NUM_18,
.quadwp_io_num = -1,
.quadhd_io_num = -1,
.max_transfer_sz = 32,
};
spi_bus_initialize(SPI2_HOST, &bus_cfg, SPI_DMA_CH_AUTO);
// Register VFD device
spi_device_handle_t vfd = ftb8md_device_register(
SPI2_HOST,
GPIO_NUM_5, // CS pin
GPIO_NUM_4 // Reset pin (use -1 if not connected)
);
if (vfd != NULL) {
// Display a string
ftb8md_show_string(vfd, 0, "HELLO ");
// Set brightness (0-240)
ftb8md_set_dimming(vfd, 120);
// Turn on decimal point at digit 3
ftb8md_set_dot(vfd, 3, true);
}
}spi_device_handle_t ftb8md_device_register(spi_host_device_t host_id, int cs_pin, int reset_pin);Register and initialize the VFD display device on the SPI bus.
Parameters:
host_id: SPI host peripheral (e.g.,SPI2_HOST,SPI3_HOST)cs_pin: GPIO pin for chip selectreset_pin: GPIO pin for reset (use-1if not connected)
Returns: SPI device handle on success, NULL on failure.
esp_err_t ftb8md_show_string(spi_device_handle_t handle, int digit, const char *str);Display a string starting at the specified digit position.
Parameters:
handle: SPI device handledigit: Starting digit position (0-7)str: Null-terminated string to display
esp_err_t ftb8md_clear_display(spi_device_handle_t handle);Clear all digits and decimal points on the display.
esp_err_t ftb8md_set_dimming(spi_device_handle_t handle, uint8_t level);Set the display brightness level (0-240, where 240 is maximum brightness).
esp_err_t ftb8md_set_dot(spi_device_handle_t handle, int digit, bool dot_on);Control the decimal point for a specific digit.
esp_err_t ftb8md_enter_standby(spi_device_handle_t handle, bool standby);Enter or exit standby (low power) mode.
esp_err_t ftb8md_set_display_power(spi_device_handle_t handle, bool on);Turn the display on or off. Display contents are preserved when off.
esp_err_t ftb8md_write_custom_char(spi_device_handle_t handle, int char_index, const uint8_t grid_data[5]);Define a custom 5x7 character pattern in CGRAM.
Parameters:
handle: SPI device handlechar_index: CGRAM index (0-7)grid_data: 5-byte array containing character pattern
esp_err_t ftb8md_set_addressed_char(spi_device_handle_t handle, int digit, int char_index);Display a custom character from CGRAM at specified digit.
esp_err_t ftb8md_set_segment(spi_device_handle_t handle, int digit, uint8_t segments);Directly control individual segments of a digit.
The Futaba 8-MD-06INK has several memory areas:
| Memory | Description |
|---|---|
| DCRAM | Display Character RAM - stores character codes for each digit |
| CGROM | Character Generator ROM - built-in character patterns |
| CGRAM | Character Generator RAM - 8 user-defined characters |
| ADRAM | Additional Display RAM - controls decimal points |
- Clock Frequency: Max 500 kHz
- Mode: SPI Mode 3 (CPOL=1, CPHA=1)
- Bit Order: LSB First
- CS: Active Low
See the examples directory for complete usage examples:
- basic - Basic display operations
- custom_char - Custom character definition
- clock - Digital clock implementation
-
Display not responding:
- Check SPI connections and pin assignments
- Verify power supply voltage
- Try using the reset pin
-
Garbled display:
- Reduce SPI clock frequency
- Check LSB-first bit order configuration
-
Dim display:
- Increase dimming level with
ftb8md_set_dimming() - Check power supply current capability
- Increase dimming level with
MIT License - see LICENSE file for details.
Contributions are welcome! Please submit issues and pull requests on GitHub.