Skip to content

SHTC3 temperature and humidity sensor

SHTC3 temperature and humidity sensor Figure 1: SHTC3 temperature and humidity sensor

The SHTC3 combined temperature and relative humidity sensor provides a simple and low-cost solution. It has the additional benefit that it uses the I2C serial communications protocol. This is a system that is ableto connect several devices using just two wires, one for data (SDA) and the other for a synchronising clock signal (SCL).

The instructions below show how to connect the SHTC3 up to your Particle device, and takes you through the process of finding and including the right library in your application code using the Web IDE.

First, set up the hardware connections as shown in Figure 2. (Please note that the device shown in Fig.2 is actually a DHT22 sensor. That is because at the time of writing there is no Fritzing graphic for the SHTC3.)

Photon2 Figure 2: Breadboard layout

Next, go to the Particle Web IDE and click on the Libraries icon in the navigation panel. Search for shtc3 and select the SparkFun_SHTC3_Arduino_Library as shown in Figure 3

DHT library Figure 3: SHTC3 library

After clicking on the library, you have the opportunity to use a ready-made example as shown in Fig.4. Select the one called BasicReadings.ino and then click the Use this example button to create your own copy.

DHT library Figure 4: SHTC3 code example

Once you have flashed the code to your device, the sensor will start taking readings straight away and the example code displays the readings on the serial monitor. To start the serial monitor, open a command window on your laptop and type the command particle serial monitor.

By default, temperature values are displayed in Fahrenheit. There are some comments in the code that tell you how to change this to Celsius.

Fritzing part Fritzing part

SPI and I2C explained SPI and I2C explained

Particle serial monitor command Particle serial monitor command