Skip to content

Temperature and Humidity Sensor TinyShield Tutorial

The Temperature and Humidity Sensor TinyShield allows you to measure temperature and humidity from the TinyDuino. Since the same Si7020-A10 sensor can measure both humidity and temperature, this TinyShield sensor is a perfect addition to weather-detecting projects.

To learn more about the TinyDuino Platform, click here


Description

This TinyShield lets you measure temperature and humidity from the TinyDuino.  Based around the Silicon Labs Si7020-A10 sensor, this allows for accurate temperature measurement (+- 0.4C) and precision relative humidity readings.  

This TinyShield incorporates level shifters and a local power supply to ensure proper and safe operation over the entire TinyDuino operating voltage range up to 5V.

To see what other TinyShields are compatible with this TinyShield, see the TinyShield Compatibility Matrix

Technical Details Si7020-A10 Specs
  • Precision Relative Humidity Sensor 
    • +-4% RH, 0-80% RH
    • 0 - 100% RH operating range
  • High Accuracy Temperature Sensor
    • +-0.4C, -10 to +85C
  • Factory Calibrated
  • Integrated on-chip heater
  • Excellent long term stability
TinyDuino Power Requirements
  • Voltage: 3.0V - 5.5V
  • Current:
    • 150uA (Active Mode).
    • 60nA (Standby)
    • Due to the low current, this board can be run using the TinyDuino coin cell option
Pins Used
  • A5/SCL - I2C Serial Clock line
  • A4/SDA - I2C Serial Data line
Dimensions
  • 20mm x 20mm (.787 inches x .787 inches)
  • Max Height (from lower bottom TinyShield Connector to upper top TinyShield Connector): 5.11mm (0.201 inches)
  • Weight: 1 gram (.04 ounces)

Notes

  • You can also use this shield without the TinyDuino – there are 0.1″ spaced connections for power, ground, and the two I2C signals along the side of the TinyShield to allow you to connect a different system.
  • Warning: Revision 4 boards have a mistake on the silkscreen, the pin marked VCC is actually SCL, the pin marked SCL is actually SDA, and the pin marked SDA is actually VCC. If you connect this up the way it is marked you will not damage the board.
  • This sensor has a hole in the top of it for measuring humidity, care should be taken to not get debris in this opening. 

Materials

TinyZero and Temperature and Humidity Sensor TinyShield

Hardware

Software


Assembly (Hardware)

On top of your processor board of choice (i.e. TinyZero), place the Temperature and Humidity Sensor TinyShield, snapping them together with the tan 32-pin connectors. Plug a MicroUSB cable into the USB port and then plug the cable into a free USB port on your computer. Make sure the processor is switched on.

An assembled stack of a TinyZero and Temperature and Humidity Sensor TinyShield.


Software (Setup and Downloads)

Open the Arduino IDE so you can download, and install the Temperature and Humidity sensor library. (You should already have the IDE installed if you've gone through a setup tutorial for a processor board.)

Click the following link to download the zipped Si7021 Arduino Library. Now to install it into your Arduino library and make it usable, click the Sketch tab in the IDE, select Include Library > Add .ZIP Library. Then locate the Si7021.zip folder wherever it downloaded, and press "Open". The library should now be installed. Yay!


The Code

Download the .zip file of the example program and open it in the Arduino IDE.

Code
/*
  TinyCircuits Si7020 Temperature and Humidity Sensor TinyShield Example Sketch

  This demo shows the bare minimum to read temperature and humidity data from 
  the Si7020 sensor using the Si7020 library written by Marcus Sorensen.

  This example is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  Written 20 March 2016
  By Ben Rose
  Modified 07 January 2019
  By Hunter Hykes

  https://TinyCircuits.com
*/

#include <Wire.h>
#include <SI7021.h>

SI7021 sensor;

void setup()
{
  Serial.begin(115200);
  Wire.begin();
  Serial.print("Initializing sensor... ");
  if(!sensor.begin()){
    Serial.println("Sensor not found!");
    while(true);
  }
  Serial.println("Success!");
}

void loop()
{
  int celcius=sensor.getCelsiusHundredths()/100;
  int relativeHumidity=sensor.getHumidityPercent();
  Serial.print(celcius);
  Serial.print(" deg Celsius\t");
  Serial.print(relativeHumidity);
  Serial.println("% relative humidity");

  delay(500);
}

Upload the program using the Tools selections:

Tools selections for TinyZero (Your COM# will probably be different)

Once the upload is complete, open up the Serial Monitor (Ctrl+Shift+M) at 115200 baud, and you'll be able to observe the data gathered by the sensor!

Data from the Temperature and Humidity Sensor TinyShield here at TinyCircuits

Now you can keep track of the environment in your next project!


Contact Us

If you have any questions or feedback, feel free to email us at info@tinycircuits.com or make a post on the forum.

Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it!

Thanks for making with us!


Downloads