This is a CircuitPython driver for the SI7021 temperature and humidity sensor.
- Author(s): Radomir Dopieralski, Chris Balmer, Ian Grant
- Adafruit Si7021 Temperature & Humidity Sensor Breakout Board (Product ID: 3251)
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
A driver for the SI7021 temperature and humidity sensor.
Quickstart: Importing and using the SI7021 temperature and humidity sensor
Here is one way of importing the
SI7021class so you can use it with the name
si_sensor. First you will need to import the libraries to use the sensor
import busio import board import adafruit_si7021
Once this is done you can define your
busio.I2Cobject and define your sensor object
i2c = busio.I2C(board.SCL, board.SDA) si_sensor = adafruit_si7021.SI7021(i2c)
temperature = si_sensor.temperature relative_humidity = si_sensor.relative_humidity
A device identifier (model type) string.
The measured relative humidity in percent.
The device’s unique ID (serial number).
Starts a measurement.
Starts a measurement of either
TEMPERATUREdepending on the
whatargument. Returns immediately, and the result of the measurement can be retrieved with the
relative_humidityproperties. This way it will take much less time.
This can be useful if you want to start the measurement, but don’t want the call to block until the measurement is ready – for instance, when you are doing other things at the same time.
The measured temperature in degrees Celsius.