Skip to content

Instantly share code, notes, and snippets.

@Gladuin
Created November 29, 2022 20:58
Show Gist options
  • Save Gladuin/d1ce48d9cbd1579af278b7597d51f3a3 to your computer and use it in GitHub Desktop.
Save Gladuin/d1ce48d9cbd1579af278b7597d51f3a3 to your computer and use it in GitHub Desktop.
Simple MicroPython demo of a cheap AliExpress Futaba 8-MD-06INKM display module on a RPi Pico
from machine import Pin
import time
# Futaba 8-MD-06INKM datasheet @ https://davll.me/posts/2021/05/22/futaba-vfd-1/data/008MD006INKM_A.pdf
# DIN -> GP3 (SPI0 TX)
# CLK -> GP2 (SPI0 SCK)
# CS -> GP1 (SPI0 CSn)
# RESET -> GP4
# EN -> 5V (VBUS)
# VCC 5V -> VBUS
# GND -> GND
def write_to_display(command):
for i in range(8):
clk(0)
if (command & 0x01) == 0x01:
din(1)
else:
din(0)
command >>= 1
clk(1)
din = Pin(3, mode=Pin.OUT, value=0)
clk = Pin(2, mode=Pin.OUT, value=0)
cs = Pin(1, mode=Pin.OUT, value=0)
reset = Pin(4, mode=Pin.OUT, value=0)
reset(0)
time.sleep_us(5)
reset(1)
cs(0)
write_to_display(0xE0) # select display timing command
write_to_display(0x07) # set display timing (number of digits in display), see 2.4 in datasheet for more info
cs(1)
cs(0)
write_to_display(0xE4) # select dimming command
write_to_display(0xFF) # set dimming amount (0 to 255, 255 being the brightest), see 2.6 in datasheet for more info
cs(1)
while True:
cs(0)
write_to_display(0b00100000) # select character 0 for write, see 2.1 in datasheet for more info
write_to_display(0b00011101) # write character 00011101 to character 0
write_to_display(0b00011101) # write character 00011101 to character 1
write_to_display(0b00011101) # write character 00011101 to character 2
write_to_display(0b00011101) # write character 00011101 to character 3
write_to_display(0b00011101) # write character 00011101 to character 4
write_to_display(0b00011101) # write character 00011101 to character 5
write_to_display(0b00011101) # write character 00011101 to character 6
write_to_display(0b00011101) # write character 00011101 to character 7
cs(1)
cs(0)
write_to_display(0xE8) # show previously loaded characters on screen, see 2.7 for more info
cs(1)
time.sleep_ms(100)
cs(0)
write_to_display(0b00100000)
write_to_display(0b00011110)
write_to_display(0b00011110)
write_to_display(0b00011110)
write_to_display(0b00011110)
write_to_display(0b00011110)
write_to_display(0b00011110)
write_to_display(0b00011110)
write_to_display(0b00011110)
cs(1)
cs(0)
write_to_display(0xE8)
cs(1)
time.sleep_ms(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment