Skip to content

Commit ea13c58

Browse files
committed
0.6.1 SHT85
1 parent 36fbe4b commit ea13c58

File tree

8 files changed

+225
-101
lines changed

8 files changed

+225
-101
lines changed

libraries/SHT85/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.6.1] - 2025-04-28
10+
- add **clearStatus()**, kudos to Elbandi (see SHT31)
11+
- update readme.md
12+
- add example SHT30_test_address.ino
13+
- minor edits
14+
915
## [0.6.0] - 2023-12-09
1016
- refactor API, move parameters from begin() to constructor
1117
- update readme.md

libraries/SHT85/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021-2024 Rob Tillaart
3+
Copyright (c) 2021-2025 Rob Tillaart
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

libraries/SHT85/README.md

Lines changed: 127 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -37,40 +37,22 @@ Always check datasheet before connecting!
3737
```
3838

3939

40-
The SHT85 sensors should work (I2C) up to 1000 KHz.
41-
During tests with an Arduino UNO it stopped between 500 - 550 KHz.
42-
So to be safe I recommend not to use the sensor above 400 KHz.
43-
Also the differences in read time becomes quite small. (max 15% gain).
44-
45-
See indicative output example sketch.
46-
SPS (= samples per second) are added later.
47-
48-
49-
| I2C speed | read ms | SPS | notes |
50-
|:---------:|:-------:|:-----:|:--------|
51-
| 50 KHz | 6.60 | 123 |
52-
| 100 KHz | 5.11 | 140 | default
53-
| 150 KHz | 4.79 | |
54-
| 200 KHz | 4.64 | 140 |
55-
| 250 KHz | 4.56 | |
56-
| 300 KHz | 4.50 | 164 |
57-
| 350 KHz | 4.47 | |
58-
| 400 KHz | 4.45 | 164 |
59-
| 450 KHz | 4.43 | |
60-
| 500 KHz | 4.42 | 163 |
61-
| 550 KHz | ---- | | fail
40+
### 0.6.0 Breaking change
6241

63-
64-
At 10% load the SHT85 can be used to make about 10 - 15 SPS.
42+
Version 0.6.0 introduced a breaking change.
43+
You cannot set the pins in **begin()** any more.
44+
This reduces the dependency of processor dependent Wire implementations.
45+
The user has to call **Wire.begin()** and can optionally set the Wire pins
46+
before calling **begin()**.
6547

6648

67-
#### Compatibility
49+
### Compatibility
6850

6951
The SHT85 is protocol compatible with the SHT3x series.
70-
Main difference is the accuracy and the SHT85 only has address 0x44.
52+
Main difference is the accuracy and the SHT85 only has one address 0x44.
7153
Compare the data sheets to see all differences.
7254

73-
Accuracy table:
55+
Accuracy table
7456

7557
| Sensor | Temperature | Humidity | Verified }
7658
|:--------:|:-------------:|:----------:|:----------:|
@@ -84,7 +66,36 @@ Note: The SHT40, SHT41 and SHT45 are not protocol compatible with SHT3x and SHT8
8466
The SHT4x series is slightly faster than the SHT3x series.
8567

8668

87-
#### Multiple SHT85
69+
### I2C performance
70+
71+
The SHT85 sensors should work (I2C) up to 1000 KHz.
72+
During tests with an Arduino UNO it stopped between 500 - 550 KHz.
73+
So to be safe I recommend not to use the sensor above 400 KHz.
74+
Also the differences in read time becomes quite small. (max 15% gain).
75+
76+
See indicative output example sketch.
77+
SPS (= samples per second) are added later.
78+
79+
80+
| I2C speed | read ms | SPS | notes |
81+
|:-----------:|:---------:|:-----:|:--------|
82+
| 50 KHz | 6.60 | 123 |
83+
| 100 KHz | 5.11 | 140 | default
84+
| 150 KHz | 4.79 | |
85+
| 200 KHz | 4.64 | 140 |
86+
| 250 KHz | 4.56 | |
87+
| 300 KHz | 4.50 | 164 |
88+
| 350 KHz | 4.47 | |
89+
| 400 KHz | 4.45 | 164 |
90+
| 450 KHz | 4.43 | |
91+
| 500 KHz | 4.42 | 163 |
92+
| 550 KHz | ---- | | fail
93+
94+
95+
At 10% load the SHT85 can be used to make about 10 - 15 SPS.
96+
97+
98+
### Multiple SHT85
8899

89100
The SHT3x comes with two I2C address options, 0x44 and 0x45.
90101
The SHT85 only has 0x44 as I2C address, so it is not possible to have more than
@@ -93,31 +104,50 @@ This means you need to use multiple I2C buses (if your board support this),
93104
a software I2C (below) or an I2C multiplexer e.g. https://github.com/RobTillaart/TCA9548
94105

95106

96-
#### 0.6.0 Breaking change
107+
### I2C multiplexing
108+
109+
Sometimes you need to control more devices than possible with the default
110+
address range the device provides.
111+
This is possible with an I2C multiplexer e.g. TCA9548 which creates up
112+
to eight channels (think of it as I2C subnets) which can use the complete
113+
address range of the device.
114+
115+
Drawback of using a multiplexer is that it takes more administration in
116+
your code e.g. which device is on which channel.
117+
This will slow down the access, which must be taken into account when
118+
deciding which devices are on which channel.
119+
Also note that switching between channels will slow down other devices
120+
too if they are behind the multiplexer.
121+
122+
- https://github.com/RobTillaart/TCA9548
97123

98-
Version 0.6.0 introduced a breaking change.
99-
The parameters from begin() moved to the constructor.
100-
You cannot set the pins in **begin()** any more.
101-
This reduces the dependency of processor dependent Wire implementations.
102-
The user has to call **Wire.begin()** and can optionally set the Wire pins
103-
before calling **begin()**.
104124

125+
### Related
105126

106-
#### Related
127+
SHT series temperature sensors
107128

108129
- https://github.com/RobTillaart/SHT2x
109-
- https://github.com/RobTillaart/SHT31
130+
- https://github.com/RobTillaart/SHT31 Sensirion humidity / temperature sensor
110131
- https://github.com/RobTillaart/SHT31_SW = softWire based I2C.
132+
- https://github.com/RobTillaart/SHT31_SWW = softWire based I2C.
133+
- https://github.com/RobTillaart/SHT85 Sensirion humidity / temperature sensor
111134
- https://github.com/RobTillaart/tinySHT2x
112135

136+
Other temperature sensors
137+
138+
- https://github.com/RobTillaart/DHTNew DHT11/22 etc
139+
- https://github.com/RobTillaart/DHTStable DHT11/22 etc
140+
- https://github.com/RobTillaart/DHT_Simulator
141+
- https://github.com/RobTillaart/DS18B20_INT OneWire temperature sensor
142+
- https://github.com/RobTillaart/DS18B20_RT OneWire temperature sensor
143+
113144
An elaborated library for the SHT31 sensor can be found here
114145
- https://github.com/hawesg/SHT31D_Particle_Photon_ClosedCube
115146

116-
Dewpoint, heatindex, related functions and conversions.
117-
- https://github.com/RobTillaart/Temperature
147+
Other, including Dewpoint, heatindex, related functions and conversions.
118148

119-
I2C multiplexer
120-
- https://github.com/RobTillaart/TCA9548
149+
- https://www.kandrsmith.org/RJS/Misc/Hygrometers/calib_many.html (interesting)
150+
- https://github.com/RobTillaart/Temperature (conversions, dewPoint, heat index etc.)
121151

122152

123153
## Interface
@@ -126,8 +156,7 @@ I2C multiplexer
126156
#include "SHT85.h"
127157
```
128158

