ST7565/ST7567 128x64 Monochrome LCD driver

This is a monochome LCD display driver used in 128 x 64 and 132 x 64 LCD displays. The LCDs are available (pre-mounted on PCBs) relatively cheaply from via various suppliers online.

Support is included in the ST7565 (About Modules) module, using the Graphics library.

Just wire up as follows:

LCD pin Pin type Example pin on Espruino Pico
LEDA Any 3.3 (backlight on)
VSS / GND GND GND
VDD 3.3v 3.3
SCK / CLK Any B10
SDA / DIN Any B1
RS / DC Any A7
RST Any A6 (optional)
CS / CE Any A5

You can use hardware SPI for SCK and SDA, but on small monochome displays there is so little data transferred that using software SPI won't hurt, and gives you more flexibility about the pins that you use.

This display draws very little power, so if it makes wiring easier you can power it from GPIO.

var spi = new SPI();
spi.setup({ sck: B10, mosi: B1 });
var g = require("ST7565").connect({ spi:spi, dc:A7, cs:A5, rst:A6 }, function() {
  g.clear();
  g.drawString("Hello",0,0);
  g.drawLine(0, 10, g.getWidth(), 10);
  g.flip();
});

Note:

  • The display needs initialising each time the power is applied - so if you're planning on saving your code, put .connect in the onInit() function.
  • The display takes around 100ms to initialise after calling 'connect'. There's an optional callback that is called after this time (shown in the example). Sending data to it before initialisation may cause it not to initialise correctly.
  • This module uses a double buffer, which means you need to call g.flip() before any changes take effect.
  • You can use g.setContrast(0.45) to set the contrast of the LCD display. It takes a value between 0 and 1 - 0.5 is the default.
  • Some displays need different voltage divider settings (think of this as a 'coarse' contrast). You can change this with g.setContrast(0.5, x) where x is an integer between 0 and 7.
  • For 132 x 64 displays, you'll need to specify the width as an option or you'll end up with 4 columns of random pixels: var g = require("ST7565").connect({spi:spi, dc:A7, cs:A5, rst:A6, width: 132}, function() { ... })

Using

(No tutorials are available yet)

Buying

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.