Introduction: SSD1309 OLED With Toit

There's been a Toit driver for the ubiquitous SSD1306 OLED around for a while, but some OLEDs are controlled by the SSD1309 instead. In this instructable I'd like to show how to interface one of these using Toit and a 128x64 pixel OLED.

Supplies

  • ESP32 dev kit. I like this one since it has a narrower form factor and is therefore better suited for breadboards. The form factor leaves breadboard-space on both sides of the dev kit for connections.
  • SSD1309 OLED.

Step 1: Hooking Up the Hardware

Connecting the HW is trivial. Here's where the Huzzah GPIO should go:

  • GPIO 22 - SCL
  • GPIO 23 - SDA
  • GPIO 25 - RST
  • GPIO 32 - CS
  • GPIO 14 - DC

Apart from this we power our OLED with 5V from the battery input (Pin labelled BAT on the Huzzah) and finally we connect GND.

Step 2: Importing Required Toit Packages

The Toit package manager contains drivers for the SSD1306. You need to install the required packages by running

$ toit pkg install github.com/toitware/toit-ssd1306
$ toit pkg install github.com/toitware/toit-pixel-display

This should import the required drivers and allow you to import them into your Toit code.

Step 3: The Toit Code

Toit code to demonstrate both how to add graphical content and text to the OLED can be found in this repository:

https://github.com/nilwes/ssd1309demo

Step 4: Picture or It Did Not Happen...