LoRA Power Switch Control System ¶
Project Overview ¶
Two-board LoRA system to control a 240V water pump with programmable scheduling and override capabilities.
Hardware Specifications ¶
ESP32 Boards ¶
- 2x LoRa32 V2.1 868MHz ESP32 boards
- All AC powered (no battery requirements)
Switch Board (Remote - Water Pump Location) ¶
Location: 41°52'41.3"N 12°32'25.6"E (street level)
Components:
- ESP32 LoRa32 V2.1
- 40A SSR (240V AC rated for motor loads)
- Snubber circuit (RC: 0.1µF + 100Ω)
- 10A fuse
- IP65 enclosure
- 5V power supply
Home Board (Gateway) ¶
Location: 41°52'45.4"N 12°32'22.9"E (~25-30m height)
Components:
- ESP32 LoRa32 V2.1
- Standard enclosure
Distance: ~150m (well within LoRA range)
System Architecture ¶
WiFi Network → Home Board (Gateway) → LoRA → Switch Board → SSR → Water Pump Circuit
↑
Web Interface (AsyncWebServer)
Software Architecture ¶
Switch Board Firmware ¶
- LoRA receiver (868MHz)
- Schedule storage (LittleFS)
- Time sync via LoRA commands from home board
- SSR control via GPIO pin
- Failsafe: Circuit CLOSED if communication lost >30s
- Heartbeat transmission every 3s
- Failure Mode: If LoRA fails, pump circuit stays closed (pump available)
Home Board Firmware ¶
- LoRA transceiver (868MHz)
- WiFi client connecting to existing network (DHCP)
- Static IP assigned by router
- NTP client for accurate time
- AsyncWebServer for web interface
- Schedule management and storage
- Command acknowledgment system
- Real-time status display
Communication Protocol ¶
Message Types ¶
CMD_ON_OVERRIDE- Manual override ON until next scheduleCMD_OFF_OVERRIDE- Manual override OFF until next scheduleCMD_ALWAYS_ON- Emergency always ONCMD_ALWAYS_OFF- Emergency always OFFCMD_SCHEDULE_UPDATE- Update stored scheduleCMD_TIME_SYNC- Sync time from home boardSTATUS_REQUEST- Request current statusSTATUS_RESPONSE- Current pump state, next event, signal strengthHEARTBEAT- Every 3s from switch board
Reliable Delivery ¶
- Sequence numbers on all commands
- Acknowledgment packets required
- Automatic retry (3 attempts)
- 30s timeout for communication failure detection
Scheduling System ¶
Default Schedule ¶
- ON: 06:30 (circuit closed - pump available)
- OFF: 22:00 (circuit open - pump disabled)
- DST Aware: Automatic daylight saving time adjustment
- Initial Config: Single daily schedule (no weekday/weekend differentiation)
Features ¶
- Multiple schedule support (future: seasonal adjustments)
- Override until next scheduled event
- Emergency always-on/always-off modes
- Schedule storage in LittleFS on both boards
Web Interface ¶
Requirements ¶
- Responsive design (no mobile app needed)
- No authentication (handled by reverse proxy basic auth)
- Real-time status indicators
- Schedule configuration interface
- Manual override controls
- Emergency controls
Technology Stack ¶
- AsyncWebServer on ESP32
- HTML/CSS/JavaScript served from SPIFFS/LittleFS
- WebSocket for real-time updates
- JSON API for configuration
Physical Implementation ¶
Water Pump Control ¶
- Pump has built-in pressure control
- System only opens/closes electrical circuit
- SSR handles 240V AC switching
- No soft start/stop required
Safety & Protection ¶
- Proper fusing and snubber circuits
- IP65 enclosure for outdoor switch board
- Failsafe defaults to circuit closed (pump available)
Development Plan ¶
Phase 1: Basic Communication ¶
- Basic LoRA communication between boards
- Message protocol implementation
- Reliable delivery with ACK system
Phase 2: Core Functionality ¶
- Time synchronization (NTP → Home Board → Switch Board)
- Schedule storage and management
- SSR control implementation
Phase 3: Web Interface ¶
- AsyncWebServer setup
- Schedule configuration UI
- Real-time status display
- Manual override controls
Phase 4: Integration & Testing ¶
- Hardware integration
- End-to-end testing
- Failsafe behavior verification
- Range and reliability testing
Future Enhancements (Docker Services) ¶
- Data logging container
- Schedule backup service
- Historical monitoring dashboard
- REST API gateway for external control
Network Configuration ¶
- Home board connects to existing WiFi
- DHCP with router-assigned static IP
- Standard HTTP port (80) for web interface
- Reverse proxy handles authentication
File Structure ¶
/
├── switch_board/ # Remote switch board firmware
├── home_board/ # Home gateway board firmware
├── web_interface/ # HTML/CSS/JS for web UI
├── docs/ # Documentation
└── PROJECT_SPECS.md # This file
Comments
Please login to leave a comment.
No comments yet. Be the first to comment!