1
1
2
- [ ![ Arduino CI] ( https://github.com/robtillaart/SHT2x/workflows/Arduino%20CI/badge.svg )] ( https://github.com/marketplace/actions/arduino_ci )
3
- [ ![ JSON check] ( https://github.com/RobTillaart/SHT2x/actions/workflows/jsoncheck.yml/badge.svg )] ( https://github.com/RobTillaart/SHT2x/actions/workflows/jsoncheck.yml )
2
+ [ ![ Arduino CI] ( https://github.com/RobTillaart/SHT2x/workflows/Arduino%20CI/badge.svg )] ( https://github.com/marketplace/actions/arduino_ci )
4
3
[ ![ Arduino-lint] ( https://github.com/RobTillaart/SHT2x/actions/workflows/arduino-lint.yml/badge.svg )] ( https://github.com/RobTillaart/SHT2x/actions/workflows/arduino-lint.yml )
4
+ [ ![ JSON check] ( https://github.com/RobTillaart/SHT2x/actions/workflows/jsoncheck.yml/badge.svg )] ( https://github.com/RobTillaart/SHT2x/actions/workflows/jsoncheck.yml )
5
+ [ ![ GitHub issues] ( https://img.shields.io/github/issues/RobTillaart/SHT2x.svg )] ( https://github.com/RobTillaart/SHT2x/issues )
6
+
5
7
[ ![ License: MIT] ( https://img.shields.io/badge/license-MIT-green.svg )] ( https://github.com/RobTillaart/SHT2x/blob/master/LICENSE )
6
8
[ ![ GitHub release] ( https://img.shields.io/github/release/RobTillaart/SHT2x.svg?maxAge=3600 )] ( https://github.com/RobTillaart/SHT2x/releases )
9
+ [ ![ PlatformIO Registry] ( https://badges.registry.platformio.org/packages/robtillaart/library/SHT2x.svg )] ( https://registry.platformio.org/libraries/robtillaart/SHT2x )
7
10
8
11
9
12
# SHT2x
@@ -39,6 +42,13 @@ If you want to use more on one I2C bus one needs either an I2C multiplexer
39
42
or one should switch sensors on/off like the select in SPI communication.
40
43
41
44
45
+ #### Related
46
+
47
+ - https://github.com/RobTillaart/SHT31
48
+ - https://github.com/RobTillaart/SHT85
49
+ - https://github.com/RobTillaart/tinySHT2x
50
+
51
+
42
52
## Interface
43
53
44
54
``` cpp
@@ -89,13 +99,24 @@ Note: The raw temperature and raw humidity are ideal to minimize storage or to m
89
99
Experimental since 0.2.2 this interface can change in the future
90
100
Discussion see https://github.com/RobTillaart/SHT2x/issues/16
91
101
92
- - ** bool requestTemperature()**
93
- - ** bool requestHumidity()**
94
- - ** bool reqTempReady()**
95
- - ** bool reqHumReady()**
96
- - ** bool readTemperature()**
97
- - ** bool readHumidity()**
98
- - ** uint32_t lastRequest()**
102
+ - ** bool requestTemperature()** starts new temperature request.
103
+ Overrules optional existing / running request.
104
+ - ** bool requestHumidity()** starts new humidity request.
105
+ Overrules optional existing / running request.
106
+ - ** bool reqTempReady()** returns true if temperature request is ready.
107
+ - ** bool reqHumReady()** returns true if humidity request is ready.
108
+ - ** bool requestReady()** checks if either temperature or humidity is ready.
109
+ - ** bool readTemperature()** calculates the temperature from raw measurement.
110
+ - ** bool readHumidity()** calculates the humidity from raw measurement.
111
+ - ** uint32_t lastRequest()** timestamp of last request.
112
+ - ** uint8_t getRequestType()** get current request type.
113
+
114
+
115
+ | Value | Symbolic | Description | Notes |
116
+ | :-------:| :----------------------------| :------------------------------| :-----------|
117
+ | 0x00 | SHT2x_REQ_NONE | no request pending | |
118
+ | 0x01 | SHT2x_REQ_TEMPERATURE | temperature request pending | |
119
+ | 0x02 | SHT2x_REQ_HUMIDITY | humidity request pending | |
99
120
100
121
TODO elaborate documentation.
101
122
@@ -157,28 +178,28 @@ To be tested.
157
178
158
179
#### Status fields
159
180
160
- From HTU20 datasheet
181
+ From HTU20 datasheet (read for details).
161
182
162
- | bits | value | meaning |
163
- | :------:| :------:| :--------------------|
164
- | 00 | 0 | open circuit |
165
- | 01 | 1 | temperature reading |
166
- | 10 | 2 | humidity reading |
167
- | 11 | 3 | closed circuit |
183
+ | bits | value | Symbolic | Description |
184
+ | :------:| :------- :| :------------------------------ | :-- --------------------|
185
+ | 00 | 0 | SHT2x_STATUS_OPEN_CIRCUIT | open circuit |
186
+ | 01 | 1 | SHT2x_STATUS_TEMPERATURE | temperature reading |
187
+ | 10 | 2 | SHT2x_STATUS_HUMIDITY | humidity reading |
188
+ | 11 | 3 | SHT2x_STATUS_CLOSED_CIRCUIT | closed circuit |
168
189
169
190
170
191
#### Resolution
171
192
172
193
** Warning experimental**
173
- - needs more testing as results are not in line with the datasheet.
194
+ - needs more testing as the results are not in line with the datasheet.
174
195
- only tested on a HTUxx sensor.
175
196
- tested with ** SHT2X_resolution.ino**
176
197
177
198
- ** void setResolution(uint8_t res)** res = 0..3, other values return false.
178
199
- ** uint8_t getResolution()** returns resolution set 0..3.
179
200
180
201
181
- Datasheet SHT20 Table 8: ( resolution)
202
+ Datasheet SHT20 Table 8: resolution
182
203
183
204
| RES | Humidity | Temperature |
184
205
| :-----:| :----------:| :-------------:|
@@ -187,7 +208,8 @@ Datasheet SHT20 Table 8: (resolution)
187
208
| 2 | 10 bit | 13 bit |
188
209
| 3 | 11 bit | 11 bit |
189
210
190
- Datasheet SHT20 Table 7: (timing) and results of real measurements.
211
+
212
+ Datasheet SHT20 Table 7: timing versus results of real measurements.
191
213
( https://github.com/RobTillaart/SHT2x/pull/11 )
192
214
193
215
| RES | HUM | TEMP | TOTAL | REAL |
@@ -209,44 +231,45 @@ Timing in milliseconds.
209
231
## Future
210
232
211
233
#### Must
234
+
212
235
- improve documentation
213
236
- reorganize interface
237
+ - async documentation
214
238
- clean up code.
215
239
216
-
217
240
#### 0.4.0
241
+
218
242
- add crc8 check (need sensor to test)
219
243
- improve error handling (all code paths)
220
244
- investigate blocking delay() in read
221
245
- add offset for temperature and humidity
222
246
223
-
224
- #### ASYNC 0.4.0
225
- improvements for interface.
226
-
227
- - ** bool requestReady()** checks both.
228
- - ** bool requestPending()** checks.
229
- - ** uint8_t getRequestType()** returns 0, 1, 2.
230
- - async documentation
231
-
232
-
233
247
#### Should
248
+
234
249
- test test test
235
250
- get hardware
236
251
- add examples
237
252
- test resolutions
238
253
- performance different resolutions
239
254
- test battery
240
255
241
-
242
256
#### Could
257
+
243
258
- fix TODO in code (.cpp and .h) and documentation
244
259
- update unit tests
245
260
- add type info in derived classes?
246
261
247
-
248
262
#### Wont
249
263
250
264
- add ** getSerialNumber()**
251
265
** getEIDA()** and ** getEIDB()** covers this
252
266
267
+
268
+ ## Support
269
+
270
+ If you appreciate my libraries, you can support the development and maintenance.
271
+ Improve the quality of the libraries by providing issues and Pull Requests, or
272
+ donate through PayPal or GitHub sponsors.
273
+
274
+ Thank you,
275
+
0 commit comments