EasyManuals Logo

Adafruit Si7021 User Manual

Default Icon
18 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #14 background imageLoading...
Page #14 background image
boards.
Remember for non-express boards like the Trinket M0, Gemma M0, and Feather/Metro M0 basic you'll need to
manually install the necessary libraries from the bundle:
adafruit_si7021.mpy
adafruit_bus_device
You can also download the adafruit_si7021.mpy from its releases page on Github (https://adafru.it/BfW).
Before continuing make sure your board's lib folder or root filesystem has
the adafruit_si7021.mpy, and adafruit_bus_device files and folders copied over.
Next connect to the board's serial REPL (https://adafru.it/pMf)so you are at the CircuitPython >>> prompt.
Python Installation of Si7021 Library
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also
require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different,
and Linux changes often, please visit the CircuitPython on Linux guide to get your computer
ready (https://adafru.it/BSN)!
Once that's done, from your command line run the following command:
sudo pip3 install adafruit-circuitpython-si7021
If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use
CircuitPython on Python 2.x, it isn't supported!
CircuitPython & Python Usage
To demonstrate the usage of the sensor we'll initialize it and read the temperature and humidity from the board's
Python REPL. First run the following code to import the necessary modules and initialize the I2C bus:
Now you're ready to read values from the sensor using any of these properties:
temperature - The sensor temperature in degrees Celsius.
relative_humidity - The percent humidity as a value from 0 to 100%.
import board
import busio
import adafruit_si7021
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_si7021.SI7021(i2c)
print('Temperature: {} degrees C'.format(sensor.temperature))
print('Humidity: {}%'.format(sensor.relative_humidity))
© Adafruit Industries https://learn.adafruit.com/adafruit-si7021-temperature-plus-humidity-sensor Page 14 of 19

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Adafruit Si7021 and is the answer not in the manual?

Adafruit Si7021 Specifications

General IconGeneral
BrandAdafruit
ModelSi7021
CategoryAccessories
LanguageEnglish