0.4.2 SHT85

This commit is contained in:
Rob Tillaart 2023-09-06 11:42:30 +02:00
parent 90da998661
commit 1cf039eb8a
9 changed files with 173 additions and 78 deletions

View File

@ -6,12 +6,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.4.2] - 2023-09-05
- fix #19 SHT85 cannot be address 0x45
- rewrote begin()
- removed example SHT85_duo
- add example SHT85_multiplex
- add section about multiple SHT85 to readme.md
- redo badges in readme.md
- minor edits
## [0.4.1] - 2022-05-09
- add **uint32_t getSerialNumber()** for SHT85 (no CRC check).
- improve error handling.
- update readme.md
## [0.4.0] - 2022-12-14
- redo asynchronous interface
- add **uint32_t getLastRequest()** timestamp.

View File

@ -1,9 +1,12 @@
[![Arduino CI](https://github.com/robtillaart/SHT85/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino CI](https://github.com/RobTillaart/SHT85/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/SHT85/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/SHT85/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/SHT85/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/SHT85/actions/workflows/jsoncheck.yml)
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/SHT85.svg)](https://github.com/RobTillaart/SHT85/issues)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/SHT85/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/SHT85.svg?maxAge=3600)](https://github.com/RobTillaart/SHT85/releases)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/SHT85.svg)](https://registry.platformio.org/libraries/robtillaart/SHT85)
# SHT85
@ -34,7 +37,7 @@ Always check datasheet before connecting!
```
The SHT85 sensors should work up to 1000 KHz.
The SHT85 sensors should work (I2C) up to 1000 KHz.
During tests with an Arduino UNO it stopped between 500 - 550 KHz.
So to be safe I recommend not to use the sensor above 400 KHz.
Also the differences in read time becomes quite small. (max 15% gain).
@ -58,13 +61,13 @@ SPS (= samples per second) are added later.
| 550 KHz | ---- | | fail
At 10% load the SHT85 can be used to make about 10-15 SPS.
At 10% load the SHT85 can be used to make about 10 - 15 SPS.
#### Compatibility
The SHT85 is protocol compatible with the SHT3x series.
Main difference is the accuracy.
Main difference is the accuracy and the SHT85 only has address 0x44.
Compare the data sheets to see all differences.
Accuracy table:
@ -81,6 +84,16 @@ Note: The SHT40, SHT41 and SHT45 are not protocol compatible with SHT3x and SHT8
The SHT4x series is slightly faster than the SHT3x series.
#### Multiple SHT85
The SHT3x comes with two I2C address options, 0x44 and 0x45.
The SHT85 only has 0x44 as I2C address, so it is not possible to have more than
one on a single I2C bus.
This means you need to use multiple I2C buses (if your board support this),
a software I2C (below) or an I2C multiplexer e.g. https://github.com/RobTillaart/TCA9548
#### Related libraries
- https://github.com/RobTillaart/SHT2x
@ -94,6 +107,9 @@ An elaborated library for the SHT31 sensor can be found here
Dewpoint, heatindex, related functions and conversions.
- https://github.com/RobTillaart/Temperature
I2C multiplexer
- https://github.com/RobTillaart/TCA9548
## Interface
@ -313,3 +329,12 @@ Will switch the heater off if maximum heating time has passed.
- **getKelvin()** wrapper? (no => check temperature class)
==> set Offset to 273.15 !
## Support
If you appreciate my libraries, you can support the development and maintenance.
Improve the quality of the libraries by providing issues and Pull Requests, or
donate through PayPal or GitHub sponsors.
Thank you,

View File

@ -1,7 +1,7 @@
//
// FILE: SHT85.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.4.1
// VERSION: 0.4.2
// DATE: 2021-02-10
// PURPOSE: Arduino library for the SHT85 temperature and humidity sensor
// https://nl.rs-online.com/web/p/temperature-humidity-sensor-ics/1826530
@ -484,6 +484,21 @@ SHT85::SHT85()
_type = 85;
}
#if defined(ESP8266) || defined(ESP32)
bool SHT85::begin(const uint8_t address, uint8_t dataPin, uint8_t clockPin)
{
if (address != 0x44) return false;
return SHT::begin(SHT_DEFAULT_ADDRESS, dataPin, clockPin);
}
#endif
bool SHT85::begin(const uint8_t address, TwoWire *wire)
{
if (address != 0x44) return false;
return SHT::begin(address, wire);
}
uint32_t SHT85::GetSerialNumber()
{

View File

@ -2,7 +2,7 @@
//
// FILE: SHT85.h
// AUTHOR: Rob Tillaart
// VERSION: 0.4.1
// VERSION: 0.4.2
// DATE: 2021-02-10
// PURPOSE: Arduino library for the SHT85 temperature and humidity sensor
// https://nl.rs-online.com/web/p/temperature-humidity-sensor-ics/1826530
@ -25,7 +25,7 @@
#include "Wire.h"
#define SHT_LIB_VERSION (F("0.4.1"))
#define SHT_LIB_VERSION (F("0.4.2"))
#define SHT85_LIB_VERSION SHT_LIB_VERSION
#ifndef SHT_DEFAULT_ADDRESS
@ -184,6 +184,13 @@ class SHT85 : public SHT
{
public:
SHT85();
// catch incorrect calls with an address, only 0x44 allowed, see #19
#if defined(ESP8266) || defined(ESP32)
bool begin(const uint8_t address, uint8_t dataPin, uint8_t clockPin);
#endif
bool begin(const uint8_t address, TwoWire *wire = &Wire);
// EXPERIMENTAL for 0.4.1
uint32_t GetSerialNumber();
};

View File

@ -1,68 +0,0 @@
//
// FILE: SHT85_duo.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// URL: https://github.com/RobTillaart/SHT85
//
// TOPVIEW SHT85 (check datasheet)
// +-------+
// +-----\ | SDA 4 -----
// | +-+ ----+ GND 3 -----
// | +-+ ----+ +5V 2 -----
// +-----/ | SCL 1 -----
// +-------+
#include "SHT85.h"
#define SHT85_ADDRESS 0x44
uint32_t start;
uint32_t stop;
SHT85 sht1;
SHT85 sht2;
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("SHT_LIB_VERSION: \t");
Serial.println(SHT_LIB_VERSION);
Wire.begin();
sht1.begin(0x44);
sht2.begin(0x45);
Wire.setClock(100000);
uint16_t stat = sht1.readStatus();
Serial.print(stat, HEX);
Serial.println();
stat = sht2.readStatus();
Serial.print(stat, HEX);
Serial.println();
Serial.println();
}
void loop()
{
Serial.print(millis());
sht1.read(); // default = true/fast slow = false
Serial.print("\t0x44\t");
Serial.print(sht1.getTemperature(), 1);
Serial.print("\t");
Serial.print(sht1.getHumidity(), 1);
sht2.read();
Serial.print("\t0x45\t");
Serial.print(sht2.getTemperature(), 1);
Serial.print("\t");
Serial.println(sht2.getHumidity(), 1);
delay(100);
}
// -- END OF FILE --

View File

@ -0,0 +1,29 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
# - due
# - zero
# - leonardo
- m4
- esp32
- esp8266
# - mega2560
- rpipico
libraries:
- TCA9548

View File

@ -0,0 +1,78 @@
//
// FILE: SHT85_multiplex.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// URL: https://github.com/RobTillaart/SHT85
//
// TOPVIEW SHT85 (check datasheet)
// +-------+
// +-----\ | SDA 4 -----
// | +-+ ----+ GND 3 -----
// | +-+ ----+ +5V 2 -----
// +-----/ | SCL 1 -----
// +-------+
// TODO: test with hardware
#include "SHT85.h"
#include "TCA9548.h"
TCA9548 MP(0x70);
#define SHT85_ADDRESS 0x44
SHT85 sht; // the object is reused in the multiplexing.
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("TCA9548_LIB_VERSION: \t");
Serial.println(TCA9548_LIB_VERSION);
Serial.print("SHT_LIB_VERSION: \t");
Serial.println(SHT_LIB_VERSION);
Wire.begin();
Wire.setClock(100000);
if (MP.begin() == false)
{
Serial.println("Error: Could not connect to the multiplexer.");
while (1);
}
// initialize 4 SHT85's
for (int channel = 0; channel < 4; channel++)
{
Serial.print(channel);
MP.selectChannel(channel); // rotate over all SHT85's
if (sht.begin(0x44) == false)
{
Serial.println("\tconnect error.");;
}
else
{
Serial.println("\tOK!.");;
}
delay(10);
}
Serial.println();
}
void loop()
{
Serial.print(millis());
Serial.print("\t");
for (int channel = 0; channel < 4; channel++)
{
sht.read(); // default = true/fast slow = false
Serial.print(sht.getTemperature(), 1);
Serial.print("\t");
Serial.print(sht.getHumidity(), 1);
delay(100);
}
}
// -- END OF FILE --

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/SHT85"
},
"version": "0.4.1",
"version": "0.4.2",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=SHT85
version=0.4.1
version=0.4.2
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for the SHT85, SHT30, SHT31, SHT35 Senserion temperature and humidity sensors and compatibles.