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 Mini Dashboard / Stage 3 of 3

Historical layout

Add a bounded 32-sample ring buffer and a history page.

Firmware source authored · compile not attempted in this pass

Download stage 3 PlatformIO projectRead code & run steps ↓

What changes now?

Add a bounded 32-sample ring buffer and a history page.

Expected after hardware review: Graph retains recent successful readings; invalid samples are not fabricated.

Builds on stage 2: Page events.

What you need

Check availability and exact module markings before starting.

Connections / current hardware gate

Before connecting power. Confirm the SSD1309 carrier, DHT11 data levels and button contacts. Missing or invalid sensor readings must remain visible as errors.

  • Complete the OLED supply/address/pull-up review.
  • Verify the DHT11 carrier pin order and data voltage, and the button wiring, against the conditional reference.
  • Preserve the two-second sensor polling policy and do not replace failed readings with invented values.
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.

DHT11 humidity-temperature module
verified DATA label
ELEGOO ESP-WROOM-32 development board
GPIO26
DHT11 digital data
3.3 V
Conditional reference

Choose a compatible module supply and data pull-up; do not apply 5 V DATA to ESP32.

Small tactile pushbutton
contact side A
ELEGOO ESP-WROOM-32 development board
GPIO27
Active-low button
3.3 V
Conditional reference

Other contact side to GND; INPUT_PULLUP.

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
  • product family verified · preflight required

    Compatibility and unresolved details
    • Contact/header current rating: Unverified; use as signal input
  • product family verified · preflight required

Use this complete project

Target: esp32dev · Environment: checkpoint3 · Stage branch: DISPLAY_STAGE=3

  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 3. Select checkpoint3 in PlatformIO Project Tasks → General → Build, or use a PlatformIO terminal:
    pio run -e checkpoint3
    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 checkpoint3 -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-dashboard/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;
#include <DHT.h>
DHT sensor(26,DHT11);float temperature=0,humidity=0;bool valid=false;uint32_t sampled=0;
void pollSensor(uint32_t now){if(!displaylab::elapsed(now,sampled,2000))return;sampled=now;float t=sensor.readTemperature(),h=sensor.readHumidity();valid=isfinite(t)&&isfinite(h);if(valid){temperature=t;humidity=h;}}
displaylab::History<32> history;displaylab::Button button;displaylab::Page page=displaylab::Page::measurement;
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);sensor.begin();pinMode(27,INPUT_PULLUP);ready=true;}

 void loop(){if(!ready)return;uint32_t now=millis();const uint32_t before=sampled;pollSensor(now);if(sampled!=before&&valid)history.add(uint16_t(constrain(temperature,0,50)*2));
 #if DISPLAY_STAGE >= 2
 if(button.update(digitalRead(27)==LOW,now))page=displaylab::nextPage(page);
 #endif
 if(!displaylab::elapsed(now,lastUpdate,250))return;lastUpdate=now;oled.clearBuffer();oled.setCursor(0,10);
 if(!valid)oled.print("Sensor unavailable");else{oled.print(temperature,1);oled.print(" C  ");oled.print(humidity,0);oled.print(" %RH");}
 #if DISPLAY_STAGE >= 3
 if(page==displaylab::Page::history){for(size_t i=0;i<history.count;++i)oled.drawVLine(i*4,63-history.oldest(i)/2,history.oldest(i)/2);}
 else if(page==displaylab::Page::status){oled.drawStr(0,30,"2 s sensor / 250 ms UI");oled.drawStr(0,44,"Invalid != zero");}
 #else
 oled.drawStr(0,30,"DHT11 on GPIO26");
 #endif
 oled.sendBuffer();}
Source integrity · SHA-256c2d93e6ac5e99645b48f71d0c2d35fa3f748a7ee42353395887508c6d87b49f1

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

Check the result

Graph retains recent successful readings; invalid samples are not fabricated.

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

NaN/invalid reads

Verify DHT11 rather than DHT22 selection, carrier/data pin, pull-up rail and sampling cadence. Do not turn failure into zero.

Graph appears flat

Inspect raw temperature and the graph scale; quantization and a stable room can be expected.

History order reverses

Test the ring buffer through more than its capacity and use chronological access rather than raw array order.

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 bounded 32-sample ring buffer and a history page.

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

Understand it

The sensor cadence is two seconds, the UI cadence 250 ms, and input is polled each loop. A circular history retains the newest thirty-two samples without reallocating or shifting a whole array. The oldest() query gives chronological access even after the storage index wraps. Failed reads are excluded from history; subsequent success changes validity back to true. This baseline shows the last success only when the current read is valid, rather than treating an old value as a new measurement.

Source review precision: Checkpoint2 handles the page event and updates the enum, but the visible history/status branches compile only in checkpoint3. Its screen therefore stays on the common DHT layout. History collection already runs in every environment; checkpoint3 exposes it graphically. Do not claim that distinct pages were visibly tested at checkpoint2.

Expected result and verification

Graph retains recent successful readings; invalid samples are not fabricated.

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

NaN/invalid reads: Verify DHT11 rather than DHT22 selection, carrier/data pin, pull-up rail and sampling cadence. Do not turn failure into zero.

Graph appears flat: Inspect raw temperature and the graph scale; quantization and a stable room can be expected.

History order reverses: Test the ring buffer through more than its capacity and use chronological access rather than raw array order.

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