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

Testing / Displays / 05

OLED Graphics Basics

Learn pixel geometry and framebuffer transfer on the inventory-established SSD1309 OLED.

Firmware source authored · compile not attempted in this pass

What you'll build

Draw the origin marker and a 128×52 frame beginning at y=12 on the 128×64 screen.

First result after hardware review: Pixel (0,0) is marked and the frame spans x=0..127, y=12..63; the border does not enclose the text band.

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.

Start building

  1. 1

    Prove bounds

    Draw the origin marker and a 128×52 frame beginning at y=12 on the 128×64 screen.

  2. 2

    Compose primitives

    Add a line and circle with meaningful positions.

  3. 3

    Bitmap and moving region

    Draw an eight-byte icon and time-driven moving box.

Download complete PlatformIO project

Each stage has its exact environment, complete source and expected result. Editor and tools setup →

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.

More detail

Foundations, safety and learning objectives

155 minutes · Editorial learning estimate excluding unresolved procurement/driver-port time

Three actual PlatformIO firmware environments; embedded compile and bench verification unestablished.

  • Keep electrical review false until the exact wiring/power/logic checklist is completed.
  • No power budget is inferred from successful compilation.
  • Learn pixel geometry and framebuffer transfer on the inventory-established SSD1309 OLED.
  • OLED pixels emit light directly; there is no LCD backlight to adjust when pixels are blank.
System diagram and electrical boundaries
OLED Graphics Basics · subsystem relationships

Show the meaningful subsystem and signal/power boundary for OLED Graphics Basics. Conceptual system view; physical connections remain conditional.

  • ELEGOO ESP-WROOM-32 development boardClub-owned
  • 2.42-inch SSD1309 128×64 OLED Display Module (I²C)Club-owned

Signals and interfaces

  • 2.42-inch SSD1309 128×64 OLED Display Module (I²C)I2C SDAELEGOO ESP-WROOM-32 development boardConditional reference
  • 2.42-inch SSD1309 128×64 OLED Display Module (I²C)I2C SCLELEGOO ESP-WROOM-32 development boardConditional reference

Power and common reference boundary

  • display/peripheralSignal referencecontrollerConditional reference
  • display/peripheralPeripheral powerverified supplyConditional reference

Interfaces: GPIO · I2C

Electrical boundaries and interpretation
  • Use conditional wiring records; null pin/voltage means unresolved, not permission to choose a value.
  • Draw power and logic paths separately.
  • Do not turn a reference signal label into a guessed connector position.
  • Keep member, club and campus access labels distinct.
  • Include explicit port gate for unresolved driver/identity.
  • Access scopes: CLUB_OWNED.
  • Firmware source is not bench evidence.
Full hardware facts and conditional wiring reference

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

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.

All source files, supporting libraries and project download

Download complete project · workspaces/oled-graphics

Open the extracted folder containing platformio.ini and keep the complete supporting files.

  • olikraus/U8g2@2.36.5

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.

Original engineering guide

Original research wording is preserved. Use the stage-specific dated build evidence for later compile results; it does not establish physical behavior.

Learn pixel geometry and framebuffer transfer on the inventory-established SSD1309 OLED.

Status: FIRMWARE_AUTHORED_UNVERIFIED. FIRMWARE_SOURCE_AUTHORED; embedded build UNVERIFIED; hardware NOT_TESTED. Three actual PlatformIO firmware environments; embedded compile and bench verification unestablished.

What you are building

OLED pixels emit light directly; there is no LCD backlight to adjust when pixels are blank. A 128×64 one-bit frame has 8192 bits, or 1024 bytes before library overhead. Origin and dimensions describe pixel indices 0..127 and 0..63. A text baseline is not generally the glyph’s upper-left corner. An eight-by-eight one-bit icon uses eight bytes, but the bit order must match the drawing function’s bitmap convention.

Before you start

Estimated learning time: 155 minutes, excluding unresolved hardware/port work. Required prerequisites: display-i2c-detective. See PLATFORMIO_ORIENTATION.md and the hardware identity/access records. Current main inventory IDs and expected quantities were compared read-only at a406480e1e13807983f1c03b8a531c2dcd310ddb; expected quantities are not live stock. Member and campus access remain separate from club ownership.

Hardware and conditional wiring

Component IDAccess scopeExpected snapshot quantityPreflight
club:elegoo-esp-wroom-32-development-boardCLUB_OWNED3PREFLIGHT_REQUIRED
club:yellow-oled-displayCLUB_OWNED1PREFLIGHT_REQUIRED

Breadboard, appropriately rated jumpers/data cables and a computer are shared setup requirements. Review supply, signal levels and ground separately; power off before changing connections. Null pins/rails remain unresolved.

