Skip to content

Instantly share code, notes, and snippets.

@RomanKharin
Last active May 14, 2020 20:13
Show Gist options
  • Save RomanKharin/aaaee90437afef82f245914a46f44546 to your computer and use it in GitHub Desktop.
Save RomanKharin/aaaee90437afef82f245914a46f44546 to your computer and use it in GitHub Desktop.
Test LCD 5110 (PCD8544) on esp32 (ESP-WROOM-32) with micropython (1.9.3)
# Test esp32 (ESP-WROOM-32) with nokia 5110 (pcd8544)
# https://github.com/mcauser/micropython-pcd8544/
# https://forum.micropython.org/viewtopic.php?t=4329
# pip install adafruit-ampy
# ampy -p /dev/ttyUSB0 put micropython-pcd8544/pcd8544.py
# ampy -p /dev/ttyUSB0 put test_esp32_5110.py
# shell screen /dev/ttyUSB0 115200
# PCD8544 -> ESP32-WROOM
# GND -> GND
# Light -> GPIO12 / enable backlight
# VCC -> 3.3v
# CLK -> GPIO18 (SPI SLK)
# DIN -> GPIO23 (SPI MOSI)
# DC -> GPIO15 / data-command
# CE -> GPIO5 / enable screen
# RST -> GPIO4 / reset screen
# Wroom blue led -> GPIO2
import pcd8544
import machine
from machine import Pin, SPI
spi = SPI(1, baudrate=328125, bits=8, polarity=0, phase=1, sck=Pin(18), mosi=Pin(23), miso=Pin(19))
spi.init()
cs = Pin(5, Pin.OUT)
dc = Pin(15, Pin.OUT)
rst = Pin(4, Pin.OUT)
# backlight on
bl = Pin(12, Pin.OUT, value=1) # off by default
# blue led
led = Pin(2, Pin.OUT)
lcd = pcd8544.PCD8544(spi, cs, dc, rst)
lcd.reset()
lcd.init()
lcd.clear()
lcd.data(bytearray([0x55, 0xAA] * 42 * 6))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment