Home MBed SHT15 digital humidity sensor and MBed example

SHT15 digital humidity sensor and MBed example

by shedboy71

In this example we will connect a SHT15 sensor to an MBED 1768, in this example we will be using the MBed online compiler

The SHT1x digital humidity sensor is a reflow solderable sensor. The SHT1x series consists of a low-cost version with the SHT10 humidity sensor, a standard version with the SHT11 humidity sensor, and a high-end version with the SHT15 humidity sensor. As with every other Sensirion sensor type from the SHTxx humidity sensor family, they are fully calibrated and provide a digital output.

The SHT1x humidity sensor series (including SHT10, SHT11, and SHT15) is Sensirion’s family of surface-mountable relative humidity sensors. The humidity sensors integrate sensor elements plus signal processing on a tiny footprint and provide a fully calibrated digital output. A unique capacitive sensor element is used for measuring relative humidity, while temperature is measured by a band-gap sensor. Its CMOSens® technologyguarantees excellent reliability and long-term stability. The humidity sensors are seamlessly coupled to a 14-bit-analog-to-digital converter and a serial interface circuit. This results in superior signal quality, a fast response time, and insensitivity to external disturbances (EMC).

Each SHT1x humidity sensor is individually calibrated in a precision humidity chamber. The calibration coefficients are programmed into an OTP memory on the chip. These coefficients are used to internally calibrate the signals from the sensors. The two-wire serial interface and internal voltage regulation allows for easy and fast system integration.

Parts List

Label Part Type Properties
MBED1 mbed MBED 1768
Part1 SHT1x-Breakout CJMCU

Layout

mbed and sht15

mbed and sht15

Code

https://os.mbed.com/components/SHT15-temperature-and-humidity/

[codesyntax lang=”cpp”]

#include "mbed.h"
#include "SHTx/sht15.hpp"

Serial pc(USBTX, USBRX);
DigitalOut busy(LED1);

// I used p9 and p10 here  but you
SHTx::SHT15 sensor(p9, p10);

int
main() 
{
    // Speed things up a bit.
    sensor.setOTPReload(false);
    sensor.setResolution(true);
    
    while(1) 
    {
        busy = true;
        sensor.update();
        busy = false;
        
        // Temperature in celcius
        sensor.setScale(false);
        pc.printf("Temperature - %3.2f C\r\n", sensor.getTemperature());
      
        // Relative Humidity
        pc.printf("Humdity - %3.2f %%\r\n\n", sensor.getHumidity());
        
        wait(5);
    }
}

[/codesyntax]

Testing

Using a terminal program such as TeraTerm you should see readings like the following

Temperature – 26.06 C
Humdity – 34.90 %
Temperature – 25.94 C
Humdity – 34.78 %
Temperature – 25.90 C
Humdity – 35.28 %
Temperature – 25.82 C
Humdity – 35.20 %
Temperature – 25.70 C
Humdity – 35.61 %
Temperature – 25.62 C
Humdity – 35.53 %
Temperature – 27.54 C
Humdity – 41.73 %
Temperature – 30.26 C
Humdity – 56.96 %

 

Links

Temperature and humidity sensor interface board floor board adapter PCB SHT10 SHT11 SHT15 B board

New and original SENSIRION Digital Humidity Sensor (SHT15)

You may also like