A little demo project to display tests on an ESP32-C3 development board with an onboard 0.42 inch OLED display (see pic).
Written in C++ and using Arduino libraries in VS Code. Not Arduino IDE so there isn't a .ino file. Not Micropython.
![]() |
![]() |
- ESP32-C3 Development Board with onboard 0.42" OLED display (72x40 pixels)
The demo cycles across 9 different display tests, changing every 2 seconds:
- Pixel Test - Shows pixel addressing with crosshairs and coordinate info
- Border Test - Full border with corner marker pixels and dimension display
- Pattern Test - Checkerboard pattern with inverted text overlay
- Scroll Test - Animated scrolling text with moving indicator
- Bar Graph - Animated sine wave bar chart
- Shapes Test - Expanding circle animation with triangles
- Line Pattern - Moving diagonal and vertical line animations
- Gradient Test - Dithered gradient effect using pixel patterns
- QR Code - Links to this GitHub repository (scannable with QR apps)
Download the pre-built firmware caled 'firmware.bin' available from the Releases page on Github, then flash it to your device using one of these options:
# Install esptool
pip install esptool
# Flash the firmware (replace /dev/ttyUSB0 with your port)
esptool.py --chip esp32c3 --port /dev/ttyUSB0 --baud 460800 write_flash 0x10000 firmware.bin
# On macOS, port might be something like /dev/cu.usbmodem1101
# On Windows, port might be COM3, COM4, etc.
You can use online ESP32 flashing tools that work directly in Chrome/Edge browsers:
- ESP Web Tools: https://esphome.github.io/esp-web-tools/
- ESP Tool Online: https://espressif.github.io/esptool-js/
- Download firmware.bin from Releases
- Open web flasher in Chrome or Edge browser with Web Serial API support.
- Connect ESP32-C3 via USB
- Select firmware.bin and flash at address
0x10000
- Download firmware: Get
firmware.bin
from Releases - Install ESP32 Flash Tool: Download from Espressif
- Flash settings:
- Chip Type: ESP32-C3
- firmware.bin at address
0x10000
- Boot Mode: UART
- Flash Size: 4MB
- Connect ESP32-C3 via USB and click "START"
You can modify the code or build from source using VS Code / PlatformIO.
- Adafruit SH110X - SH1106 OLED display driver (works better than SSD1306)
- Adafruit GFX Library - Graphics library for drawing functions
- QRCode - QR code generation library
- Wire - Built-in I2C library
- Make sure you have PlatformIO extension installed in VS Code
- Fork or clone the Git repo and open this folder in VS Code
- PlatformIO will automatically install dependencies
- Build and upload using PlatformIO commands
The code is organized into modular files:
├── include/
│ ├── config.h # Hardware configuration and constants
│ ├── display_helpers.h # Helper function declarations
│ └── display_tests.h # Test function declarations
├── src/
│ ├── main.cpp # Main program logic
│ ├── display_helpers.cpp # Abstracted display functions
│ ├── test_pixel.cpp # Pixel addressing test
│ ├── test_border.cpp # Border test
│ ├── test_pattern.cpp # Pattern test
│ ├── test_scroll.cpp # Scrolling text test
│ ├── test_bargraph.cpp # Bar graph animation
│ ├── test_shapes.cpp # Circle and shapes test
│ ├── test_lines.cpp # Line pattern animations
│ ├── test_gradient.cpp # Gradient dithering test
│ └── test_qrcode.cpp # QR code generation
└── platformio.ini # Project configuration
The project is configured for the specific ESP32-C3 OLED board pinout:
- SDA (Data): GPIO5
- SCL (Clock): GPIO6
- LED: GPIO8 (onboard LED for error indication)
- OLED Address: 0x3C (standard for SH1106 displays)
- Display Size: 72x40 pixels (declared as 128x64 with offset for compatibility)
The display uses a calibrated offset (X=26, Y=24) to properly center content on the 72x40 screen. You may need to adjust the offset on your device.
Modify config values in include/config.h
:
#define SDA_PIN 5
#define SCL_PIN 6
#define SCREEN_OFFSET_X 26
#define SCREEN_OFFSET_Y 24
The QR code test generates a scannable code linking to this GitHub repository:
Scanning Tips:
- Turn off Macro mode (flower icon) or avoid being so close the camera goes into Macro mode, since it seems to stop picking up QR codes
- Better to keep a distance from the code then use Zoom to bring the QR code into focus in the frame.
- Dedicated QR scanner apps seem to work better than the iPhone camera app
This project is licensed under the MIT License - see the LICENSE file for details.