@@ -37,40 +37,22 @@ Always check datasheet before connecting!
37
37
```
38
38
39
39
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
62
41
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()** .
65
47
66
48
67
- #### Compatibility
49
+ ### Compatibility
68
50
69
51
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.
71
53
Compare the data sheets to see all differences.
72
54
73
- Accuracy table:
55
+ Accuracy table
74
56
75
57
| Sensor | Temperature | Humidity | Verified }
76
58
| :--------:| :-------------:| :----------:| :----------:|
@@ -84,7 +66,36 @@ Note: The SHT40, SHT41 and SHT45 are not protocol compatible with SHT3x and SHT8
84
66
The SHT4x series is slightly faster than the SHT3x series.
85
67
86
68
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
88
99
89
100
The SHT3x comes with two I2C address options, 0x44 and 0x45.
90
101
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),
93
104
a software I2C (below) or an I2C multiplexer e.g. https://github.com/RobTillaart/TCA9548
94
105
95
106
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
97
123
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()** .
104
124
125
+ ### Related
105
126
106
- #### Related
127
+ SHT series temperature sensors
107
128
108
129
- https://github.com/RobTillaart/SHT2x
109
- - https://github.com/RobTillaart/SHT31
130
+ - https://github.com/RobTillaart/SHT31 Sensirion humidity / temperature sensor
110
131
- 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
111
134
- https://github.com/RobTillaart/tinySHT2x
112
135
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
+
113
144
An elaborated library for the SHT31 sensor can be found here
114
145
- https://github.com/hawesg/SHT31D_Particle_Photon_ClosedCube
115
146
116
- Dewpoint, heatindex, related functions and conversions.
117
- - https://github.com/RobTillaart/Temperature
147
+ Other, including Dewpoint, heatindex, related functions and conversions.
118
148
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.)
121
151
122
152
123
153
## Interface
@@ -126,8 +156,7 @@ I2C multiplexer
126
156
#include " SHT85.h"
127
157
```
128
158
129
-
130
- #### Constructor
159
+ ### Constructor
131
160
132
161
- ** SHT(uint8_t address, TwoWire \* wire = &Wire)** constructor of the base class.
133
162
Note that ** getType()** will return 0.
@@ -142,26 +171,27 @@ Optional select the address and the I2C bus (Wire, Wire1 etc).
142
171
- ** uint8_t getType()** returns numeric part of sensor type.
143
172
Returns 0 for the base class.
144
173
- ** 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.
146
175
147
176
148
- #### Status
177
+ ### Status
149
178
150
179
- ** 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.
152
182
- ** 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.
154
184
155
185
156
- #### Synchronous read
186
+ ### Synchronous read
157
187
158
188
- ** bool read(bool fast = true)** blocks 4 (fast) or 15 (slow) milliseconds + actual read + math.
159
189
Reads both the temperature and humidity from the device.
160
190
161
191
Note: the medium level is not supported (yet).
162
192
163
193
164
- #### Asynchronous read
194
+ ### Asynchronous read
165
195
166
196
See async example for usage.
167
197
@@ -177,7 +207,7 @@ Returns false if reading the data fails or if CRC check failed.
177
207
This function is used to check if the request is too long ago.
178
208
179
209
180
- #### Temperature and humidity
210
+ ### Temperature and humidity
181
211
182
212
Note that the temperature and humidity values are recalculated on every call to ** getHumidity()** and ** getTemperature()** .
183
213
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;
205
235
```
206
236
207
237
208
- #### Temperature and humidity offset
238
+ ### Temperature and humidity offset
209
239
210
240
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** .
212
244
213
245
Note: the offset is defined in degrees Celsius.
214
246
To set an offset in degrees Fahrenheit, multiply the Fahrenheit offset with 0.55555556 to get Celsius steps (divide by 1.8 is slower).
215
247
So an offset of 4 °F becomes 2.2222 °C.
216
248
249
+ Note: the offset for humidity may cause boundary issues (below 0 and above 100)
217
250
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
219
253
- ** float getTemperatureOffset()** returns the set offset in °C.
220
254
- ** void setHumidityOffset(float offset = 0)** set the offset, default is zero removing the offset.
221
255
- ** float getHumidityOffset()** returns the set offset.
222
256
223
257
224
- #### Error interface
258
+ ### Error interface
225
259
226
260
- ** int getError()** returns last set error flag and clear it.
227
261
Be sure to clear the error flag by calling ** getError()** before calling
228
262
any command as the error flag could be from a previous command.
229
263
230
264
| Error | Symbolic | Description |
231
265
| :-------:| :--------------------------| :-------------------------------|
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 |
243
277
244
278
245
- #### Heater interface
279
+ ### Heater interface
246
280
247
281
** WARNING:** Do not use heater for long periods.
248
282
@@ -259,7 +293,7 @@ Switch off the heater by explicitly calling **heatOff()** or indirectly by calli
259
293
This value is truncated to max 180 seconds.
260
294
- ** uint8_t getHeatTimeout()** returns the value set.
261
295
- ** 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**
263
297
or to ** SHT_ERR_HEATER_ON** .
264
298
- ** bool heatOff()** switches the heat cycle off.
265
299
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.
269
303
270
304
## Status fields
271
305
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
295
331
296
332
- ** uint32_t GetSerialNumber()** Returns a 32 bit unique serial number.
297
333
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.
300
336
301
337
## Future
302
338
303
-
304
339
#### Must
305
340
306
341
- improve documentation.
@@ -347,3 +382,4 @@ donate through PayPal or GitHub sponsors.
347
382
348
383
Thank you,
349
384
385
+
0 commit comments