Fermion: STS35 High Accuracy Digital Temperature Sensor Breakout Wiki - DFRobot

Introduction

The STS35 temperature sensor from Sensirion gives a fully calibrated, linearized, and supply-voltage-compensated digital output and has an outstanding accuracy of up to ±0.1℃. It provides an operating temperature range of -40-125℃ and up to 1MHz I2C communication rate. Besides, the sensor can heat up itself to dehumidify the chip, which means it can function properly in a certain level of humidity.

Applications

Features

Specification

Pinout

Num Label Description
1 RST Power Positive Reset pin (pull down to reset)
2 ADDR Power Negative I2C address pin (default to be 0x4B, pull-down address is 0x4A)
3 SDA I2C data line
4 SCL I2C clock line
5 GND -
6 VCC +

Tutorial

Requirements

Read Sensor Data via I2C

I2C Wiring Diagram

Sample Code

/*!
 * @file getTemperature.ino
 * @brief Enable the period measurement mode of the sensor (set the period measurement frequency, equivalent to sending a command to enable the period measurement mode),
 * @n Get the measured temperature data in the sensor period measurement mode
 * 
 * @copyright    Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @licence     The MIT License (MIT)
 * @author [LuoYufeng](yufeng.luo@dfrobot.com)
 * @version  V1.0
 * @date  2021-9-01
 * @url https://github.com/DFRobot/DFRobot_STS3X
 */
#include "DFRobot_STS3X.h"

/*!
 * Determine the I2C address based on pull high or pull low of ADDR pin
 * ADDR pin pull low: STS3X_IIC_ADDRESS_A   0x4A
 * ADDR pin pull high (by default): STS3X_IIC_ADDRESS_B   0x4B
 */
DFRobot_STS3X sts(&Wire, STS3X_IIC_ADDRESS_B);


void setup(void)
{
    Serial.begin(9600);
    /*Wait for the chip to be initialized completely, and then exit*/
    while(sts.begin() != true){
        Serial.println("Failed to init chip, please check if the chip connection is fine. ");
        delay(1000);
    }

    /*!
     *@brief Set measurement frequency
     *@param freq: Select e2S, e1Hz, e2Hz, e4Hz and e10Hz modes in the enum variable eFreq_t
     */
    sts.setFreq(sts.e10Hz);

}

void loop() {
    Serial.print(sts.getTemperaturePeriodC());
    Serial.println(" ℃");
    delay(1000);
}

Result

Repeat Mode Select

Mode Measurement Time
High 12.5 ms
Medium 4.5 ms
Low 2.5 ms
    /*!
     *@brief Set repeat mode
     *@param code: Select eHigh, eMedium and eLow modes in the enum variable eCode_t
     */
    sts.setRepeat(sts.eHigh);

Measurement Rate Select

Mode Measurement Rate
2S 0.5Hz
1Hz 1Hz
2Hz 2Hz
4Hz 4Hz
10Hz 10Hz
    /*!
     *@brief Set measurement frequency
     *@param freq: Select e2S, e1Hz, e2Hz, e4Hz and e10Hz modes in the enum variable eFreq_t
     */
    sts.setFreq(sts.e10Hz);

Note

API Function List

    void setRepeat(eCode_t code);

    /*!
     *@brief Set clock stretching. After enabling clock stretching, the sensor won't send NAK if the measurement is not done; it will send data to implement the unfinished measurement command after the measurement is done.
     *@param clockStretch: Whether to turn on clock stretching, true for on, false for off
     */
    void setStretch(bool clockStretch);

    /*!
     *@brief Set measurement frequency, enable sensor period measurement mode (set the period measurement frequency, equivalent to sending a command to enable the period measurement mode)
     *@param freq: Select e2S, e1Hz, e2Hz, e4Hz and e10Hz modes in the enum variable eFreq_t
     */
    void setFreq(eFreq_t freq);

    /*!
     *@brief Turn on the heater
     */
    void setHeaterOn();

    /*!
     *@brief Turn off the heater
     */
    void setHeaterOff();

    /*!
     *@brief Interrupt the ongoing work of the sensor and force it into idle mode
     */
    void breakSensor();

    /*!
     *@brief Set the parameters to the default value
     */
    void resetSensor();

    /*!
     *@brief Get and save all the current statuses of the sensor
     *@n But after a while, you have to call the interface before obtaining the current sensor status through other api functions
     */
    void getStatus();

    /*!
     *@brief Get checksum status
     *@return true: checksum of last write transfer was correct
     *@n      false: checksum of last write transfer failed
     */
    bool checkSumStatus();

    /*!
     *@brief Get command status
     *@return true: last command executed successfully
     *@n      false: last command not processed.
     */
    bool commandStatus();

    /*!
     *@brief Check if the system is reset
     *@return true: no reset detected since last 'clear status register' command
     *@n      false: reset detected (hard reset, soft reset command or supply fail)
     */
    bool systemResetDetected();

    /*!
     *@brief Temp tracking alert
     *@return true: no alert
     *@n      false: alert
     */
    bool temTrackingAlert();

    /*!
     *@brief Get heater status
     *@return true: Heater OFF
     *@n      false: Heater ON
     */
    bool heaterStatus();

    /*!
     *@brief Get alert pending status
     *@return true: no pending alerts
     *@n      false: at least one pending alert
     */
    bool alertPendingStatus();

    /*!
     *@brief Get the current temp in single measurement mode, note: ensure the sensor is in idle status, you can call the relevant api: breakSensor()
     *@return Unit: ℃
     */
    float  getTemperatureSingleC();

    /*!
     *@brief Get the current temp in period measurement mode, note: set the sampling frequency in advance, you can call the relevant api: setFreq(eFreq_t freq)
     *@return Unit: ℃
     */
    float  getTemperaturePeriodC();

Precaution

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get Fermion: STS35 High Accuracy Digital Temperature Sensor from DFRobot Store or DFRobot Distributor.

Turn to the Top