Documentation
Sensors
MudPi supports a variety of sensors to monitor your garden conditions in real time.
Supported Sensor Types
Soil Moisture
Capacitive and resistive sensors for measuring soil water content
Temperature
DHT11, DHT22, and DS18B20 temperature sensors
Humidity
DHT11 and DHT22 humidity readings
Rain Detection
Analog rain sensors for wet/dry detection
Light Intensity
LDR and BH1750 light sensors
Water Level
Float switches and ultrasonic distance sensors
Adding a Sensor
Sensors are defined in the sensors array of your configuration file. Each sensor requires a type, pin, and name:
{
"pin": 4,
"type": "soil_moisture",
"name": "Garden Bed Moisture",
"poll_interval": 30
}
Using Multiple Sensors
You can define as many sensors as your GPIO pins allow. Each sensor runs independently on its own polling interval:
Polling Intervals
The poll_interval defines how often (in seconds) the sensor is read. Lower values provide more frequent readings but consume more resources.
| Sensor Type | Recommended Interval | Notes |
|---|---|---|
| Soil Moisture | 30–60s | Soil conditions change slowly |
| Temperature | 30–120s | DHT22 minimum read interval is 2s |
| Rain | 5–15s | Faster detection for weather changes |
| Light | 60–300s | Light changes gradually throughout the day |
Reading Sensor Data
Sensor data is published to Redis and can be accessed via the API or the Solarbeam dashboard. Data includes the current value, timestamp, and sensor metadata.
redis-cli GET "mudpi:sensor:Garden Bed 1"