@@ -50,13 +50,27 @@ As the AM2321 and AM2322 are quite identical according to the datasheet, those a
50
50
51
51
To use the library one should call ** setType(22)** as the protocol is identical to the DHT22.
52
52
If there are differences in operation type (23) will be elaborated.
53
- The value 23 is now mapped upon 22 code .
53
+ The type 23 is now mapped upon type 22 .
54
54
55
55
Feedback (both positive and negative) about the AM232X sensors is welcome.
56
56
57
57
** Note: check the datasheet how to connect!**
58
58
59
59
60
+ ### KY-015 (dht11)
61
+
62
+ Since 0.5.1 there is support for the KY-015. Although it is a DHT11, the KY-015 behaves slightly
63
+ different (faster wakeup) and was recognized as a DHT22 resulting in faulty conversions.
64
+ The library sensor recognition code has been adapted so it should be recognized now.
65
+ In the case the recognition fails, one can use ** setType(11)** to force the type.
66
+
67
+ The KY-015 is confirmed to work, see https://github.com/RobTillaart/DHTNew/issues/102
68
+
69
+ Feedback about the KY-015 sensors is welcome.
70
+
71
+ ** Note: check the datasheet how to connect!**
72
+
73
+
60
74
### 0.5.0 Negative temperature
61
75
62
76
Apparently there are DHT22's which use another representation for negative temperatures.
@@ -69,9 +83,13 @@ See also https://arduino.stackexchange.com/questions/86448/dht22-sensor-reading-
69
83
70
84
### Related
71
85
72
- - https://github.com/RobTillaart/DHTNew
73
- - https://github.com/RobTillaart/DHTStable
86
+ - https://github.com/RobTillaart/DHTNew DHT11/22 etc
87
+ - https://github.com/RobTillaart/DHTStable DHT11/22 etc
74
88
- https://github.com/RobTillaart/DHT_Simulator
89
+ - https://github.com/RobTillaart/DS18B20_INT OneWire temperature sensor
90
+ - https://github.com/RobTillaart/DS18B20_RT OneWire temperature sensor
91
+ - https://github.com/RobTillaart/SHT31 Sensirion humidity / temperature sensor
92
+ - https://github.com/RobTillaart/SHT85 Sensirion humidity / temperature sensor
75
93
- https://www.kandrsmith.org/RJS/Misc/Hygrometers/calib_many.html (interesting)
76
94
- https://github.com/RobTillaart/Temperature (conversions, dewPoint, heat index etc.)
77
95
@@ -85,11 +103,13 @@ See also https://arduino.stackexchange.com/questions/86448/dht22-sensor-reading-
85
103
| pin 3 | | Not Connected |
86
104
| pin 4 | | GND |
87
105
88
- ** Note: check the datasheet how to connect!**
106
+ ** Note: check the datasheet of the sensor how to connect!** as some have only 3 pins.
89
107
90
108
91
109
## Specification DHT22
92
110
111
+ As most used model, for other sensors I refer to datasheet.
112
+
93
113
| Model | DHT22 | Notes |
94
114
| :----------------------------| :-------------------------| :--------|
95
115
| Power supply | 3.3 - 6.0 V DC |
@@ -115,21 +135,22 @@ See also https://arduino.stackexchange.com/questions/86448/dht22-sensor-reading-
115
135
### Constructor
116
136
117
137
- ** DHTNEW(uint8_t pin)** defines the dataPin of the sensor.
118
- - ** void reset()** might help to reset a sensor behaving badly. It does reset the library settings to default,
138
+ - ** void reset()** might help to reset a sensor behaving badly.
139
+ It resets the library internal settings to default,
119
140
however it does not reset the sensor in a hardware way.
120
141
- ** uint8_t getType()** 0 = unknown, 11 or 22.
121
142
In case of 0, ** getType()** will try to determine type.
122
143
Since 0.4.14 type 70 is added for ** experimental** Sonoff Si7021 support.
123
144
- ** void setType(uint8_t type = 0)** allows to force the type of the sensor.
124
145
125
- | Type | Sensors | Notes |
126
- | :-------:| :---------------:| :--------|
127
- | 0 | not defined |
128
- | 11 | DHT11 |
129
- | 22 | DHT22 a.o | most others
130
- | 23 | DHT22 a.o | mapped to 22 for now
131
- | 70 | Sonoff Si7021 | experimental
132
- | other | sets to 0 | 0.4.20
146
+ | Type | Sensors | Notes |
147
+ | :-------:| :------------------------- :| :--------|
148
+ | 0 | not defined |
149
+ | 11 | DHT11 DHT12, KY015 | KY015 needs setType(11)
150
+ | 22 | DHT22, DHT33, DHT44 a.o | most others
151
+ | 23 | DHT23 | mapped to 22 for now
152
+ | 70 | Sonoff Si7021 | experimental
153
+ | other | sets to 0 | 0.4.20
133
154
134
155
135
156
### Base interface
@@ -149,10 +170,19 @@ Note this error value can be suppressed by **setSuppressError(bool)**.
149
170
150
171
Adding offsets works well in normal range however they might introduce
151
172
under- or overflow at the ends of the sensor range.
152
- Humidity is in % RH.
153
- Humidity is constrained to 0.0 - 100.0 % in the code.
154
- Temperature is in degrees Celsius.
155
- For temperature such constrain would be type dependant, so it is not done.
173
+
174
+ Humidity offset is in % RH and is constrained to 0.0 - 100.0 % in the code.
175
+
176
+ Temperature offset is in degrees Celsius.
177
+ For temperature a constrain would be type dependant, so it is not done.
178
+ Furthermore by setting the offset to -273.15 one get the ** Kelvin** scale.
179
+
180
+ - ** void setHumidityOffset(float offset)** typical < ±5% RH.
181
+ - ** void setTemperatureOffset(float offset)** typical < ±2°C.
182
+ - ** float getHumidityOffset()** idem.
183
+ - ** float getTemperatureOffset()** idem.
184
+
185
+ The "short-named" offset functions will become obsolete in the future (0.6.0).
156
186
157
187
- ** void setHumOffset(float offset)** typical < ±5% RH.
158
188
- ** void setTempOffset(float offset)** typical < ±2°C.
@@ -311,7 +341,7 @@ updated readme.md - added badges and remarks after testing with MKR1010 Wifi.
311
341
updated TIMEOUT_C from 70 -> 90 us to minimize its occurrence - See https://github.com/RobTillaart/DHTNew/issues/67 .
312
342
added ``` while(!Serial); ``` in examples to they work for MKR1010 Wifi.
313
343
27 . (0.4.11)
314
- update library.json, license, minor edits (cleanup ), unit tests
344
+ update library.json, license, minor edits (clean up ), unit tests
315
345
28 . (0.4.12)
316
346
Fix #72 , delayMicroseconds() for wakeUp
317
347
29 . (0.4.13)
@@ -332,6 +362,10 @@ Update readme.md
332
362
Update GitHub actions and readme.md
333
363
36 . (0.4.21)
334
364
Add dhtnew_pulse_diag_ext.ino
365
+ 37 . (0.5.0)
366
+ Fix negative values
367
+ 38 . (0.5.1)
368
+ Support KY015 and more.
335
369
336
370
337
371
## Future
@@ -360,11 +394,17 @@ if (type == 11) temp = constrain(temp, 0, 100);
360
394
if (type == 22 ) temp = constrain(temp, -40 , 80 );
361
395
etc.
362
396
```
363
-
397
+ - type parameter in constructor, default 0
398
+ - reimplement the recognition algorithm (separate class?)
399
+ - read as 22 => check the hum / temp data range to determine type
400
+ - read as 11 => check idem
401
+ - read as 70 => check idem
402
+ - split wakeup time from bit interpretation used.
364
403
365
404
#### Wont
366
405
367
406
- move all code from .h to .cpp
407
+ - derived classes for fixed type?
368
408
369
409
370
410
## Support
0 commit comments