DEPLOYMENT.md - ESP32 Flash & Deployment Guide
Complete guide for flashing and deploying INVERTER-ESP firmware.
π οΈ Prerequisites
Hardware
- β CrowPanel ESP32 E-paper 2.9" HMI Display
- β USB-C cable (data-capable, not charge-only)
- β Computer with USB port (macOS, Linux, Windows)
Software
- β PlatformIO Core (CLI) or PlatformIO IDE (VS Code extension)
- β USB-to-UART drivers (CH340 or CP2102, usually auto-installed)
- β Python 3.7+ (for esptool)
π¦ Installation
Option 1: PlatformIO Core (CLI)
Option 2: PlatformIO IDE (VS Code)
- Install Visual Studio Code: https://code.visualstudio.com/
- Open VS Code β Extensions β Search "PlatformIO IDE"
- Install PlatformIO IDE extension
- Restart VS Code
π Build & Flash Firmware
Step 1: Clone/Navigate to Project
Step 2: Check platformio.ini
Verify platformio.ini configuration:
[env:crowpanel-esp32]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
upload_speed = 921600
lib_deps =
lvgl/lvgl@^9.0.0
zinggjm/GxEPD2@^1.5.0
bblanchon/ArduinoJson@^6.21.0
build_flags =
-D LV_CONF_INCLUDE_SIMPLE
-D BOARD_HAS_PSRAM
-D ARDUINO_USB_CDC_ON_BOOT=1
Step 3: Connect Hardware
- Connect ESP32 to computer via USB-C
- ESP32 should appear as serial device:
- macOS:
/dev/cu.usbserial-*or/dev/cu.SLAB_USBtoUART - Linux:
/dev/ttyUSB0or/dev/ttyACM0 - Windows:
COM3,COM4, etc.
Step 4: Build Firmware
Expected Output:
Processing crowpanel-esp32 (platform: espressif32; board: esp32-s3-devkitc-1; framework: arduino)
...
RAM: [== ] 18.2% (used 59532 bytes from 327680 bytes)
Flash: [==== ] 42.3% (used 1109269 bytes from 2621440 bytes)
β
Building .pio/build/crowpanel-esp32/firmware.bin
========================= [SUCCESS] Took 45.67 seconds =========================
Step 5: Flash to ESP32
# Upload firmware to ESP32
pio run --target upload
# Or use PlatformIO IDE: Click "Upload" button (arrow icon)
Expected Output:
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-builtin, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: /dev/cu.usbserial-0001
Uploading .pio/build/crowpanel-esp32/firmware.bin
esptool.py v4.5.1
...
Writing at 0x00010000... (100%)
Wrote 1109280 bytes (685432 compressed) at 0x00010000 in 12.3 seconds
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
========================= [SUCCESS] Took 18.45 seconds =========================
Step 6: Monitor Serial Output
# Open serial monitor
pio device monitor
# Or use PlatformIO IDE: Click "Serial Monitor" button (plug icon)
Expected Output:
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
...
π INVERTER-ESP Starting...
π‘ WiFi: Connecting to HomeNetwork...
β
WiFi: Connected! IP: 192.168.1.100
π Display: E-Paper initialized (296x128)
π Buttons: Initialized (3 buttons)
π€ API: Testing connection...
β
API: Connected to SolarLog API
π Starting main loop...
π§ First-Time Configuration
WiFi Provisioning
Option 1: Hard-coded (Development)
Edit firmware/src/config.h:
Option 2: SmartConfig (Production)
- ESP32 starts in AP mode if no WiFi config
- Connect phone to ESP32 AP:
INVERTER-ESP-SETUP - Open browser β
http://192.168.4.1 - Enter WiFi SSID & password
- ESP32 saves to NVS and reboots
Option 3: Serial Configuration
# Send commands via serial monitor
wifi:set:ssid:YourNetwork
wifi:set:pass:YourPassword
wifi:save
wifi:connect
API Key Configuration
Edit firmware/src/config.h:
Or use serial commands:
π§ͺ Testing & Verification
1. Display Test
Press Button 3 (Action) to force E-Paper refresh.
Expected: Display shows dashboard with: - Current power (W) - Today's energy (kWh) - WiFi status icon - Timestamp
2. Network Test
Check serial monitor for:
3. Button Test
- Button 1 (Next): Cycle to next screen
- Button 2 (Previous): Cycle to previous screen
- Button 3 (Action): Refresh current screen
4. Deep Sleep Test
Wait for next update cycle (5 min default).
Expected Serial Output:
π€ Entering deep sleep for 300 seconds...
(ESP32 goes to sleep, current drops to ~10Β΅A)
--- 5 minutes later ---
ESP-ROM:esp32s3-20210327
π INVERTER-ESP Waking from deep sleep...
π€ API: Sending cached data...
β
API: POST success
π€ Entering deep sleep for 300 seconds...
π Troubleshooting
Issue: Port not detected
Symptoms:
Solutions:
1. Check USB cable is data-capable (not charge-only)
2. Install USB-UART drivers:
- macOS: brew install --cask silicon-labs-vcp-driver
- Linux: Usually pre-installed (CH341 driver)
- Windows: Download from Silicon Labs or WCH website
3. Check device manager / ls /dev/tty*
4. Try different USB port
5. Press Boot button (GPIO0) while connecting
Issue: Upload fails "Failed to connect"
Symptoms:
Solutions:
1. Enter bootloader mode manually:
- Hold Boot button (GPIO0)
- Press Reset button briefly
- Release Boot button
- Retry upload
2. Check USB cable connection
3. Reduce upload speed in platformio.ini:
Issue: Display not updating
Symptoms: E-Paper shows blank screen or old content
Solutions: 1. Check SPI pin connections (see HARDWARE.md) 2. Enable debug logs:
3. Test E-Paper driver: 4. Verify E-Paper BUSY pin (GPIO7) is not stuck HIGHIssue: WiFi connection fails
Symptoms:
Solutions: 1. Verify SSID & password are correct 2. Check router supports 2.4GHz (ESP32 doesn't support 5GHz) 3. Move ESP32 closer to router (check RSSI) 4. Disable WiFi power saving:
5. Increase connection timeout:Issue: API upload fails (401 Unauthorized)
Symptoms:
Solutions: 1. Verify API key is correct 2. Check API endpoint URL 3. Test with curl:
curl -X POST https://solarlog-api.karma.organic/api/v1/inverters/inv-001/data \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"power_w":3500}'
Issue: Deep sleep not working
Symptoms: ESP32 stays awake, battery drains fast
Solutions: 1. Verify deep sleep call:
2. Check USB connection (USB keeps ESP32 powered) 3. Check all peripherals are powered down before sleep 4. Verify wake stub is configured:π OTA Updates (Over-The-Air)
Enable OTA in platformio.ini
Flash via OTA
Advantages: - No physical access needed - Update devices in the field - Faster than serial upload
Requirements: - ESP32 connected to same WiFi network - OTA handler implemented in firmware
π Firmware Size Optimization
Current Build Stats
Optimization Tips
-
Disable unused LVGL widgets:
-
Use monochrome only (1-bit color):
-
Reduce LVGL buffer size:
-
Enable compiler optimizations:
π Backup & Restore
Backup Current Firmware
Restore Firmware
π Support
- PlatformIO Docs: https://docs.platformio.org/
- ESP32-S3 Docs: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/
- Elecrow Wiki: https://www.elecrow.com/wiki/CrowPanel_ESP32_E-paper_2.9-inch_HMI_Display.html
Last Updated: 2025-10-23
Firmware Version: 0.1.0-alpha
PlatformIO Version: 6.1+