FromToSignalVoltage / gateCondition
club:yellow-oled-display / SDAclub:elegoo-esp-wroom-32-development-board / GPIO21I2C SDA3.3 / CONDITIONAL_REFERENCECarrier supply/address and pull-up rail need confirmation; catalog establishes SSD1309 family only.
club:yellow-oled-display / SCLclub:elegoo-esp-wroom-32-development-board / GPIO22I2C SCL3.3 / CONDITIONAL_REFERENCEUse labeled GPIOs on classic ESP32; not the C6 onboard map.
display/peripheral / GNDcontroller / GNDSignal reference0 / CONDITIONAL_REFERENCEUnpowered wiring check; use correct common-ground topology and keep high-current panel returns out of thin signal paths.
display/peripheral / VCCverified supply / NonePeripheral powerNone / CONDITIONAL_REFERENCESupply voltage/current unknown at carrier level until reviewed; no assumed 5 V or 3.3 V instruction.

Software setup and dependencies

Open workspaces/oled-graphics in VS Code/PlatformIO. Configuration: workspaces/oled-graphics/platformio.ini. Platform: espressif32@6.12.0. Board/framework: esp32dev / arduino. Dependencies: olikraus/U8g2@2.36.5. Dependency resolution occurs during build; an include is not an installation. See LIBRARY_MATRIX.md and COMPILATION_AUDIT.md for exact verification limits. The default electrical-review flag remains false. Review the matching pins, power and logic before changing it; a build cannot complete that physical review.

Build it: checkpoint path

StageGoalEnvironmentExpected / gate
Prove boundsDraw the origin marker and a 128×52 frame beginning at y=12 on the 128×64 screen.checkpoint1Pixel (0,0) is marked and the frame spans x=0..127, y=12..63; the border does not enclose the text band.
Compose primitivesAdd a line and circle with meaningful positions.checkpoint2Geometry appears at the expected coordinates.
Bitmap and moving regionDraw an eight-byte icon and time-driven moving box.checkpoint3Icon stays fixed while the box moves across the lower area.

Choose a stage deliberately. Project downloads include all authored environments; model-only project downloads include checkpoints1/2 and explicitly exclude the unfinished physical checkpoint. Stage3 for a port-gated project refuses download as finished firmware.

Understand it: software and physical model

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.

The classic ESP32 reference uses SDA21 and SCL22; confirm that the actual board exposes those GPIOs and that all pull-ups are safe at 3.3 V. The carrier supply voltage is not established by knowing the SSD1309 IC. A family reference cannot prove the board has regulation or level shifting. If a module is electrically safe but shows offset/mirrored pixels, investigate the driver/profile/rotation rather than changing random wires.

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.

Canonical code reading map

Real fileSource landmarks (1-based)Lines
workspaces/oled-graphics/include/board_profile.hSupporting declarations / portable helpers5
workspaces/oled-graphics/src/main.cpp8: void setup(){Serial.begin(115200); if(!kElectricalReviewComplete){Serial.println("STOP: complete wir; 10: void loop(){if(!ready)return;uint32_t now=millis();if(!displaylab::elapsed(now,lastUpdate,100))retur18
common-libs/DisplayCore/src/DisplayCore.h30: inline bool parsePacket(const char* text,Packet& result){; 40: bool accept(const Packet& p,uint32_t now){60

Read initialization and failure guards first, then the selected DISPLAY_STAGE region and its supporting modules. Source hashes, owners and roles are in code-assets.json. Shared software tests establish portable invariants only. No model substitutes for a physical driver.

Troubleshooting with evidence

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.

Experiments after the baseline

Redraw only at a slower cadence and compare CPU/bus use.

Choose a different font and test baseline/descender positions.

Add a bitmap with documented bit ordering.

Challenge

Create a battery/status layout that clips correctly at all four display edges.

Verification and next work

No physical upload or bench observation occurred. Expected device results are targets. Native test output is recorded separately in validation/host-results.json. Current bounded build attempts are in validation/repair-compile-results.json; historical attempts remain under validation/history/. Embedded compile/link and hardware behavior remain unverified until actual evidence is recorded.

Source records: inventory-club-v3, inventory-member-v14, pio-deps, u8g2-api, u8g2-setup, pio-esp32, pio-ide. Verified repository destinations are recorded in repository-integration.json; only resolved IDs are exposed in relatedLabs/relatedLearnConcepts.

Build evidence and diagnostic references

Current compile attempts: not performed in this pass. Physical Upload and bench observation: not tested.

  • Stage 1: no successful compile in the dated embedded ledger. The supplied electrical-review flag is false.
  • Stage 2: no successful compile in the dated embedded ledger. The supplied electrical-review flag is false.
  • Stage 3: no successful compile in the dated embedded ledger. The supplied electrical-review flag is false.

Historical compile evidence is separate from the original guide's earlier unverified status and does not establish today's build or hardware behavior.

Diagnostics before integration

Technical sources and references