Using I2C relay boards to control large pumps, solenoid valves, and motorized ball valves for professional irrigation systems. This setup goes beyond the onboard pump limitations to handle serious watering needs.
- GrowMax board from opensensor.io
- Raspberry Pi Pico or Pico W (WiFi recommended for monitoring)
- I2C Relay Board (4 or 8 channel)
- High-power pumps or solenoid valves (>200mA)
- Motorized ball valves (optional, for auto-refill)
- External power supply for pumps/valves (12V/24V typical)
- Water level sensors (critical for safety)
- OLED Display (SSD1327 or SH1107)
- Display activation sensor (PIR, capacitive touch, or button)
- Large water reservoir
- Professional tubing and fittings
- Flow meters (recommended)
- Pressure relief valves
- Manual shutoff valves
- Overflow protection
When using motorized ball valves for auto-refill systems:
- YOU ARE RESPONSIBLE for any over-watering or flooding
- OpenSensor.io is NOT responsible for water damage
- Always use multiple safety measures (flow meters, timers, overflow protection)
- Test thoroughly before leaving unattended
- Consider insurance implications of automated water systems
Create this config.py file on your device:
import machine
# Hardware Configuration
GROWMAX_MCU = "RP2040"
# Soil Moisture & Watering - Conservative thresholds for high-power system
SOIL_WET_THRESHOLD = [
12, # Position 1: Large vegetable plants
15, # Position 2: Fruit trees (drier)
10, # Position 3: Flower beds
18, # Position 4: Drought-tolerant plants
12, # Position 5: Herb garden
14, # Position 6: Shrubs
16, # Position 7: Cacti/succulents
11 # Position 8: Lawn area
]
# IMPORTANT: Disable onboard pumps when using relay board
PUMP_WHEN_DRY = False # Safety: only pump when water detected
PUMP_CYCLE_DURATION = 60 # Longer cycles for larger areas
# Water Level Safety - CRITICAL for high-power systems
WATER_SENSOR_LOW_ENABLED = True
WATER_SENSOR_LOW = 22 # Primary water level sensor
WATER_SENSOR_HIGH_ENABLED = False
WATER_SENSOR_HIGH = 21
# I2C Relay Board Configuration
RELAY_BOARD_ENABLED = True
RELAY_BOARD_I2C_CHANNEL = 0 # QWIIC_I2C0
RELAY_BOARD_NUM_RELAYS = 8 # 8-channel relay board
RELAY_BOARD_I2C_ADDRESS = 0x27
# Auto-Refill with Motorized Ball Valve (USE WITH EXTREME CAUTION)
AUTO_REFILL_RELAY_POSITION = 8 # Relay 8 controls motorized ball valve
AUTO_REFILL_DURATION = 30 # Conservative 30-second refill cycles
# Environmental Sensors
ADAFRUIT_SCD4X_ENABLED = False # Focus on core irrigation functionality
ATLAS_PH_METER_ENABLED = False
# Display Configuration with Multiple Activation Options
DISPLAY = "SSD1327_I2C" # 128x128 grayscale OLED
DISPLAY_I2C_CHANNEL = 1 # QWIIC_I2C1
DISPLAY_I2C_ADDRESS = None # Auto-detect
# Display Activation Options (choose one):
# Option 1: PIR Motion Sensor
DISPLAY_SWITCH = 15 # GPIO pin for PIR sensor
DISPLAY_SWITCH_CLASS = "MotionSensor"
DISPLAY_SWITCH_DURATION_MS = 20000 # 20 seconds
# Option 2: Capacitive Touch Sensor (uncomment to use)
# DISPLAY_SWITCH = 16 # GPIO pin for touch sensor
# DISPLAY_SWITCH_CLASS = None # Direct pin reading
# DISPLAY_SWITCH_DURATION_MS = 15000
# DISPLAY_SWITCH_PULL = None
# DISPLAY_SWITCH_TRIGGER = machine.Pin.IRQ_RISING
# Option 3: Physical Button (uncomment to use)
# DISPLAY_SWITCH = 17 # GPIO pin for button
# DISPLAY_SWITCH_CLASS = None # Direct pin reading
# DISPLAY_SWITCH_DURATION_MS = 10000
# DISPLAY_SWITCH_PULL = machine.Pin.PULL_UP
# DISPLAY_SWITCH_TRIGGER = machine.Pin.IRQ_FALLING
DISPLAY_SWITCH_PULL = None
DISPLAY_SWITCH_TRIGGER = machine.Pin.IRQ_FALLING | machine.Pin.IRQ_RISING
# WiFi Configuration (recommended for monitoring)
WIFI_ENABLED = True
WIFI_SSID = "YourIrrigationNetwork"
WIFI_PASSWORD = "YourPassword"
# Cloud Integration for Remote Monitoring
OPEN_SENSOR_COLLECT_DATA = True
OPEN_SENSOR_API_KEY = "your-api-key"
DEVICE_NAME = "High-Power-Irrigation"
OPEN_SENSOR_RETRIEVE_COMMANDS = False # Set True for remote control# Suggested relay assignments:
# Relay 1: Zone 1 irrigation (vegetable garden)
# Relay 2: Zone 2 irrigation (fruit trees)
# Relay 3: Zone 3 irrigation (flower beds)
# Relay 4: Zone 4 irrigation (drought-tolerant area)
# Relay 5: Zone 5 irrigation (herb garden)
# Relay 6: Zone 6 irrigation (shrubs)
# Relay 7: Zone 7 irrigation (specialty plants)
# Relay 8: Auto-refill motorized ball valve- Relay Logic: 3.3V from GrowMax board (via I2C)
- Relay Coils: May need 5V external supply
- Controlled Equipment: 12V/24V separate supply
- Isolation: Relays provide electrical isolation for safety
- Connect I2C: Use QWIIC connector to relay board
- Power relay board: May need external 5V supply
- Set I2C address: Check jumpers/switches on relay board
- Solenoid Valves: Connect to relay NO (Normally Open) contacts
- Motorized Ball Valve: Connect to dedicated relay (Relay 8)
- Power Supplies: Separate 12V/24V supply for valves
- Fusing: Add appropriate fuses for each circuit
Choose your preferred activation method:
- Connection: GPIO 15, 3.3V, GND
- Placement: Near display for easy activation
- Sensitivity: Adjust potentiometer as needed
- Connection: GPIO 16, 3.3V, GND
- Mounting: Behind non-conductive surface
- Sensitivity: Adjustable via onboard controls
- Connection: GPIO 17, GND (with internal pull-up)
- Type: Momentary push button
- Mounting: Weatherproof enclosure recommended
- Water Level Sensors: Multiple sensors recommended
- Flow Meters: Monitor actual water usage
- Manual Overrides: Physical shutoff valves
- Overflow Protection: Drainage and alarms
# Auto-refill settings (USE WITH CAUTION)
AUTO_REFILL_RELAY_POSITION = 8 # Dedicated relay for ball valve
AUTO_REFILL_DURATION = 30 # Conservative duration
# Safety considerations:
# - Start with very short durations (10-15 seconds)
# - Monitor first several refill cycles
# - Install overflow protection
# - Consider flow meters for monitoring
# - Have manual shutoff readily accessible- Start Conservative: 10-15 second refill cycles initially
- Monitor Closely: Watch first 10+ refill cycles
- Install Overflow: Drainage and alarm systems
- Flow Monitoring: Track actual water usage
- Manual Backup: Always have manual shutoff available
- Insurance: Check coverage for automated water systems
DISPLAY_SWITCH = 15
DISPLAY_SWITCH_CLASS = "MotionSensor"
DISPLAY_SWITCH_DURATION_MS = 20000 # 20 secondsBest for: Outdoor installations, hands-free operation
DISPLAY_SWITCH = 16
DISPLAY_SWITCH_CLASS = None
DISPLAY_SWITCH_DURATION_MS = 15000
DISPLAY_SWITCH_TRIGGER = machine.Pin.IRQ_RISINGBest for: Clean installations, weather protection
DISPLAY_SWITCH = 17
DISPLAY_SWITCH_CLASS = None
DISPLAY_SWITCH_PULL = machine.Pin.PULL_UP
DISPLAY_SWITCH_TRIGGER = machine.Pin.IRQ_FALLINGBest for: Reliable operation, simple interface
The OLED shows:
- Zone Status: Which irrigation zones are active
- Moisture Levels: All 8 sensor readings
- Relay Status: Which relays are currently on
- Water Level: Reservoir status
- Auto-Refill: Last refill time and duration
Track via opensensor.io:
- Water usage per zone
- Irrigation frequency and duration
- System uptime and reliability
- Auto-refill activity and volumes
- Test relay activation: Verify each relay switches
- Check display: Ensure activation methods work
- Verify I2C communication: All devices respond
- Test safety systems: Water level sensors, overrides
- Manual valve testing: Operate each zone manually
- Short cycle testing: 5-10 second irrigation cycles
- Auto-refill testing: Very short refill cycles (5 seconds)
- Monitor for leaks: Check all connections
- Gradual duration increase: Slowly increase cycle times
- Monitor plant response: Adjust thresholds as needed
- Optimize scheduling: Based on plant and weather data
- Document settings: Record working configurations
- Visual inspection of all connections
- Water level verification
- Check for leaks or unusual operation
- Clean sensors and connections
- Test manual overrides
- Review usage data for anomalies
- Water leak detected: Immediate manual shutoff
- System malfunction: Disconnect power, manual mode
- Sensor failure: Switch to manual operation
- Power outage: Verify system state on restoration
- Group similar plants in same zones
- Adjust timing based on sun exposure
- Consider soil types when setting thresholds
- Monitor usage patterns via cloud data
- Adjust for weather conditions
- Use moisture data to optimize frequency
- Redundant sensors for critical measurements
- Regular maintenance schedules
- Backup power for critical systems
- No relay activation: Check I2C connections, power supply
- Intermittent operation: Verify relay board power requirements
- Wrong relay activating: Check address settings, wiring
- Valves not opening: Check power supply, relay contacts
- Partial operation: Verify voltage requirements
- Overheating: Check current ratings, add cooling
- Continuous refill: Check water level sensor, duration settings
- No refill: Verify relay operation, valve power
- Overflow: Reduce duration, check overflow protection
- Greenhouse Monitoring - Add environmental sensors
- Smart Indoor Garden - Simpler WiFi setup
- Single Plant Setup - Start with basics
High-power irrigation systems can cause significant water damage if not properly installed and monitored. Users are solely responsible for:
- Proper installation and safety measures
- Adequate overflow protection and drainage
- Regular monitoring and maintenance
- Any water damage or flooding that may occur
OpenSensor.io provides the tools but assumes no responsibility for water damage, flooding, or other consequences of automated irrigation systems.
You now have a professional-grade irrigation system! 💪💧
Monitor closely, start conservatively, and always prioritize safety over convenience.