0.96" SSD1306 I2C OLED Graphic Display HUD
Drive a crisp 128×64 monochrome OLED screen over two-wire I2C to render typography, gauges, and live telemetry.
Upgrade your Arduino Uno from Serial text to a razor-sharp self-illuminating 128×64 OLED display. You will scan the I2C bus, initialize the SSD1306 framebuffer, draw vector boxes and progress bars, and display live uptime telemetry.
Key Learning Objectives & Robotics Concepts
By building and programming this project, you will master the following core engineering skills:
Power Architecture & Voltage Staging
5V / 3.3V Regulated PowerThe 0.96" OLED breakout includes an onboard 3.3V LDO regulator, allowing direct 5V operation from the Arduino Uno with 10–25mA current draw depending on how many pixels are lit. Onboard 3.3V regulator and I2C pull-ups protect the OLED glass; avoid illuminating 100% white pixels indefinitely to prevent burn-in.
Bill of Materials (BOM) & Hardware Components
| Component | Specifications & Alternative | Qty | Approx Cost |
|---|---|---|---|
| Arduino Uno R3 | ATmega328P with 2KB SRAM (1KB used by OLED buffer) | 1 | $8.00 |
| 0.96" I2C OLED Display (SSD1306) | 128×64 px monochrome, I2C addr 0x3C or 0x3D | 1 | $4.00 |
| Breadboard & 4× Jumper Wires | Color-coded VCC/GND/SDA/SCL leads | 1 | $2.00 |
Electrical & System Architecture
Connect OLED VCC to 5V, GND to GND, SDA to A4 (I2C Data), and SCL to A5 (I2C Clock) on the Arduino Uno R3.
Autonomous Behavior & Finite State Machine (FSM)
Deterministic Arduino loop handling 0.96" 128×64 SSD1306 I2C OLED Module acquisition, filtering, and real-time output updates.
Step-by-Step Physical Assembly & Wiring Tutorial
Follow each of the 5 sequential milestone stages with technical photos, wiring checks, and pre-flight tests.
Inspect OLED Header Order (VCC/GND Variance)
Some SSD1306 modules place GND first, while others place VCC first—always read the silkscreen.
- Read the 4 header labels printed directly on the OLED PCB.
- Note whether the address jumper on the back is soldered to 0x78 (7-bit 0x3C) or 0x7A (0x3D).
- Seat the module firmly into the breadboard.
Wire I2C Bus to Arduino A4 & A5
Connect power and hardware I2C lines using short jumper wires.
- Wire OLED VCC → Arduino 5V and OLED GND → Arduino GND.
- Wire OLED SDA → Arduino A4 (or dedicated SDA pin near AREF).
- Wire OLED SCL → Arduino A5 (or dedicated SCL pin near AREF).
Install Adafruit SSD1306 & GFX Libraries
Install both graphics libraries via Arduino IDE Library Manager.
- Open Library Manager and install "Adafruit SSD1306".
- Accept the prompt to install "Adafruit GFX Library" and "Adafruit BusIO".
- Run the I2C scanner diagnostic first to confirm address 0x3C.
Upload Live HUD Dashboard Sketch
Flash the OLED telemetry HUD sketch to render crisp borders, text, and an animated progress gauge.
- Upload the production sketch below.
- Confirm the OLED lights up with "MYROBOPATH HUD" and a smooth sweeping gauge.
- Verify Serial Monitor reports "OLED initialized at 0x3C".
Customize Layout & Pixel Coordinates
Experiment with coordinate mapping (x: 0–127, y: 0–63) to place custom labels and sensor icons.
- Remember top-left corner is (0, 0) and bottom-right is (127, 63).
- On dual-color yellow/blue OLEDs, rows y=0..15 render yellow and y=16..63 render cyan/blue.
- Keep header titles inside the top 16px band for crisp visual hierarchy.
Subsystem Benchtop Verification Scripts
Test each hardware subsystem independently before deploying the full autonomous firmware.
1Bench Diagnostic: 0.96" 128×64 SSD1306 I2C OLED Module Hardware Check
Subsystem DiagnosticMinimal standalone sketch to verify pin wiring and signal response for 0.96" 128×64 SSD1306 I2C OLED Module before running the full project firmware.
// Diagnostic: I2C Bus Address Scanner
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(115200);
Serial.println("Scanning I2C bus...");
for (uint8_t addr = 1; addr < 127; addr++) {
Wire.beginTransmission(addr);
if (Wire.endTransmission() == 0) {
Serial.print("Found I2C device at 0x");
Serial.println(addr, HEX);
}
}
}
void loop() {}Complete Production Firmware
Full working C++ source code with pin mappings, non-blocking timers, and FSM avoidance routines.
/**
* Project 4: 0.96" SSD1306 I2C OLED Telemetry HUD
* Board: Arduino Uno R3 | Pins: A4 (SDA), A5 (SCL)
* Libraries: Adafruit_GFX, Adafruit_SSD1306
*/
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
const uint8_t SCREEN_W = 128;
const uint8_t SCREEN_H = 64;
const uint8_t OLED_ADDR = 0x3C;
Adafruit_SSD1306 oled(SCREEN_W, SCREEN_H, &Wire, -1);
uint8_t progress = 0;
void setup() {
Serial.begin(115200);
if (!oled.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR)) {
Serial.println(F("SSD1306 init failed - check SDA/SCL and address 0x3C"));
while (true) { delay(100); }
}
Serial.println(F("OLED initialized at 0x3C"));
}
void loop() {
oled.clearDisplay();
oled.setTextColor(SSD1306_WHITE);
// Header band (y = 0..15)
oled.setTextSize(1);
oled.setCursor(10, 4);
oled.print(F("MYROBOPATH UNO HUD"));
oled.drawFastHLine(0, 15, 128, SSD1306_WHITE);
// Live uptime readout
oled.setCursor(4, 22);
oled.print(F("Uptime: "));
oled.print(millis() / 1000);
oled.print(F(" sec"));
// Animated progress gauge
oled.drawRoundRect(4, 40, 120, 14, 3, SSD1306_WHITE);
uint8_t fillW = map(progress, 0, 100, 0, 114);
oled.fillRoundRect(7, 43, fillW, 8, 2, SSD1306_WHITE);
oled.display();
progress = (progress + 4) % 104;
delay(120);
}Firmware Architecture Explanation:
- Initializes the SSD1306 internal charge pump (SSD1306_SWITCHCAPVCC) over 400kHz-capable hardware I2C.
- Uses F() flash-string macros to protect the Uno's 2KB SRAM alongside the 1KB graphics buffer.
- Draws a clean 16px header divider, live uptime counter, and rounded animated progress bar.
Operational Verification & Pin State Matrix
Input Signal vs. System Output Truth Table:
| Input / State | Pin / Signal | Detected Condition | Expected Output |
|---|---|---|---|
| I2C 0x3C ACK | A4/A5 Active | Display Detected | Render 128×64 HUD Frames |
| No ACK | Bus Idle | Missing / Wrong Addr | Log Serial Init Error |
Engineering Troubleshooting Matrix
| Problem | Likely Cause | Diagnostic Check | Engineering Solution |
|---|---|---|---|
| Screen remains completely black | SDA/SCL swapped or I2C address is 0x3D instead of 0x3C | Run the I2C Bus Address Scanner diagnostic sketch | Swap A4/A5 if no device found, or update OLED_ADDR to reported hex value. |
| Garbled snow or shifted right column | Display uses SH1106 driver chip rather than SSD1306 | Check 1.3" vs 0.96" panel specs | Use the U8g2 or Adafruit_SH110X library for SH1106 panels. |
| Arduino resets randomly when adding more text | SRAM exhaustion from string literals | Check compiler global variable RAM usage (>75% is risky) | Wrap all constant strings in F("...") to keep them in Flash. |
Engineering Challenges & Upgrades
Take your build to the next level with these progressive engineering upgrades:
Animate a 6×6 filled circle bouncing cleanly off all four display borders.
Plot analogRead(A0) samples across the 128px horizontal axis as a rolling waveform.
Add a push button on D2 to cycle between System Info, Bar Gauge, and Sensor Telemetry screens.