Sensor Configuration (Raspberry Pi)

Sensors are used to gather climate info, soil moisture, water levels, light intensity and more. MudPi has support for a number of sensors out of the box and is easy to expand support to others.

To add a sensor to MudPi you will put a sensor configuration object in the sensors array. The minimum required options in a sensor config are type, pin, and name.

        "sensors": [
                "pin": 25,
                "name":"Weather Sensor"


type[String]YesType of sensor. Options: Float, Humidity
pin[Integer]YesGPIO pin number on raspberry pi the sensor is connected to.
name[String]YesName of the sensor. The name will be slugged and used as key to store in redis if a key is not specified.
key[String]NoKey to store value under in redis. Alphanumeric with underscores only. Must be valid redis key. If a key is not provided it will use the name converted to lowercase and spaces replaced with underscores.

Sensor Types (Raspberry Pi)

There are a number of sensors supported by default with MudPi for both the raspberry pi and arduino. The main limitation of the pi is digital GPIO only, that is why we use the arduinos. You can find details about each sensor type under the sensors section in the docs.

Float[Boolean]0 or 1 digital read of liquid level. If marked critical it will prevent pump from running until it returns 1 (true)
Humidity[Object]Take a digital read of humidity and temperature.

Custom Sensor Support

If you have a sensor you want to add support for you can do so by extending the main Sensor class in the library. When MudPi loads on boot it loops through the sensors and looks for a matching class to the sensor type. For example when a sensor with a type of Humidity is loaded, MudPi behind the scenes is looking for a HumiditySensor class that it will instantiate.