Skip to content

SHT85 full-featured driver library for general-purpose MCU and Linux.

License

Notifications You must be signed in to change notification settings

libdriver/sht85

English | 简体中文 | 繁體中文 | 日本語 | Deutsch | 한국어

LibDriver SHT85

MISRA API License

SHT85 is Sensirion’s best-in-class humidity sensor with pin-type connector for easy integration and replacement. It builds on a highly accurate and long-term stable SHT3x sensor that is at the heart of Sensirion’s strongly established humidity and temperature platform. The unique package design allows for the best possible thermal coupling to the environment and decoupling from potential heat sources on the main board. The SHT85 features a PTFE membrane dedicated to protecting the sensor opening from liquids and dust according to IP67, without affecting the response time of the RH signal. It thus allows for sensor use under harsh environmental conditions, (such as spray water and high exposure to dust). Sensirion holds an exclusive license for several patents for employing an on-package filter membrane on a humidity sensor. Final accuracy testing on product level ensures best performance, making the SHT85 the ultimate choice for even the most demanding applications.

LibDriver SHT85 is a full-featured driver for SHT85, launched by LibDriver.It provides continuous reading, single reading and additional features. LibDriver is MISRA compliant.

Table of Contents

Instruction

/src includes LibDriver SHT85 source files.

/interface includes LibDriver SHT85 IIC platform independent template.

/test includes LibDriver SHT85 driver test code and this code can test the chip necessary function simply.

/example includes LibDriver SHT85 sample code.

/doc includes LibDriver SHT85 offline document.

/datasheet includes SHT85 datasheet.

/project includes the common Linux and MCU development board sample code. All projects use the shell script to debug the driver and the detail instruction can be found in each project's README.md.

/misra includes the LibDriver MISRA code scanning results.

Install

Reference /interface IIC platform independent template and finish your platform IIC driver.

Add the /src directory, the interface driver for your platform, and your own drivers to your project, if you want to use the default example drivers, add the /example directory to your project.

Usage

You can refer to the examples in the /example directory to complete your own driver. If you want to use the default programming examples, here's how to use them.

example basic

#include "driver_sht85_basic.h"

uint8_t res;
uint32_t i;
float temperature;
float humidity;
uint8_t sn[4];

/* basic init */
res = sht85_basic_init();
if (res != 0)
{
    return 1;
}

...
    
/* loop */
for (i = 0; i < 3; i++)
{
    /* delay 1000ms */
    sht85_interface_delay_ms(1000);

    /* read data */
    res = sht85_basic_read((float *)&temperature, (float *)&humidity);
    if (res != 0)
    {
        (void)sht85_basic_deinit();

        return 1;
    }

    /* output */
    sht85_interface_debug_print("sht85: %d/%d.\n", (uint32_t)(i + 1), (uint32_t)3);
    sht85_interface_debug_print("sht85: temperature is %0.2fC.\n", temperature);
    sht85_interface_debug_print("sht85: humidity is %0.2f%%.\n", humidity);
    
    ...
}

...

/* get serial number */
res = sht85_basic_get_serial_number(sn);
if (res != 0)
{
    sht85_basic_deinit();

    return 1;
}
sht85_interface_debug_print("sht85: serial number is 0x%02X 0x%02X 0x%02X 0x%02X.\n", sn[0], sn[1], sn[2], sn[3]);

...
    
/* basic deinit */
(void)sht85_basic_deinit();

return 0;

example shot

#include "driver_sht85_shot.h"

uint8_t res;
uint32_t i;
float temperature;
float humidity;

/* shot init */
res = sht85_shot_init();
if (res != 0)
{
    return 1;
}

...
    
/* loop */
for (i = 0; i < 3; i++)
{
    /* delay 1000ms */
    sht85_interface_delay_ms(1000);

    /* read data */
    res = sht85_shot_read((float *)&temperature, (float *)&humidity);
    if (res != 0)
    {
        (void)sht85_shot_deinit();

        return 1;
    }

    /* output */
    sht85_interface_debug_print("sht85: %d/%d.\n", (uint32_t)(i + 1), (uint32_t)3);
    sht85_interface_debug_print("sht85: temperature is %0.2fC.\n", temperature);
    sht85_interface_debug_print("sht85: humidity is %0.2f%%.\n", humidity);
    
    ...
}

...
    
/* shot deinit */
(void)sht85_shot_deinit();

return 0;

Document

Online documents: https://www.libdriver.com/docs/sht85/index.html.

Offline documents: /doc/html/index.html.

Contributing

Please refer to CONTRIBUTING.md.

License

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy

of this software and associated documentation files (the "Software"), to deal

in the Software without restriction, including without limitation the rights

to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

copies of the Software, and to permit persons to whom the Software is

furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all

copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

SOFTWARE.

Contact Us

Please send an e-mail to lishifenging@outlook.com.

About

SHT85 full-featured driver library for general-purpose MCU and Linux.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages