Adafruit Si7021 Temperature + Humidity Sensor Created by lady ada Last updated on 2017-11-12 06:14:07 PM UTC
Guide Contents Guide Contents Overview Pinouts 2 3 5 Power Pins: I2C Logic pins: 5 5 Assembly 6 Prepare the header strip: Add the breakout board: And Solder! Arduino Code Download Adafruit_Si7021 Load Demo Library Reference CircuitPython Code Usage Downloads Files & Datasheets Schematic Fabrication Print © Adafruit Industries https://learn.adafruit.
Overview It's summer and you're sweating and your hair's all frizzy and all you really want to know is why the weatherman said this morning that today's relative humidity would max out at a perfectly reasonable 42% when it feels more like 77%. Enter the Si7021 Temperature + 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 range of -10 to +85 °C.
We put this nice sensor on a breakout board with a 3.3V regulator and level shifting so you can use it safely with 3.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 easy to do. © Adafruit Industries https://learn.adafruit.
Pinouts The Si7021 is a I2C sensor. That means it uses the two I2C data/clock wires available on most microcontrollers, and can share those pins with other sensors as long as they don't have an address collision. For future reference, the I2C address is 0x40 and you can't change it! Power Pins: Vin - this is the power pin. Since the chip uses 3 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down.
Assembly The photos below show a an HTUD21 sensor rather than the Si7021 but the 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://learn.adafruit.
Add the breakout board: Place the breakout board over the pins so that the short pins poke through the breakout pads © Adafruit Industries https://learn.adafruit.
And Solder! Be sure to solder all pins for reliable electrical contact. (For tips 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.adafruit.
Arduino Code You can easily wire this breakout to any microcontroller, we'll be using an Arduino. For another kind of microcontroller, just make sure it has I2C, then port the code - its pretty simple stuff! diagram.fzz Fritzing file https://adafru.it/rAA Connect Vin to the power supply, 3-5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V Connect GND to common power/data ground Connect the SCL pin to the I2C clock SCL pin on your Arduino.
Download Adafruit Si7021 Library https://adafru.it/rAx Rename the uncompressed folder Adafruit_Si7021 and check that the Adafruit_Si7021 folder contains Adafruit_Si7021.cpp and Adafruit_Si7021.h Place the Adafruit_Si7021 library folder your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. We also have a great tutorial on Arduino library installation at: http://learn.adafruit.
You can try breathing on the sensor to increase the humidity. The sensor reacts very fast! Library Reference The library we have is simple and easy to use You can create the Adafruit_Si7021 object with: Adafruit_Si7021 sensor = Adafruit_Si7021(); There are no pins to set since you must use the I2C bus! Then initialize the sensor with: sensor.
This sensor also has a serial number which you might 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.
CircuitPython Code It's easy to use the Si7021 sensor with CircuitPython and the Adafruit CircuitPython SI7021 module. This module allows you to easily write Python code that reads the humidity and temperature, pressurefrom the sensor. First wire up a SI7021 to your board exactly as shown on the previous pages for Arduino.
You can also download the adafruit_si7021.mpy from its releases page on Github. 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 so you are at the CircuitPython >>> prompt. Usage To demonstrate the usage of the sensor we'll initialize it and read the temperature and humidity,from the board's Python REPL.
Downloads Files & Datasheets Fritzing object in Adafruit Fritzing library Arduino library on GitHub EagleCAD PCB files on GitHub Si7021-A20 datasheet Schematic Fabrication Print © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.