Site Guide

Find your way around the Engineering Club.

Know what you need? Search for a component, concept or project.

Around the site

Start

Labs

TestingExperimental

Build

Club

LearnExperimental

Go a little deeper

Entry points to larger collections. Use Search for individual records.

Learning paths & reference

Inside PiCrawlerExperimental

Inside Inventory

OLED Graphics Basics / Stage 2 of 3

Compose primitives

Add a line and circle with meaningful positions.

Firmware source authored · compile not attempted in this pass

Download stage 2 PlatformIO projectRead code & run steps ↓

What changes now?

Add a line and circle with meaningful positions.

Expected after hardware review: Geometry appears at the expected coordinates.

Builds on stage 1: Prove bounds.

What you need

Check availability and exact module markings before starting.

Connections / current hardware gate

Before connecting power. The SSD1309 controller family is established; carrier supply, address and pull-up rail still need confirmation. Do not assume the carrier is safe from its screen size.

  • Check the exact SSD1309 module markings, supply rating and I²C address.
  • Compare the classic ESP32 GPIO21/GPIO22 reference with the actual carrier and its pull-up voltage.
  • Keep the electrical-review flag false until the module and wiring are approved.
Conditional connection table and full module facts

Electrical review is incomplete. Conditional references require confirmation; unresolved pins or rails are not wiring instructions. Power off before changing connections.

From device / pinTo device / pinSignal / voltageConnection status and notes
2.42-inch SSD1309 128×64 OLED Display Module (I²C)
SDA
ELEGOO ESP-WROOM-32 development board
GPIO21
I2C SDA
3.3 V
Conditional reference

Carrier supply/address and pull-up rail need confirmation; catalog establishes SSD1309 family only.

2.42-inch SSD1309 128×64 OLED Display Module (I²C)
SCL
ELEGOO ESP-WROOM-32 development board
GPIO22
I2C SCL
3.3 V
Conditional reference

Use labeled GPIOs on classic ESP32; not the C6 onboard map.

display/peripheral
GND
controller
GND
Signal reference
0 V
Conditional reference

Unpowered wiring check; use correct common-ground topology and keep high-current panel returns out of thin signal paths.

display/peripheral
VCC
verified supply
Pin unresolved
Peripheral power
Voltage unresolved
Conditional reference

Supply voltage/current unknown at carrier level until reviewed; no assumed 5 V or 3.3 V instruction.

Access describes the source of a requirement. Check availability, the exact revision and the complete power/driver/harness system before starting. Inventory quantities are expected purchase/BOM quantities, not live stock.

  • controller verified · preflight required

    Compatibility and unresolved details
    • Controller: SSD1309
    • Resolution: 128 × 64
    • Diagonal: 2.42 inches
    • Interface: I²C, four-pin version
    • Emission color: Variant-dependent / not tracked; requested yellow
    • Carrier voltage/address: Not established; verify actual module
  • product family verified · preflight required

    Compatibility and unresolved details
    • Headers/USB bridge: Exact carrier count and bridge unverified

Use this complete project

Target: esp32dev · Environment: checkpoint2 · Stage branch: DISPLAY_STAGE=2

  1. Open the complete project. Download the stage ZIP, extract it and open the folder containing platformio.ini and src in VS Code. Keep its supporting headers and libraries together.
  2. Build stage 2. Select checkpoint2 in PlatformIO Project Tasks → General → Build, or use a PlatformIO terminal:
    pio run -e checkpoint2
    A successful Build compiles the program; it does not upload it or approve electrical connections.
  3. Stop at the hardware gate. The supplied electrical-review flag remains false. Have a qualified reviewer complete the actual module, wiring and power checks before using an approved configuration for hardware operation.

    As supplied, Serial at 115200 baud reports STOP: complete wiring/power review in guide before enabling hardware. and initialization stops.

After electrical review: Upload and Monitor

Only with the actual setup reviewed and the configuration explicitly approved, choose this stage's Upload task. Close any monitor using the board first.

pio run -e checkpoint2 -t upload

Open the matching Monitor at 115200 baud, then compare the expected result with what actually happens.

pio device monitor -b 115200

Record Build, Upload and physical observations separately.

Complete source

The viewer starts at src/main.cpp. Use Source file for the board profile, PlatformIO configuration and supporting code. Keep the complete ZIP together.

workspaces/oled-graphics/src/main.cpp

main.cpp
#include <Arduino.h>
#include <Wire.h>
#include <U8g2lib.h>
#include <DisplayCore.h>
#include "board_profile.h"
U8G2_SSD1309_128X64_NONAME2_F_HW_I2C oled(U8G2_R0,U8X8_PIN_NONE,22,21);
bool ready=false;uint32_t lastUpdate=0;
void setup(){Serial.begin(115200); if(!kElectricalReviewComplete){Serial.println("STOP: complete wiring/power review in guide before enabling hardware.");return;}Wire.begin(21,22);oled.setI2CAddress(kOledAddress7<<1);oled.begin();oled.setFont(u8g2_font_6x10_tf);ready=true;}

 void loop(){if(!ready)return;uint32_t now=millis();if(!displaylab::elapsed(now,lastUpdate,100))return;lastUpdate=now;oled.clearBuffer();
 oled.drawStr(0,10,"OLED coordinates");oled.drawPixel(0,0);oled.drawFrame(0,12,128,52);
 #if DISPLAY_STAGE >= 2
 oled.drawLine(0,63,127,12);oled.drawCircle(64,38,14);
 #endif
 #if DISPLAY_STAGE >= 3
 const uint8_t icon[]={0x18,0x3c,0x7e,0xff,0x18,0x18,0x18,0x00};oled.drawXBM(112,16,8,8,icon);oled.drawBox((now/100)%110,53,8,8);
 #endif
 oled.sendBuffer();}
Source integrity · SHA-2567f8b6e78a6e617304b4b7ab321cccb28106795936f9c7f6adbea7805cbaacbeb

Raw downloads and standalone ZIPs retain the canonical bytes and supporting files. Copy follows the selected Comments setting.

Check the result

Geometry appears at the expected coordinates.

As supplied, the false electrical-review flag prevents this hardware result. After qualified review, record what actually happens; the text above is an expected result, not a bench transcript.

Original verification checklist
  1. Build the exact selected environment; distinguish dependency resolution from source compilation.
  2. Observe the stated output and record actual behavior; expected result is not an observed transcript.
  3. Test the named failure mode before proceeding.

Troubleshooting

Blank OLED

Measure the permitted supply and bus idle rail, run the scanner, then check controller/profile and address. A successful I²C ACK does not prove correct initialization.

Wrong position or crop

Use the border and corner marker to distinguish width/height, rotation and controller RAM offset.

Animation sluggish

Count full-frame transfers and compare requested cadence with actual loop time. Bus speed and frame size constrain the result.

Technical explanation / original guide

Read the complete original stage guide

Original source/research wording is preserved. The stage's dated build evidence above supersedes earlier blanket compile-status wording; no physical results are implied.

Build it

Add a line and circle with meaningful positions.

Open workspaces/oled-graphics in VS Code/PlatformIO. Select checkpoint2 and run pio run -e checkpoint2. This is FIRMWARE_SOURCE_AUTHORED with embedded compilation unverified. Review the electrical flag and canonical conditional wiring before any upload.

Understand it

U8g2 provides controller/font/drawing support. The chosen constructor declares SSD1309, 128×64, the NONAME2 initialization profile, full buffering and hardware I²C. The catalog verifies controller and interface; the exact constructor profile still needs the test pattern on the owned carrier. clearBuffer clears local RAM, drawing functions alter it, and sendBuffer transfers the frame. Clearing the buffer is therefore different from continually clearing a physical character display. The API expects a shifted I²C address; a scanner result is stored as seven-bit then shifted once.

Source review precision: The origin pixel is (0,0). The existing frame is drawFrame(0,12,128,52), covering x=0..127 and y=12..63, below the text band. It is not a full-screen border.

Expected result and verification

Geometry appears at the expected coordinates.

This is expected after a correct build and electrical review, not a captured bench transcript.

Check the selected source branch and named failure conditions. Record actual build or software output separately from future physical observations.

Likely failures

Blank OLED: Measure the permitted supply and bus idle rail, run the scanner, then check controller/profile and address. A successful I²C ACK does not prove correct initialization.

Wrong position or crop: Use the border and corner marker to distinguish width/height, rotation and controller RAM offset.

Animation sluggish: Count full-frame transfers and compare requested cadence with actual loop time. Bus speed and frame size constrain the result.

Build evidence, target and remaining verification

Original status: unverified.

No successful build for this stage is recorded in the dated embedded compile ledger.

No compile was attempted in this pass under the user's testing limit. Upload and physical bench observation remain untested.

espressif32@6.12.0 · arduino

Diagnostics before integration