I2C Sensor Configuration (Raspberry Pi)

I2C sensors are used to gather pressure, soil moisture, outside conditions, light intensity and more over the I2C bus. I2C sensors and components are nice because they can run multiple devices on one bus reducing the number of needed GPIO pins.

To add an I2C sensor to MudPi you will put a sensor configuration object in the sensors array just like general sensors configuration. The minimum required options in a sensor config are type, address, and name. The main difference between I2C sensors and general ones is that I2C sensors have an address while general senors use a pin.

{
    "workers":[{
        "type":"sensor",
        "sensors": [
            {
                "type":"Bme680",
                "address": 119,
                "name":"Barometer"
            }
        ]
    }]
}

Settings

OptionTypeRequiredDescription
type[String]YesType of sensor. Options: Bme680
address[Integer]NoI2C address on raspberry pi the sensor is connected to. Since JSON does not support hex strings this value must be an integer. Hint: run `int(0x77)` in python to convert a hex address into an integer.
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.

I2C Sensor Types (Raspberry Pi)

There are a number of sensors supported by default with MudPi for both the raspberry pi and arduino. You can find details about each sensor type under the sensors section in the docs.

TypeReturnsDescription
BME680[Boolean]Barometric sensor to take pressure, humidity, and temperatures.