Nokia 5110 LCD module
I tried running the module from a Sparkfun Pro Micro RP2040 board.
Rust try 1 & 2: fail
I failed to get it to run under embassy both with pcd8544 and github.com/tib888/lcd-hal.
micropython-pcd8544: success!
Step 1: wiring
The connections I needed to make between the boards:
5110 | ProMicro RP2040 -------+---------------- 1 RST pin 6 2 CE pin 5 3 DC pin 4 4 Din CO (SPI = PICO Peripheral-In/Controller-Out = MOSI Master-Out/Slave-In 5 Clk SCK (SCLK = Serial CLocK) 7 BL pin 7
(where, apparently, CO is an SPI pin - the PICO terminology is also noted on Wikipedia). Plus, obviously, power and ground:
5110 | ProMicro RP2040 -------+---------------- 6 Vcc 3V3 8 Gnd GND
Step 2: MicroPython on SparkFun RP2040
Download: MicroPython for SparkFun Pro Micro, v1.24.1 (2024.11.29).uf2.
On the ProMicro, when connected to an USB port on the computer, hold the “BOOT” button (the one on the side with pins TX, RX, and numbers 2-6), and while holding it, press and release the “RESET” button (the one on the side with pins CI, SCK, and notably RST).
This should result in a new “disk” showing up in the Windows PC.
Just drag & drop the micropython SPARKFUN_PROMICRO-20241129-v1.24.1.uf2
file
onto this new pseudo-disk.
The disk should disappear after the copy completes,
and a sound of USB device disconnecting should happen.
A new notification may show up about installing a new USB device.
Step 3: test connection with PuTTy
In Windows Device Manager, find a “USB Serial Device (COM3)” or similar. The “(COM3)” part (in my case “(COM6)”) will be important here.
For details, see the excellent guide at picockpit.com.
In PuTTy, open a “Serial” connection to the port found above (it might be COM3, or COM6, or some other similar number).
You should see a text like:
MicroPython v1.24.1 on 2024-11-29; SparkFun Pro Micro RP2040 with RP2040 Type "help()" for more information. >>>
You should be able to type simple Python commands:
MicroPython v1.24.1 on 2024-11-29; SparkFun Pro Micro RP2040 with RP2040 Type "help()" for more information. >>> print("hello rpi2040!") hello rpi2040! >>>
Step 4: Download and install Thonny
Thonny seems to be a simple Python IDE with support for MicroPython and RP2040.
Again, follow the excellent guide at picockpit.com. Note though, that the “blinky” example will not work. The ProMicro RP2040 board has no normal, simple LED, but instead has a complex “NeoPixel” multi-color LED, which means it is super-complicated to program and it’s not easy to just test if a blinky works on this board :( But you already tested micropython, so you know it works!
In Thonny,
paste the
pcd8544.py file from gh/mcauser/micropython-pcd8544 repo.
When saving the file,
save it to Raspberry Pi,
giving the name: pcd8544.py
.
Create new file, and now paste:
# From: https://github.com/mcauser/micropython-pcd8544 import pcd8544 from machine import Pin, SPI # Connections: # 5110 | ProMicro RP2040 # ------+---------------- # RST pin 6 # CE pin 5 # DC pin 4 # Din CO (SPI = PICO Peripheral-In/Controller-Out = MOSI Master-Out/Slave-In # Clk SCK (SCLK = Serial CLocK) # BL pin 7 spi = SPI(0) spi.init(baudrate=2000000, polarity=0, phase=0) cs = Pin(5) # a.k.a. CE dc = Pin(4) rst = Pin(6) # backlight on bl = Pin(7, Pin.OUT, value=1) lcd = pcd8544.PCD8544(spi, cs, dc, rst) # bitmap smiley (horzontal msb) lcd.clear() # draw 8x16 in bank 0 (rows 0..7) lcd.position(0, 0) lcd.data(bytearray(b'\xE0\x38\xE4\x22\xA2\xE1\xE1\x61\xE1\x21\xA2\xE2\xE4\x38\xE0\x00')) # draw 8x16 in bank 1 (rows 8..15) lcd.position(0, 1) lcd.data(bytearray(b'\x03\x0C\x10\x21\x21\x41\x48\x48\x48\x49\x25\x21\x10\x0C\x03\x00'))
Click “Run”. You should see a lovely smiley in a corner of the LCD screen!