Supported Devices
The Cannabis Grow Management System supports a wide range of IoT devices for sensor monitoring and automation control.
ESP32 Sensor Devices
Production-ready firmware for ESP32 devices with comprehensive sensor support and MQTT integration.
Hardware Specifications
- Board: ESP32-WROOM-32 (recommended) or compatible ESP32 development board
- WiFi: 2.4GHz WiFi connectivity with automatic reconnection
- Power: 5V USB or external power supply (200-500mA typical)
- GPIO: Multiple GPIO pins for sensor connections
Supported Sensors
DHT22/DHT11 Temperature & Humidity
Pin: GPIO 4 (configurable via config.h)
DHT22 Specifications:
- Temperature Range: -40°C to 80°C (-40°F to 176°F)
- Temperature Accuracy: ±0.5°C
- Humidity Range: 0% to 100% RH
- Humidity Accuracy: ±1% RH
- Sampling Rate: 0.5 Hz (one reading per 2 seconds)
- Operating Voltage: 3.3V - 5V
- Current Consumption: 1-2.5mA
DHT11 Specifications:
- Temperature Range: 0°C to 50°C (32°F to 122°F)
- Temperature Accuracy: ±2°C
- Humidity Range: 20% to 90% RH
- Humidity Accuracy: ±5% RH
- Sampling Rate: 1 Hz (one reading per second)
- Operating Voltage: 3.3V - 5V
- Current Consumption: 0.5-2.5mA
Connection: VCC → 3.3V, DATA → GPIO 4, GND → GND (with 10kΩ pull-up resistor between DATA and 3.3V)
Note: DHT22 is more accurate but more expensive. DHT11 is suitable for basic monitoring.
Soil Moisture Sensor (Analog)
Pin: GPIO 34 (ADC1_CH6, configurable via config.h)
Specifications:
- Operating Voltage: 3.3V - 5V
- Output: Analog voltage (0-3.3V)
- ADC Resolution: 12-bit (0-4095 values)
- Response Time: < 1 second
- Probe Material: Corrosion-resistant
- Requires dry/wet calibration for accurate percentage conversion
Calibration Values:
- Dry (air): ~4095 ADC value (0% moisture)
- Wet (water): ~1500 ADC value (100% moisture)
- Calibration stored in firmware configuration
Connection: VCC → 3.3V, OUT/AO → GPIO 34, GND → GND
Note: GPIO 34, 35, 36, and 39 are input-only pins (no pull-up/pull-down). These are part of ADC1 and ideal for analog sensors.
pH Sensor (Future Support)
pH sensors for nutrient solution monitoring (planned feature).
- pH Range: 0-14
- Accuracy: ±0.1 pH
- Requires calibration with buffer solutions
- Optimal range for cannabis: 6.0-7.0
EC/TDS Sensor (Future Support)
Electrical Conductivity sensors for nutrient concentration monitoring (planned feature).
- EC Range: 0-5.0 mS/cm
- TDS Range: 0-5000 ppm
- Temperature compensation included
- Optimal EC varies by growth phase
Firmware Features
- WiFi connectivity with exponential backoff reconnection
- MQTT communication for sensor data publishing and configuration updates
- OTA (Over-The-Air) firmware updates via HTTP
- Deep sleep mode for battery-powered operation
- Remote configuration via MQTT topics
- Periodic device health and status reporting
- Configurable sensor reading intervals
MQTT Topics
sensors/{growId}/{plantId}/data - Complete sensor payload
sensors/{growId}/{plantId}/temperature - Individual temperature reading
sensors/{growId}/{plantId}/humidity - Individual humidity reading
sensors/{growId}/{plantId}/soilMoisture - Soil moisture reading
devices/{deviceId}/status - Device status updates
devices/{deviceId}/config - Configuration updates (from server)
Getting Started
See the ESP32 Setup Guide for detailed wiring instructions and firmware installation.
ESP8266 Sensor Devices
Lightweight sensor nodes for cost-effective monitoring solutions. ESP8266 devices provide similar capabilities to ESP32 with lower power consumption and cost.
- WiFi connectivity (2.4GHz)
- MQTT communication
- OTA firmware updates
- Compatible with DHT22/DHT11 and analog sensors
- Lower power consumption than ESP32
Automation Controllers
Smart controllers for automated grow operations including lighting, watering, dosing, and climate control.
Light Controllers
Smart Light Controllers
Control grow lights with scheduling, dimming, and phase-based automation.
- On/off scheduling with cron expressions
- PWM dimming control (0-100%)
- Phase-based light schedules (18/6, 12/12, etc.)
- Sunrise/sunset simulation
Timer Relays
Simple on/off control for lights and other equipment.
Watering Systems
Water Pumps
Submersible pumps for automated watering with flow rate control.
- Pump control via MQTT commands
- Schedule-based watering
- Soil moisture-triggered watering
- Multi-zone watering support
Solenoid Valves
Precise water flow control for irrigation systems.
Dosing Systems
Peristaltic Pumps
Automated pH/EC adjustment with precise dosing control.
- pH target maintenance
- EC target maintenance
- Multi-reservoir support
- Safety limits and overflow protection
Climate Control
Smart Thermostats
Temperature-based control for heating and cooling systems.
Humidifiers/Dehumidifiers
Humidity control based on environmental readings.
Variable Speed Fans
Fan speed control based on temperature and humidity.
COâ‚‚ Controllers
Automated COâ‚‚ injection based on sensor readings.
Hardware Setup Guide
Complete hardware wiring guide for ESP32 sensor devices.
Pin Connections
DHT22/DHT11 Sensor
DHT22/DHT11 ESP32
─────────────────────────────────
VCC (Pin 1) → 3.3V
DATA (Pin 2) → GPIO 4
(with 10kΩ pull-up to 3.3V)
GND (Pin 3) → GND
Soil Moisture Sensor
Soil Moisture Sensor ESP32
─────────────────────────────────
VCC → 3.3V
GND → GND
OUT/AO → GPIO 34 (ADC1_CH6)
Power Supply
- USB Power: Connect ESP32 via USB cable (5V, 200-500mA typical)
- External Power: 5V DC via VIN pin or USB
- Battery Operation: 3.7V LiPo battery with proper regulation for 3.3V operation
Calibration
Soil Moisture Sensor
- Dry Calibration: Remove sensor from soil, let dry completely, read ADC value (~4095)
- Wet Calibration: Submerge sensor in water, read ADC value (~1500)
- Update Code: Set calibration values in firmware configuration
Over-The-Air (OTA) Updates
Update device firmware remotely without physical access to devices.
- HTTP-based firmware updates
- Version tracking and rollback support
- Deployment status monitoring
- Template-based firmware generation
- Device-specific configuration injection
See OTA Update Guide for detailed instructions.
Supported Device Types
The system supports registration and management of the following device types:
- ESP32: Full-featured sensor nodes with comprehensive capabilities
- ESP8266: Lightweight sensor nodes for cost-effective solutions
- Arduino: Custom Arduino-based devices with MQTT support
- Raspberry Pi: Raspberry Pi-based monitoring and control systems
- Other: Custom IoT devices with MQTT communication
MQTT Integration
All devices communicate via MQTT protocol for reliable, scalable IoT communication.
MQTT Broker
- Mosquitto MQTT broker
- Username/password authentication
- Topic-based message routing
- QoS levels for message reliability
Message Format
Sensor data is published in JSON format:
{
"deviceId": "esp32-001",
"timestamp": "2024-01-01T00:00:00Z",
"growId": "507f1f77bcf86cd799439011",
"plantId": "507f191e810c19729de860ea",
"metrics": {
"temperature": 72.5,
"humidity": 65.0,
"pH": 6.5,
"co2": 400,
"ec": 1.2,
"soilMoisture": 45
}
}