StratoLab

Lesson 7: Using the OLED Module

Pre-requisites

Objectives

Results

## Steps

### Hardware Configuration and Wiring

IMPORTANT Before wiring your Pico, UNPLUG IT FROM YOUR COMPUTER. If plugged in while wiring, you risk damaging the Pico or SDCard reader.

  1. Wire the SSD1306 OLED display module to the Raspberry Pi Pico. SSD1306 Pins | Description | Pi Pico Pins ———— | ———– | ———— GND | (Voltage Common Collector): Provides power to the module. Connect to the 5V pin on Pico | GND (38) VCC | (Ground): Connect to the ground pin on Pico | 5V (40) SCL | (Serial Clock): Accepts clock pulses from the Pico to synchronize data transmission | GP10 (17) SDA | (Serial Data): Used for data exchange | GP16 (16)

    ssd1306-diagram

Install the SSD1306 Library

Some modules are supported by existing drivers, or libraries offered from within the Thonny IDE. the SSD1306 is one such module with a supported library. This makes interfacing with the device and writing your application code much easier!

  1. Connect your Raspberry Pi Pico to your computer using the USB cable.

  2. Open the Thonny IDE. Stop/Restart the backend to refresh the connection.

    stop-restart

  3. Click Tools then Manage Packages

  4. Type “ssd1306” in the search bar and click Search on PyPi

    package-manager

  5. Select the micropython-ssd1306 option from the search results.

  6. Click Install. This will install the supported library for the SSD1306 OLED device.

  7. Click Close

The steps in this section will use the previous hardware and driver sections to write information to the SSD1306 OLED display. The code example for this lesson is located in Lesson 7: /src/main.py.

  1. Using Thonny, open the main.py file in Lesson 7: /src/main.py.

  2. Run the script.

    run-script

    A message will be displayed on the OLED screen.

Congratulations! You have successfully completed Lesson 7.

Reference Material