A WiFi-connected smart home display system built on ESP32 that shows real-time sensor data including renewable energy metrics, electricity prices, weather data, and more on a 320x240 TFT display.
- Real-time Data Display: Shows comprehensive energy and environmental data:
- π± Renewable energy share percentage with status indicators
- π° Current electricity price + Day-Ahead market prices
- β‘ PV generation with intelligent energy distribution visualization
- π House battery and car charging levels
- π Home consumption and wallbox power monitoring
- π‘οΈ Water and outdoor temperature readings
- π Stock prices with trend analysis and percentage changes
- Touch Navigation: Tap any sensor box to access detailed subpages
- π± Renewable Energy Details: Γkostrom analysis with 24h price charts
- π° Price Analysis: Day-Ahead electricity prices with hourly breakdown
- π Charging Status: Battery levels for house storage and car
- β‘ Consumption Monitor: Home usage and wallbox power details
- βοΈ Settings: Touch calibration and system information
- Segmented Progress Bars: PV energy distribution shows:
- π’ Green: Power flowing to car/wallbox
- π΅ Blue: Power charging house battery
- π΄ Red: Power fed back to grid
- Bidirectional Energy Flow: Visual representation of grid import/export
- Real-time Power Management: Smart energy routing visualization
- MQTT Integration: Comprehensive IoT connectivity with 15+ topics
- WiFi Connectivity: Robust auto-reconnection with signal strength display
- Anti-Burn-in Protection: Intelligent pixel shifting to preserve display
- OTA Updates: Seamless over-the-air firmware updates
- Memory Management: Advanced heap monitoring with automatic cleanup
- Performance Optimization: Selective rendering and change detection
- ESP32 Development Board JC2432W328
- ST7789 320x240 TFT Display
- LDR (Light Dependent Resistor) for ambient light detection
- Resistors and wiring as per schematic
Component | ESP32 Pin |
---|---|
TFT MOSI | 13 |
TFT SCLK | 14 |
TFT CS | 15 |
TFT DC | 2 |
TFT RST | Not connected |
TFT BL | 27 |
LDR | 34 |
- PlatformIO IDE or CLI
- ESP32 Arduino Framework
-
Clone the repository
git clone <repository-url> cd Multidisplay_ESP32_Rev2
-
Configure your credentials
cp config_template.h src/config_secrets.h
Edit
src/config_secrets.h
with your actual:- WiFi SSID and password
- MQTT server IP address
- MQTT credentials (if required)
- OTA update password
Note: If you skip this step, the build will fail with a clear error message explaining what to do.
-
Build and upload
pio run --target upload
-
Monitor serial output (optional)
pio run --target monitor
The system subscribes to the following MQTT topics (configured in config.h
):
home/PV/Share_renewable
- Renewable energy percentagehome/PV/EnergyPrice
- Current electricity pricehome/PV/EnergyPriceDayAhead
- Day-Ahead market prices (24h JSON data)home/stocks/CL2PACurr
- Stock price (current)home/stocks/CL2PARef
- Stock price (reference)home/stocks/CL2PAPrevClose
- Stock price (previous close)home/Weather/OutdoorTemperature
- Outdoor temperaturehome/Heating/WaterTemperature
- Water temperature
home/PV/PVCurrentPower
- Current PV generationhome/PV/GridCurrentPower
- Grid power (import/export)home/PV/LoadCurrentPower
- Total house consumptionhome/PV/StorageCurrentPower
- Battery charging/discharginghome/PV/WallboxPower
- Electric car charging powerhome/PV/chargingLevel
- House battery charge level (%)
The 320x240 display features a sophisticated 3x3 grid layout:
- Row 1: Market/Financial data (Renewable %, Price, Stock)
- Row 2: Power/Charge data (Battery %, Consumption, PV Generation)
- Row 3: Environmental data (Outdoor temp, Water temp, Settings)
- Status Bar: WiFi/MQTT indicators, current time
- System Info: RAM usage, CPU load, uptime, LDR sensor
- Touch-sensitive sensor boxes with color-coded status indicators
- Progress bars with intelligent scaling and color coding
- Trend arrows showing value changes over time
- Anti-burn-in content shifting every 15 minutes
- main.cpp: System initialization and main loop
- config.h: Central configuration with namespaced constants
- display.h/cpp: TFT display rendering and UI components
- network.h/cpp: WiFi and MQTT connectivity management
- sensors.h/cpp: Sensor data processing and validation
- utils.h/cpp: Utility functions and helpers
- system.h/cpp: System status and memory management
- ota.h/cpp: Over-the-air update functionality
- Change Detection: Prevents unnecessary screen redraws
- Memory Monitoring: Continuous RAM usage tracking
- Error Handling: Comprehensive error detection and recovery
- Modular Design: Clean separation of concerns
- Performance Optimization: Efficient rendering and data processing
# Build project
pio run
# Upload to device
pio run --target upload
# Monitor serial output
pio run --target monitor
# Clean build files
pio run --target clean
# Build and upload with monitoring
pio run --target upload --target monitor
- Namespaced constants for configuration
- Comprehensive error handling with try-catch blocks
- Memory-efficient string handling
- Modular, maintainable architecture
- Detailed serial logging for debugging
-
WiFi Connection Failed
- Check SSID and password in
config_secrets.h
- Verify WiFi network is 2.4GHz (ESP32 doesn't support 5GHz)
- Check SSID and password in
-
MQTT Connection Issues
- Verify MQTT server IP address
- Check if MQTT broker is running and accessible
- Ensure firewall allows MQTT traffic (port 1883)
-
Display Issues
- Check TFT wiring connections
- Verify pin assignments match your hardware
- Ensure adequate power supply (3.3V/5V)
-
Memory Warnings
- Normal operation should show >50KB free RAM
- Consider reducing sensor update frequency if persistent
Enable serial monitoring to view:
- System startup information
- WiFi connection status
- MQTT message reception
- Memory usage statistics
- Error messages and warnings
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Built with PlatformIO
- Uses TFT_eSPI library for display
- MQTT communication via PubSubClient
- JSON parsing with ArduinoJson