129-
130-
#### Constructor
159+
### Constructor
131160

132161
- **SHT(uint8_t address, TwoWire \*wire = &Wire)** constructor of the base class.
133162
Note that **getType()** will return 0.
@@ -142,26 +171,27 @@ Optional select the address and the I2C bus (Wire, Wire1 etc).
142171
- **uint8_t getType()** returns numeric part of sensor type.
143172
Returns 0 for the base class.
144173
- **bool begin()** Returns false if device address is incorrect or device cannot be reset.
145-
- **uint8_t getAddress()** returns address set in constructor.
174+
- **uint8_t getAddress()** returns address set in the constructor.
146175

147176

148-
#### Status
177+
### Status
149178

150179
- **bool isConnected()** checks if address of the sensor is reachable over I2C. Returns false if not connected.
151-
- **uint16_t readStatus()** details see datasheet and **Status fields** below.
180+
- **uint16_t readStatus()** returns bit mask, details see **Status fields** below (and datasheet).
181+
- **bool clearStatus()** clear status register, see **Status fields** below.
152182
- **uint32_t lastRead()** in milliSeconds since start of program.
153-
- **bool reset(bool hard = false)** resets the sensor, soft reset by default. Returns false if fails.
183+
- **bool reset(bool hard = false)** resets the sensor, soft reset by default. Returns false if call fails.
154184

