Testing / Displays / 06
OLED Mini Dashboard
Separate sensor validity, polling rate, history and page layout in a compact instrument.
Firmware source authored · compile not attempted in this pass
What you'll build
Poll a verified DHT11 module on GPIO26 every two seconds.
First result after hardware review: Valid temperature/humidity appear; failed reads show Sensor unavailable.
What you need
- 2.42-inch SSD1309 128×64 OLED Display Module (I²C)
- ELEGOO ESP-WROOM-32 development board
- Small tactile pushbutton
- DHT11 humidity-temperature module
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.
Start building
- 1
Sensor values and errors
Poll a verified DHT11 module on GPIO26 every two seconds.
- 2
Page events
Cycle the internal page enum with a debounced GPIO27 button; visible page-specific layouts arrive in checkpoint3.
- 3
Historical layout
Add a bounded 32-sample ring buffer and a history page.
Download complete PlatformIO project
Each stage has its exact environment, complete source and expected result. Editor and tools setup →
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.
More detail
Foundations, safety and learning objectives
210 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.
- Separate sensor validity, polling rate, history and page layout in a compact instrument.
- The DHT11 provides temperature and humidity through a sensor-specific digital transaction, not an analog voltage proportional to temperature.
System diagram and electrical boundaries
Show the meaningful subsystem and signal/power boundary for OLED Mini Dashboard. 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
- DHT11 humidity-temperature moduleClub-owned
- Small tactile pushbuttonClub-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
- DHT11 humidity-temperature moduleDHT11 digital dataELEGOO ESP-WROOM-32 development boardConditional reference
- Small tactile pushbuttonActive-low buttonELEGOO 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
- ELEGOO ESP-WROOM-32 development boardClub-owned
product family verified · preflight required
Compatibility and unresolved details
- Headers/USB bridge: Exact carrier count and bridge unverified
- Small tactile pushbuttonClub-owned
product family verified · preflight required
Compatibility and unresolved details
- Contact/header current rating: Unverified; use as signal input
- DHT11 humidity-temperature moduleClub-owned
product family verified · preflight required
Electrical review is incomplete. Conditional references require confirmation; unresolved pins or rails are not wiring instructions. Power off before changing connections.
| From device / pin | To device / pin | Signal / voltage | Connection status and notes |
|---|---|---|---|
2.42-inch SSD1309 128×64 OLED Display Module (I²C)SDA | ELEGOO ESP-WROOM-32 development boardGPIO21 | 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 boardGPIO22 | I2C SCL 3.3 V | Conditional reference Use labeled GPIOs on classic ESP32; not the C6 onboard map. |
DHT11 humidity-temperature moduleverified DATA label | ELEGOO ESP-WROOM-32 development boardGPIO26 | 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 pushbuttoncontact side A | ELEGOO ESP-WROOM-32 development boardGPIO27 | Active-low button 3.3 V | Conditional reference Other contact side to GND; INPUT_PULLUP. |
display/peripheralGND | controllerGND | 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/peripheralVCC | verified supplyPin 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-dashboard
Open the extracted folder containing platformio.ini and keep the complete supporting files.
olikraus/U8g2@2.36.5adafruit/DHT sensor library@1.4.6adafruit/Adafruit Unified Sensor@1.1.15
workspaces/oled-dashboard/src/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-256
c2d93e6ac5e99645b48f71d0c2d35fa3f748a7ee42353395887508c6d87b49f1Raw 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.
Separate sensor validity, polling rate, history and page layout in a compact instrument.
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
The DHT11 provides temperature and humidity through a sensor-specific digital transaction, not an analog voltage proportional to temperature. Polling every frame would request data much faster than needed. Invalid floating results are classified separately from a real zero. A successful temperature is mapped into a deliberately bounded graph range; values outside that visual range are clipped for display, not altered as measurements.
Before you start
Estimated learning time: 210 minutes, excluding unresolved hardware/port work. Required prerequisites: display-oled-graphics, display-lcd-menu-system. 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 ID | Access scope | Expected snapshot quantity | Preflight |
|---|---|---|---|
| club:elegoo-esp-wroom-32-development-board | CLUB_OWNED | 3 | PREFLIGHT_REQUIRED |
| club:yellow-oled-display | CLUB_OWNED | 1 | PREFLIGHT_REQUIRED |
| club:dht11-humidity-temperature-module | CLUB_OWNED | 4 | PREFLIGHT_REQUIRED |
| club:pushbutton-small | CLUB_OWNED | 20 | PREFLIGHT_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.
| From | To | Signal | Voltage / gate | Condition |
|---|---|---|---|---|
| club:yellow-oled-display / SDA | club:elegoo-esp-wroom-32-development-board / GPIO21 | I2C SDA | 3.3 / CONDITIONAL_REFERENCE | Carrier supply/address and pull-up rail need confirmation; catalog establishes SSD1309 family only. |
| club:yellow-oled-display / SCL | club:elegoo-esp-wroom-32-development-board / GPIO22 | I2C SCL | 3.3 / CONDITIONAL_REFERENCE | Use labeled GPIOs on classic ESP32; not the C6 onboard map. |
| club:dht11-humidity-temperature-module / verified DATA label | club:elegoo-esp-wroom-32-development-board / GPIO26 | DHT11 digital data | 3.3 / CONDITIONAL_REFERENCE | Choose a compatible module supply and data pull-up; do not apply 5 V DATA to ESP32. |
| club:pushbutton-small / contact side A | club:elegoo-esp-wroom-32-development-board / GPIO27 | Active-low button | 3.3 / CONDITIONAL_REFERENCE | Other contact side to GND; INPUT_PULLUP. |
| display/peripheral / GND | controller / GND | Signal reference | 0 / 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 / None | Peripheral power | None / CONDITIONAL_REFERENCE | Supply voltage/current unknown at carrier level until reviewed; no assumed 5 V or 3.3 V instruction. |
Software setup and dependencies
Open workspaces/oled-dashboard in VS Code/PlatformIO. Configuration: workspaces/oled-dashboard/platformio.ini. Platform: espressif32@6.12.0. Board/framework: esp32dev / arduino. Dependencies: olikraus/U8g2@2.36.5, adafruit/DHT sensor library@1.4.6, adafruit/Adafruit Unified Sensor@1.1.15. 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
| Stage | Goal | Environment | Expected / gate |
|---|---|---|---|
| Sensor values and errors | Poll a verified DHT11 module on GPIO26 every two seconds. | checkpoint1 | Valid temperature/humidity appear; failed reads show Sensor unavailable. |
| Page events | Cycle the internal page enum with a debounced GPIO27 button; visible page-specific layouts arrive in checkpoint3. | checkpoint2 | Input updates internal page state once per stable press; the checkpoint2 screen remains the same DHT layout. Holding does not repeat. |
| Historical layout | Add a bounded 32-sample ring buffer and a history page. | checkpoint3 | Graph retains recent successful readings; invalid samples are not fabricated. |
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
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.
This dashboard has no real-time clock, so history represents sample order rather than calendar time. The graph policy caps temperature to 0..50 °C for rendering; distinguish that visual range from datasheet limits and measured environment. The selected DHT carrier must be usable at the chosen supply and its data pull-up must not exceed the ESP32 rail. An available four-pin bare part and an available module are different wiring cases.
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.
Canonical code reading map
| Real file | Source landmarks (1-based) | Lines |
|---|---|---|
| workspaces/oled-dashboard/include/board_profile.h | Supporting declarations / portable helpers | 5 |
| workspaces/oled-dashboard/src/main.cpp | 12: void setup(){Serial.begin(115200); if(!kElectricalReviewComplete){Serial.println("STOP: complete wir; 14: void loop(){if(!ready)return;uint32_t now=millis();const uint32_t before=sampled;pollSensor(now);if( | 26 |
| common-libs/DisplayCore/src/DisplayCore.h | 30: 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
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.
Experiments after the baseline
Track humidity history independently.
Add an RTC only after an isolated address/voltage test.
Add min/max reset as an event with clear feedback.
Challenge
Represent gaps from failed sensor reads without plotting invented points.
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, dht-lib, 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
- ACK/NACK bus scan Environment: checkpoint1
- OLED border/corner profile fixture Environment: checkpoint1
- Debounced press monitor Environment: checkpoint1
Technical sources and references
- PlatformIO classic ESP32
esp32dev target identity; confirm exact installed hardware
- PlatformIO dependencies
Dependency installation occurs during package/build processing
- U8g2 API
Graphics, buffer transfer and shifted address API
- U8g2 constructors
SSD1309 initialization family; exact carrier profile needs bench fixture
- Adafruit DHT sensor library
DHT11 acquisition API; chosen1.4.6 pin verified by preserved registry evidence. Dependency installation and embedded compilation remain unverified.
- Official PlatformIO IDE installation
Official VS Code extension includes Core and project environment tasks