si7021

A wrapper module for reading values provided by Si7021 I2C Humidity and Temperature Sensor. This is the Integrated Circuit included in the insigh.io board.

Functions

si7021.get_reading(sda_pin, scl_pin, vcc_pin=None)

Returns the temperature and humidity, for given I2C SCL/SDA and VCC pins. If vcc_pin is defined it will first power on sensors and it will power off sensors at the end.

Assumes that the i2c address is: 0x40

from sensors import si7021
(temperature, temperature) = si7021.get_reading('P9', 'P10')
  • params
    • sda_pin: i2c SDA pin.
    • scl_pin: i2c SCL pin.
    • vcc_pin: (optional) the pin that controls the power to the sensors.
  • returns tuple (temperature, humidity)
    • temperature: float number with temperature in Celsius
    • humidity: float number with relative humidity
Based on [https://github.com/chrisbalmer/micropython-si7021].
Extensions: Added a wrapper function for getting directly the values