155185

156-
#### Synchronous read
186+
### Synchronous read
157187

158188
- **bool read(bool fast = true)** blocks 4 (fast) or 15 (slow) milliseconds + actual read + math.
159189
Reads both the temperature and humidity from the device.
160190

161191
Note: the medium level is not supported (yet).
162192

163193

164-
#### Asynchronous read
194+
### Asynchronous read
165195

166196
See async example for usage.
167197

@@ -177,7 +207,7 @@ Returns false if reading the data fails or if CRC check failed.
177207
This function is used to check if the request is too long ago.
178208

179209

180-
#### Temperature and humidity
210+
### Temperature and humidity
181211

182212
Note that the temperature and humidity values are recalculated on every call to **getHumidity()** and **getTemperature()**.
183213
If you're worried about the extra cycles, you should make sure to cache these values or only request them after
@@ -205,44 +235,48 @@ rawHumidity = humidity * 655.35;
205235
```
206236

207237

208-
#### Temperature and humidity offset
238+
### Temperature and humidity offset
209239

210240
Default the offset is zero for both temperature and humidity.
211-
These functions allows one to adjust them a little. Note there is no limit to the offset so one can use huge values. This allows to use an offset of 273.15 effectively creating **°Kelvin** instead of Celsius.
241+
These functions allows one to adjust them a little.
242+
Note: there is no limit to the offset so one can use huge values.
243+
This allows to use an offset of 273.15 effectively creating degrees **Kelvin** instead of **Celsius**.
212244

213245
Note: the offset is defined in degrees Celsius.
214246
To set an offset in degrees Fahrenheit, multiply the Fahrenheit offset with 0.55555556 to get Celsius steps (divide by 1.8 is slower).
215247
So an offset of 4 °F becomes 2.2222 °C.
216248

249+
Note: the offset for humidity may cause boundary issues (below 0 and above 100)
217250

218-
- **void setTemperatureOffset(float offset = 0)** set the offset in °C, default is zero removing the offset. The library converts this internally
251+
- **void setTemperatureOffset(float offset = 0)** set the offset in °C, default is zero removing the offset.
252+
The library converts this internally
219253
- **float getTemperatureOffset()** returns the set offset in °C.
220254
- **void setHumidityOffset(float offset = 0)** set the offset, default is zero removing the offset.
221255
- **float getHumidityOffset()** returns the set offset.
222256

223257

224-
#### Error interface
258+
### Error interface
225259

226260
- **int getError()** returns last set error flag and clear it.
227261
Be sure to clear the error flag by calling **getError()** before calling
228262
any command as the error flag could be from a previous command.
229263

230264
| Error | Symbolic | Description |
231265
|:-------:|:--------------------------|:-------------------------------|
232-
| 0x00 | SHT_OK | no error |
233-
| 0x81 | SHT_ERR_WRITECMD | I2C write failed |
234-
| 0x82 | SHT_ERR_READBYTES | I2C read failed |
235-
| 0x83 | SHT_ERR_HEATER_OFF | Could not switch off heater |
236-
| 0x84 | SHT_ERR_NOT_CONNECT | Could not connect |
237-
| 0x85 | SHT_ERR_CRC_TEMP | CRC error in temperature |
238-
| 0x86 | SHT_ERR_CRC_HUM | CRC error in humidity |
239-
| 0x87 | SHT_ERR_CRC_STATUS | CRC error in status field |
240-
| 0x88 | SHT_ERR_HEATER_COOLDOWN | Heater need to cool down |
241-
| 0x89 | SHT_ERR_HEATER_ON | Could not switch on heater |
242-
| 0x8A | SHT_ERR_SERIAL | Could not read serial number |
266+
| 0x00 | SHT_OK | no error |
267+
| 0x81 | SHT_ERR_WRITECMD | I2C write failed |
268+
| 0x82 | SHT_ERR_READBYTES | I2C read failed |
269+
| 0x83 | SHT_ERR_HEATER_OFF | Could not switch off heater |
270+
| 0x84 | SHT_ERR_NOT_CONNECT | Could not connect |
271+
| 0x85 | SHT_ERR_CRC_TEMP | CRC error in temperature |
272+
| 0x86 | SHT_ERR_CRC_HUM | CRC error in humidity |
273+
| 0x87 | SHT_ERR_CRC_STATUS | CRC error in status field |
274+
| 0x88 | SHT_ERR_HEATER_COOLDOWN | Heater need to cool down |
275+
| 0x89 | SHT_ERR_HEATER_ON | Could not switch on heater |
276+
| 0x8A | SHT_ERR_SERIAL | Could not read serial number |
243277

244278

245-
#### Heater interface
279+
### Heater interface
246280

247281
**WARNING:** Do not use heater for long periods.
248282

@@ -259,7 +293,7 @@ Switch off the heater by explicitly calling **heatOff()** or indirectly by calli
259293
This value is truncated to max 180 seconds.
260294
- **uint8_t getHeatTimeout()** returns the value set.
261295
- **bool heatOn()** switches the heat cycle on if not already on.
262-
Returns false if this fails, setting error to **SHT_ERR_HEATER_COOLDOWN**
296+
Returns false if the call fails, setting error to **SHT_ERR_HEATER_COOLDOWN**
263297
or to **SHT_ERR_HEATER_ON**.
264298
- **bool heatOff()** switches the heat cycle off.
265299
Returns false if fails, setting error to **SHT_ERR_HEATER_OFF**.
@@ -269,29 +303,31 @@ Will switch the heater off if maximum heating time has passed.
269303

270304
## Status fields
271305

272-
| BIT | Description | value | notes |
273-
|:------|:---------------------------|:--------|:--------|
274-
| 15 | Alert pending status | 0 | no pending alerts
275-
| | | 1 | at least one pending alert - default
276-
| 14 | Reserved | 0 |
277-
| 13 | Heater status | 0 | Heater OFF - default
278-
| | | 1 | Heater ON
279-
| 12 | Reserved | 0 |
280-
| 11 | Humidity tracking alert | 0 | no alert - default
281-
| | | 1 | alert
282-
| 10 | Temperature tracking alert | 0 | no alert - default
283-
| | | 1 | alert
284-
| 9-5 | Reserved | 00000 | reserved
285-
| 4 | System reset detected | 0 | no reset since last ‘clear status register’ command
286-
| | | 1 | reset detected (hard or soft reset command or supply fail) - default
287-
| 3-2 | Reserved | 00 |
288-
| 1 | Command status | 0 | last command executed successfully
289-
| | | 1 | last command not processed. Invalid or failed checksum
290-
| 0 | Write data checksum status | 0 | checksum of last write correct
291-
| | | 1 | checksum of last write transfer failed
292-
293-
294-
#### SHT85 specific
306+
| BIT | Description | value | notes |
307+
|:------|:-----------------------------|:--------|:--------|
308+
| 15 | Alert pending status | 0 | no pending alerts
309+
| | | 1 | at least one pending alert - default
310+
| 14 | Reserved | 0 |
311+
| 13 | Heater status | 0 | Heater OFF - default
312+
| | | 1 | Heater ON
313+
| 12 | Reserved | 0 |
314+
| 11 | Humidity tracking alert | 0 | no alert - default
315+
| | | 1 | alert
316+
| 10 | Temperature tracking alert | 0 | no alert - default
317+
| | | 1 | alert
318+
| 9-5 | Reserved | 00000 | reserved
319+
| 4 | System reset detected | 0 | no reset since last ‘clear status register’ command
320+
| | | 1 | reset detected (hard or soft reset command or supply fail) - default
321+
| 3-2 | Reserved | 00 |
322+
| 1 | Command status | 0 | last command executed successfully
323+
| | | 1 | last command not processed. Invalid or failed checksum
324+
| 0 | Write data checksum status | 0 | checksum of last write correct
325+
| | | 1 | checksum of last write transfer failed
326+
327+
**bool clearStatus()** clears 15, 11, 10 and 4.
328+
329+
330+
### SHT85 specific
295331

296332
- **uint32_t GetSerialNumber()** Returns a 32 bit unique serial number.
297333
This command seems to be timing sensitive, it uses a delay of 500us
@@ -300,7 +336,6 @@ Will switch the heater off if maximum heating time has passed.
300336

301337
## Future
302338

303-
304339
#### Must
305340

306341
- improve documentation.
@@ -347,3 +382,4 @@ donate through PayPal or GitHub sponsors.
347382

348383
Thank you,
349384

385+

0 commit comments

Comments
 (0)