Jktyre Treel ESP32 OLED for ESP32-C3
An ESP32 display project for ESP32-C3 involving TFT display, OLED display.
Parts and sourceBefore you start
Check the exact TFT display, OLED display configuration against the upstream wiring or parts list.
Upstream README
JK Tyre TREEL TPMS β ESP32 Receiver, Decoder & Web Dashboard
Open-source Bluetooth Low Energy (BLE) receiver, decoder, responsive Web Dashboard, and REST API for JK Tyre TREEL / SmartTyre TPMS Sensors using ESP32 microcontrollers.
π Key Features
- Dual Telemetry Decoding:
- Mode 1: Apple iBeacon Mode (
...FFE0UUID) β Extracts Pressure (PSI) & Temperature (Β°C). - Mode 2: Encrypted GATT Mode (AES-128-ECB via
mbedTLS) β Decrypts full payload with secret key for Pressure, Temperature, and Battery %.
- Mode 1: Apple iBeacon Mode (
- Dual-Endian MAC Matching: Correctly resolves both Forward MAC (
D2:58:6D:8F:16:10), Reversed MAC (10:16:8F:6D:58:D2), and 6-character Short Sensor IDs (8F1610). - High Performance Continuous Scanning: Powered by
NimBLE-Arduinofor 100% packet capture with zero buffer drops. - Embedded Web Server & Live Dashboard:
- Responsive 4-quadrant vehicle chassis UI (FL, FR, RL, RR) with AJAX 1Hz live polling.
- Displays Pressure (PSI, Bar, kPa), Temperature (Β°C, Β°F), Battery %, RSSI, and Last Seen timer.
- Live rolling BLE packet log terminal right in the browser.
- REST JSON API:
GET /api/data: Returns JSON telemetry state for all 4 tires, free heap, uptime, and packet counters.GET /api/logs: Returns recent system logs.GET /api/clear: Clears rolling log buffer.
- Dual Wi-Fi Modes: Tries connecting to your Wi-Fi router (STA mode) first; automatically falls back to Access Point mode (
ESP32_TPMS_Dashboard/12345678). - Modular Multi-Display Support (Zero Memory Overhead):
- 2.0 Inch TFT Color LCD Display SPI Module | Robu.in (GMT020-02 320x240 Landscape) β High resolution 4-quadrant modern automotive layout with FreeSans vector typography, battery %, and double-buffered age timers.
- 1.3" SH1106 & 0.96" SSD1306 I2C OLED Displays (128x64 resolution).
- Conditional Compilation: Preprocessor macros (
DISPLAY_TYPE) ensure only the selected display driver & font tables are compiled, keeping binary footprint minimal.
- Headless Mode: Can run completely headless (
DISPLAY_TYPE_NONE) as a discreet wireless BLE $\rightarrow$ Wi-Fi gateway with zero display overhead.
Β Β
Live TPMS Display Previews: 2.0" ST7789 SPI TFT Color Display with modern UI & alert warnings (Left) and 1.3" I2C OLED Display (Right).
π Project Architecture
ββββββββββββββββββββββββββ
β JK Tyre TREEL TPMS β
β BLE Sensors β
βββββββββββββ¬βββββββββββββ
β BLE Advertisements (iBeacon / AES GATT)
βΌ
ββββββββββββββββββββββββββ
β ESP32 Board β
β (DevKit / C3 SuperMini)β
βββββββ¬βββββββββββββ¬ββββββ
β β
Wi-Fi (AP/STA) β β SPI / I2C (Modular)
βΌ βΌ
βββββββββββββββββ βββββββββββββββββββββββββ
β Web Dashboard β β OLED (1.3"/0.96" I2C) β
β & REST API β β TFT (2.0" ST7789 SPI) β
βββββββββββββββββ βββββββββββββββββββββββββ
π Repository Structure
βββ README.md # Main Project Overview & Quick Start Guide
βββ LICENSE # Open-source MIT License
βββ .gitignore # Git exclusion rules
βββ docs/ # Detailed Documentation & Guides
β βββ PROTOCOL_SPECIFICATION.md # Deep-dive BLE protocol & AES telemetry specification
β βββ ESP32_C3_SUPERMINI_GUIDE.md # Dedicated setup & pinout guide for ESP32-C3 SuperMini
βββ lib/ # Reusable C++ Libraries
β βββ TreelTPMS/ # Standalone C++ Treel TPMS BLE Library
β βββ TreelTPMS.h # Zero-allocation high performance BLE receiver API
β βββ TreelTPMS.cpp # AES-128 & iBeacon decoder implementation
β βββ examples/
β βββ BasicScanner/ # Standalone minimal Arduino example
βββ src/ # ESP32 Modular Application
βββ esp32_tpms_webserver/ # Unified Firmware (Supports Standard ESP32 & ESP32-C3)
βββ Config.h # Pins (auto-detects ESP32 vs C3), Wi-Fi & sensor whitelist
βββ ConfigManager.h / .cpp # NVS Flash persistent settings manager
βββ Logger.h / Logger.cpp # Thread-safe event logging ring buffer
βββ DisplayManager.h / .cpp # Unified facade for display drivers
βββ DisplayDriverST7789.h/.cpp # 2.0" SPI TFT driver (320x240 GMT020-02)
βββ DisplayDriverOLED.h / .cpp # 128x64 I2C OLED driver (SSD1306 / SH1106)
βββ WebServerManager.h / .cpp # Web dashboard & REST API
βββ esp32_tpms_webserver.ino # Main entry point sketch
β‘ Quick Start Guide (ESP32 Firmware)
1. Required Arduino IDE Libraries
- Open Arduino IDE.
- Go to Tools -> Manage Libraries...
- Search for and install:
NimBLE-Arduino(by h2zero) β Required for BLE scanning.Adafruit ST7735 and ST7789 Library(by Adafruit) β Required for ST7789 2.0" 320x240 TFT displays (DISPLAY_TYPE_ST7789).Adafruit GFX Library(by Adafruit) β Required graphics core library for Adafruit displays.U8g2(by Oliver Kraus) β Required for I2C OLED displays (SSD1306 / SH1106).
2. Select Firmware & Configure Settings
Open src/esp32_tpms_webserver/esp32_tpms_webserver.ino.
[!IMPORTANT] Arduino IDE Partition Setting (Required for ESP32-C3 SuperMini): When compiling for ESP32-C3 SuperMini, the default partition scheme reserves only 1.25 MB for program storage, which can trigger a
text section exceeds available spacecompilation error.How to configure in Arduino IDE:
- Go to Tools $\rightarrow$ Partition Scheme
- Change from Default 4MB with spiffs to either:
Huge APP (3MB No OTA/1MB SPIFFS)(Recommended)Minimal SPIFFS (1.9MB APP with OTA)This expands program flash storage from 1.25 MB to 1.9 MB β 3.0 MB.
βοΈ Central Configuration Guide (Config.h)
All user settings, units, alert thresholds, hardware pins, and network parameters are centralized in src/esp32_tpms_webserver/Config.h.
| Configuration Option | Default Value | Description |
|---|---|---|
DISPLAY_TYPE |
DISPLAY_TYPE_ST7789 |
Select display: DISPLAY_TYPE_ST7789 (2.0" ST7789V SPI TFT), DISPLAY_TYPE_SH1106 (1.3" OLED), DISPLAY_TYPE_SSD1306 (0.96" OLED), DISPLAY_TYPE_NONE (Headless) |
ENABLE_WEBSERVER |
true |
Set to false to disable Wi-Fi and Web Server (pure ultra-low-power BLE mode) |
ENABLE_DEMO_MODE |
false |
Set to true to test Display & Web Dashboard with simulated dummy values & warnings |
DISPLAY_PRESSURE_UNIT |
UNIT_PSI |
Select pressure unit: UNIT_PSI (PSI), UNIT_BAR (Bar), or UNIT_KPA (kPa) |
DISPLAY_TEMP_UNIT |
UNIT_CELSIUS |
Select temperature unit: UNIT_CELSIUS (Β°C) or UNIT_FAHRENHEIT (Β°F) |
ALERT_MIN_PSI |
26.0f |
Low pressure warning threshold (PSI) |
ALERT_MAX_PSI |
40.0f |
High pressure warning threshold (PSI) |
ALERT_MAX_TEMP_C |
70.0f |
High temperature warning threshold (Β°C) |
ALERT_MIN_BATT |
15 |
Low battery percentage warning threshold (%) |
WIFI_SSID / WIFI_PASS |
"Your_WiFi_SSID" |
Your home or vehicle Wi-Fi router credentials |
AP_SSID / AP_PASS |
"ESP32_TPMS_..." |
SoftAP fallback SSID and Password |
SENSOR_MACS |
{"D2:58...", ...} |
Whitelist of your 4 TPMS sensor MAC addresses |
π How to Find & Configure Your TPMS Sensor MAC Addresses
[!IMPORTANT] The MAC addresses included in the source code are sample MAC addresses. You MUST update them with your own 4 TPMS sensor MAC addresses for the receiver to match and display readings for your specific tires.
Step 1: Finding Your Sensor MAC Addresses
- Open the official JK Tyre SMART TYRE app on your phone.
- Go to Settings $\rightarrow$ Sensor Debug.
- Note down the MAC address / Short ID (last 6 hex characters) listed for each of your 4 tires (FL, FR, RL, RR).
Step 2: Updating MAC Addresses in Config.h
Open src/esp32_tpms_webserver/Config.h and replace the values in SENSOR_MACS and SENSOR_SHORT_IDS:
// --- 4 Whitelisted TPMS Sensors ---
const char* const SENSOR_MACS[4] = {
"YOUR_FL_MAC", // FL: Front Left
"YOUR_FR_MAC", // FR: Front Right
"YOUR_RL_MAC", // RL: Rear Left
"YOUR_RR_MAC" // RR: Rear Right
};
const char* const SENSOR_SHORT_IDS[4] = {
"FL_ID", // FL Short ID (Last 6 hex digits of MAC)
"FR_ID", // FR Short ID
"RL_ID", // RL Short ID
"RR_ID" // RR Short ID
};
Step 3: Flash to ESP32
- Connect your ESP32 board via USB.
- Select your Board under Tools -> Board (e.g.
ESP32 Dev ModuleorESP32C3 Dev Module). - Click Upload.
Step 4: Access Live Web Dashboard
- Open Serial Monitor at 115200 baud to view boot logs and IP address.
- Open a web browser on your phone, tablet, or PC:
- Connected to Wi-Fi: Go to
http://<ESP32_IP>(e.g.http://192.168.1.100). - Access Point Fallback Mode: Connect your phone Wi-Fi to
ESP32_TPMS_Dashboard(password:12345678), then navigate tohttp://192.168.4.1.
- Connected to Wi-Fi: Go to
π Hardware Wiring Tables
1. 2.0 Inch TFT Color LCD Display SPI Module | Robu.in Wiring (GMT020-02 / 2.0TFTSPI VER:1.3)
| Module Pin Label | Standard ESP32 (DevKit) | ESP32-C3 SuperMini | Description |
|---|---|---|---|
| Pin 1: CS | GPIO 5 | GPIO 7 | SPI Chip Select |
| Pin 2: DC | GPIO 16 | GPIO 3 | Register Select / Data-Command |
| Pin 3: RST | GPIO 17 | GPIO 2 | Display Hardware Reset |
| Pin 4: SDA | GPIO 23 (VSPI MOSI) | GPIO 6 | SPI Data Input (MOSI) |
| Pin 5: SCL | GPIO 18 (VSPI SCK) | GPIO 4 | SPI Clock Input (SCK) |
| Pin 6: VCC | 3.3V / 5V | 3.3V / 5V | Power Supply (3.3V to 5V input support) |
| Pin 7: GND | GND | GND | Ground |
Note: The GMT020-02 module features an on-board Q1 backlight transistor powered directly by VCC.
2. 1.3" / 0.96" I2C OLED Display Module Wiring
| OLED Pin | Standard ESP32 (DevKit) | ESP32-C3 SuperMini |
|---|---|---|
| VCC | 3.3V | 3.3V |
| GND | GND | GND |
| SCL | GPIO 27 | GPIO 9 |
| SDA | GPIO 14 | GPIO 8 |
For dedicated ESP32-C3 SuperMini setup guide, see ESP32-C3 SuperMini Setup Guide.
π Detailed Documentation Links
βοΈ License & Disclaimer
This project is licensed under the MIT License β see the LICENSE file for details.
Disclaimer: This project is an open-source software implementation created for interoperability, educational, and DIY automotive enthusiast purposes. TREEL and JK Tyre are trademarks of their respective owners.