An ESP8266-based automated hydroponic system controller with web interface for managing water pumps, LED lighting, and automated scheduling.
- Motor Control: Water pump management with variable speed control (PWM)
- LED Control: Grow light automation with full on/off control
- Safety System: Mutual exclusion prevents motors and LEDs from running simultaneously
- L298N Integration: Dual H-bridge driver support for both motors and LED strips
- Modern UI: Responsive web interface with gradient design and card-based layout
- Real-time Control: Instant motor/LED on/off controls with visual feedback
- Speed Control: Variable motor speed adjustment (0-100%) via slider
- Status Monitoring: Live status updates with error handling
- Dual Intervals: Separate configurable intervals for motors and LEDs (1-1440 minutes)
- Smart Scheduling: Motors have priority over LEDs in automatic mode
- Conflict Resolution: Automatic switching prevents simultaneous operation
- WiFi Management: Built-in WiFi configuration with credential storage
- Access Point Mode: Fallback AP mode for initial setup
- EEPROM Storage: Persistent WiFi credentials storage
- CORS Support: Enhanced web performance with cross-origin resource sharing
- ESP8266 NodeMCU v2 (ESP-12E Module)
- L298N Motor Driver Module (Dual H-Bridge)
- Water Pump (12V DC recommended)
- LED Strip/Grow Lights (12V DC)
- 12V Power Supply (adequate for pump + LEDs)
ESP8266 D3 โ L298N IN1
ESP8266 D4 โ L298N IN2
ESP8266 D5 โ L298N ENA (PWM)
ESP8266 D1 โ L298N IN3
ESP8266 D2 โ L298N IN4
ESP8266 D6 โ L298N ENB (Enable)
12V Supply โ L298N VCC, Motor+, LED+
GND โ L298N GND, Motor-, LED-, ESP8266 GND
ESP8266 VIN โ 5V (or use separate 3.3V supply)
- PlatformIO installed
- ESP8266 board connected via USB
-
Clone the repository
git clone https://github.com/jarffs/hidroponic.git cd hidroponic -
Build and upload
platformio run --target upload
-
Monitor serial output
platformio device monitor
- Power on the ESP8266 - It will create a WiFi access point
- Connect to WiFi - Join "MotorControllerESP" network
- Access web interface - Navigate to
http://192.168.4.1 - Configure WiFi - Enter your home WiFi credentials
- System restart - Device will connect to your network
- Find new IP - Check serial monitor or router for assigned IP
- Local Network:
http://[ESP_IP_ADDRESS] - Setup Mode:
http://192.168.4.1
- Manual: On/Off buttons with immediate response
- Speed: Adjustable PWM control (0-100%)
- Interval: Configurable auto-cycling (default: 5 minutes)
- Manual: On/Off buttons with status feedback
- Interval: Separate auto-cycling (default: 10 minutes)
- Safety: Auto-disabled when motors are active
- WiFi Settings: Change network credentials
- Motor Interval: Set automatic pump cycles
- LED Interval: Configure lighting schedule
- Priority: Motors have priority over LEDs
- Auto-switching: System automatically turns off conflicting devices
- User Feedback: Web interface shows when auto-switching occurs
- Debug Logging: Serial output tracks all switching events
- Current Limiting: L298N provides overcurrent protection
- Safe Startup: All outputs disabled on boot
- Emergency Stop: Both devices can be turned off simultaneously
src/
โโโ main.cpp # Main program loop and setup
โโโ MotorControl.cpp/h # Motor control functions
โโโ LedControl.cpp/h # LED control functions
โโโ WebServerHandler.cpp/h # Web server and API endpoints
โโโ WiFiManager.cpp/h # WiFi connection management
โโโ EEPROMManager.cpp/h # Persistent storage functions
platformio.ini # Build configuration
README.md # This file
LICENSE # License information
motorInterval = 5 * 60 * 1000; // 5 minutes
ledInterval = 10 * 60 * 1000; // 10 minutes
motorSpeed = 1023; // Full speed (PWM)
serialSpeed = 115200; // Debug output- Modify intervals in
WebServerHandler.cpp - Adjust pin mappings in respective control files
- Change PWM ranges for different motor types
- Customize web interface in
handleRoot()function
Motors/LEDs not responding
- Verify L298N enable pins (D5/D6) are connected
- Check 12V power supply connections
- Monitor serial output for debug messages
Web interface not loading
- Confirm ESP8266 WiFi connection (check serial monitor)
- Try access point mode: connect to "MotorControllerESP"
- Verify IP address assignment
Automatic intervals not working
- Check serial monitor for timing messages
- Ensure intervals are set (default: 5min motors, 10min LEDs)
- Verify system isn't stuck in manual override
The system provides extensive serial logging:
DEBUG: Motors turned on - A1=HIGH, A2=LOW, ENA=1023
DEBUG: LED off - B1=LOW, B2=LOW, ENB=0
Web request: Motor ON
Motor interval set to 5 minutes
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike (CC BY-NC-SA).
- ESP8266 Arduino Core community
- PlatformIO development team
- L298N motor driver documentation contributors
- Platform: ESP8266 (Arduino Framework)
- Memory Usage: ~45% RAM, ~30% Flash
- Build Status: โ Compiled and tested
- Last Updated: August 2025
Happy Growing! ๐ฑ