The XRP controller (Raspberry Pi Pico and other electronics), software (Micropython and XRPlib), and mechanical platform are designed to allow additional components to be added.
In this exercise, we'll add an OLED display module. OLED = "Organic Light Emitting Diode." This module has 128 x 64 black and white pixels.
It uses the I2C interface to communicate with the XRP controller. In this the Sparkfun implementation of I2C, "qwiic" is used.
For details, review https://www.sparkfun.com/qwiic.
This OLED module uses the SSD1306 integrated circuit to control the display.
The XRP Code Editor Blockly implementation does not support the OLED display.
But, we can do this in MicroPython uses a library that includes the code to support the OLED display and SSD1396 integrated circuit.
The parts needed include:
Solder the 4-pin header to the OLED module printed circuit board. The long side of the pins stick out from the bottom side of the module (The OLED display is on the top side.)
(This step may have already been completed for you.)
Click the module into the 3D-printed mount. The pins and connectors go down into the slot.
Snap the module into the XRP on the front rail, to the right of the ultrasonic distance sensor
Connect qwiic cable into the qwiic socket on the XRP controller board.
Connect the qwiic cable to the OLED module.
Follow the Sparkfun qwiic I2C color standard to connect to labelled pins on the OLED module:
Black GND
Red VCC
Blue SDA
Yellow SCL
We need to include a MicroPython library for the SSD1306 OLED display.
Article: How to Interface Raspberry Pi Pico W with OLED Display using MicroPython?
Click on ssd1306.py, then click the download button (looks like this) --->:
Select a folder to save the file. Remember where you saved it!
Upload the library:
In the XRP Code Editor, click on File ... Upload to XRP
Find the ssd1306.py file you just saved and download and select it.
Click the "lib" folder to save the file as a library
Upload an OLED test program
text and graphics: OLED_test.py
This is a simple MicroPython program that displays the battery voltage and Bluetooth ID.
battery_voltage_OLED_Bluetooth_ID.py
Rocket animation: OLED_rocket.py
In the XRP Code Editor, click on File ... Upload to XRP
Find the .py file you just saved and download and select it.
Save it under the top level folder
Your XRP Code Editor "Filesytem" display should look like this --->
In the filesytem area, double-click OLED_test.py
Click RUN
It takes a few seconds to startup, then you should see "Hello, World!" a filled rectangle and other test appear on the OLED display.
In the Shell/terminal area, you should see something like:
Scan i2c bus...
i2c devices found: 2
Decimal address: 60 | Hexa address: 0x3c
Decimal address: 107 | Hexa address: 0x6b
starting display
ending display
If you only see one device, and are missing
Decimal address: 107 | Hexa address: 0x6b
check the qwiic cable connections to the XRP controller board and the OLED display.
The ssd1306 library uses the Micropython framebuf module [https://docs.micropython.org/en/latest/library/framebuf.html]
Try some additional Drawing primitive shapes such as:
display.ellipse(64, 32, 20, 20,1)
display.hline(64, 32, 32, 1)
How might you use the OLED display for debugging a program when the XRP is disconnected from your computer?
Other ideas for the OLED display?