A Rust embedded application for ESP32 that fetches room data from an API and displays it on a connected e-ink display.
- 🌐 WiFi connectivity with automatic reconnection
- 📡 HTTP API data fetching with TLS support
- 🖥️ E-ink (e-paper) display support (Waveshare 2.13" v2)
- ⚡ Deep sleep mode for power efficiency (10-minute intervals)
- 🛡️ Robust error handling with graceful degradation
- 📝 Clear error messages displayed on screen
- ESP32 microcontroller
- Waveshare 2.13" e-ink display (v2)
- Proper wiring for SPI communication (see pin configuration below)
| Function | GPIO Pin |
|---|---|
| SPI SCK | GPIO 18 |
| SPI MOSI | GPIO 23 |
| SPI CS | GPIO 33 |
| EPD BUSY | GPIO 22 |
| EPD DC | GPIO 17 |
| EPD RST | GPIO 16 |
| LED | GPIO 2 |
Copy the example environment file:
cp .env.example .envEdit .env and set your values:
SSID="YourNetworkName"
PASSWORD="YourNetworkPassword"
API_URL="http://192.168.0.30/api/current".env file with real credentials!
# Build the project
cargo build --release
# Flash to ESP32
cargo espflash flash --release --monitorsrc/
├── bin/
│ └── main.rs # Main application entry point
├── api.rs # Network and API communication
├── config.rs # Configuration constants
├── display.rs # E-ink display functions
├── error.rs # Error types and handling
└── lib.rs # Library root
All configuration values are centralized in src/config.rs:
- WiFi: SSID, password, scan settings
- API: URL, buffer sizes, room limits
- Pins: GPIO assignments
- SPI: Bus frequency and mode
- Display: Layout, margins, line spacing
- Power: Deep sleep duration
- Network: Retry delays, timeouts
The device operates in a cycle:
- Wake from deep sleep
- Initialize hardware (SPI, display)
- Connect to WiFi
- Fetch room data from API
- Display data on e-ink screen (or error message)
- Enter deep sleep for 10 minutes
- Repeat
The application includes comprehensive error handling:
- Network failures are logged and displayed
- API errors show on the screen before sleep
- Display errors are logged but don't prevent operation
- WiFi connection errors trigger automatic retry
- The device continues to sleep cycle even on errors
Key dependencies include:
esp-hal- ESP32 hardware abstractionembassy- Async runtime for embeddedepd-waveshare- E-ink display driverreqwless- HTTP clientembedded-graphics- Graphics primitives
This project uses the xtensa-esp32-none-elf target. Make sure you have:
- Rust nightly toolchain
- ESP32 toolchain installed
espflashfor flashing
[Add your license here]
[Add contribution guidelines here]