Adafruit Si7021 Скачать руководство пользователя страница 14

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

Содержание Si7021

Страница 1: ...Adafruit Si7021 Temperature Humidity Sensor Created by lady ada Last updated on 2018 11 21 06 58 57 PM UTC...

Страница 2: ...t_Si7021 library Load Demo Library Reference Python CircuitPython CircuitPython Microcontroller Wiring Python Computer Wiring CircuitPython Installation of Si7021 Library Python Installation of Si7021...

Страница 3: ...perature Humidity Sensor the best way to prove the weatherman wrong This lovely sensor for Silicon labs has 3 relative humidity measurements with a range of 0 80 RH and 0 4 C temperature accuracy at a...

Страница 4: ...3V or 5V power logic There s a PTFE filter to keep the sensor clean that s the white flat thing on top Also comes with some pin header Some light soldering is required to attach the header but it s e...

Страница 5: ...or on board that will take 3 5VDC and safely convert it down To power the board give it the same power as the logic level of your microcontroller e g for a 5V micro like Arduino use 5V 3v3 this is the...

Страница 6: ...soldering procedure is identical Prepare the header strip Cut the strip to length if necessary It will be easier to solder if you insert it into a breadboard long pins down Adafruit Industries https...

Страница 7: ...akout board Place the breakout board over the pins so that the short pins poke through the breakout pads Adafruit Industries https learn adafruit com adafruit si7021 temperature plus humidity sensor P...

Страница 8: ...ps on soldering be sure to check out our Guide to Excellent Soldering https adafru it aTk You re done Check your solder joints visually and continue onto the next steps Adafruit Industries https learn...

Страница 9: ...ro digital 3 Connect the SDA pin to the I2C data SDA pin on your Arduino On an UNO 328 based Arduino this is also known as A4 on a Mega it is also known as digital 20 and on a Leonardo Micro digital 2...

Страница 10: ...uit all about arduino libraries install use https adafru it aYM Load Demo Open up File Examples Adafruit_Si7021 si7021 and upload to your Arduino wired up to the sensor Thats it Now open up the serial...

Страница 11: ...it was not found Once initialized you can query the temperature in C with Which will return floating point decimal fractional temperature You can convert to Fahrenheit by multiplying by 1 8 and adding...

Страница 12: ...find handy Call sensor readSerialNumber to read out the 8 bytes of unique ID Then you can access them from sensor sernum_a and sensor sernum_b Adafruit Industries https learn adafruit com adafruit si...

Страница 13: ...an use we will show wiring for Raspberry Pi For other platforms please visit the guide for CircuitPython on Linux to see whether your platform is supported https adafru it BSN Here s the Raspberry Pi...

Страница 14: ...inux 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 ve...

Страница 15: ...7021 Create library object using our Bus I2C port i2c busio I2C board SCL board SDA sensor adafruit_si7021 SI7021 i2c while True print nTemperature 0 1f C sensor temperature print Humidity 0 1f sensor...

Страница 16: ...Python Library Docs Python Library Docs https adafru it C3f Adafruit Industries https learn adafruit com adafruit si7021 temperature plus humidity sensor Page 16 of 19...

Страница 17: ...y on GitHub https adafru it rAw EagleCAD PCB files on GitHub https adafru it rAB Si7021 A20 datasheet https adafru it rAC K R Smith calibration notes https adafru it BfU Schematic Fabrication Print Ad...

Страница 18: ...Adafruit Industries https learn adafruit com adafruit si7021 temperature plus humidity sensor Page 18 of 19...

Отзывы: