Working with OLED Displays
OLED (Organic Light-Emitting Diode) displays are one of the most fun components to work with because they open up many creative possibilities. You can build games, create dashboards, or display sensor readings visually.
The SSD1306 Controller
The SSD1306 is the integrated controller chip that powers many small OLED displays, including the 0.96-inch 128x64 module we'll use. This controller handles communication between the Pico and the OLED panel using I2C protocol.
Display Specifications
- Resolution: 128 x 64 pixels (8,192 total pixels)
- Size: 0.96 inches diagonal
- Color: Monochrome (white pixels on black background)
- Operating Voltage: 3.3V
- Communication: I2C (address typically 0x3C)
Wiring the OLED Display
| Pico Pin | OLED Pin |
|---|---|
| GPIO 16 | SDA |
| GPIO 17 | SCL |
| 3.3V | VCC |
| GND | GND |
Using embedded-graphics
We'll use two main crates: embedded-graphics for drawing and ssd1306 for hardware control. The embedded-graphics crate provides high-level drawing commands for shapes, text, and images, while the ssd1306 driver handles the low-level hardware communication.
Projects Covered
- Hello OLED: Display simple text on the screen
- Raw Images: Draw images using byte arrays (1BPP format)
- BMP Images: Load and display BMP files using the tinybmp crate
- Custom Graphics: Create animations and interactive displays
Drawing Workflow
- Create shapes, text, or images using embedded-graphics primitives
- Call .draw(&mut display) to render to the internal buffer
- Call display.flush() to send the buffer to the physical screen
Complete examples for displaying text, raw images, and BMP files are available in the project repositories for both Embassy (async) and rp-hal (blocking) implementations.