Comments (5)
You need to set it just before the #include statement.
from dhtnew.
Ds18b20 uses -127 as an error reading. I don't think you should worry about making the number pleasing for graphs, if a user doesn't want it on their graph they can set a filter very easily to not add it.
What are some numbers for the error occurrences?
how many bit_shifts happen in a row on average and how many checksome errors happen in a row on average?
Potential question to investigate
There are other libraries for dht22 sensors. Specifically one in mind is the adafruit library. What do they do that is different that does not cause these errors? Do they use a user protection as you are suggesting or do they have some other measure and place that corrects the errors?
Thoughts
Since you say check sums don't happen often I I would ignore those and instead since bit shifts are more common I think there should be a flag that is called attempt bit shift correction and when set to true it will attempt to correct bit shift errors. It should not give the okay output though instead it should give an output like bitshift corrected
from dhtnew.
-127 had crossed my mind but one only needs to be distinct, out of range.
CHECKSUM error - seldom, maybe 10 in all those years I use the sensor.
TIMEOUT error - seldom seen, only in breadboards when appropriate pull ups were missing.
SENSOR_NOT_READY error, only defined recently in tests, so no long term data. So far only seen in conjunction with ESP32 in the test case you brought up.
BIT_SHIFT error, only defined recently, so no long term data. Approx 6 x less often than SENSOR_NOT_READY, but most of the time together with SENSOR_NOT_READY.
The latter two are under investigation in #11
Unless the root cause is found I will not fix it or provide a workaround.
What do they do that is different that does not cause these errors?
Have you verified that these libraries do not have the same error after 10 hrs and 12:25 hrs?
I know different libraries handle the low level bit reading / timing differently.
I will look at how Adafruit handles the wake up part as there seems to be the problem.
A flag to attempt bitshift correction sounds like a good idea.
from dhtnew.
Errors (bitshift, timeout, CRC, not ready - do not occur after the 3.0 release, so no more effort will be put in them.
Should there be a keep last good read flag to suppress the -999 as value? [interesting]
This is stil interesting, as the errors are in the return value of read(). There are multiple options:
- never use -999 again as users should check the return value of read()
breaking change in behavior (but no one might notice) - set a flag suppressErrorValues(), in case of an error temperature and humidity will not change, keep their last valid value.
- calculate the new T and H and if they differ less than 1.0 from the existing value use them.
Threshold of 1.0 is arbitrary so people want to set it (complexity). Furthermore around zero it can be crucial, freezing or not.
The second option is the most explicit in its behavior so I'm gonna explore it.
from dhtnew.
@RobTillaart
This is great
I was just doing if(lastRead=-999) lastRead=-1;
but now i just have to set #define DHTLIB_INVALID_VALUE -1
at the top section of my sketch right?
from dhtnew.
Related Issues (20)
- Still problems with measuring negative values (AM2301) HOT 4
- Sensors getting stuck at a certain value HOT 37
- Fix negative temperature below -25.5°C HOT 1
- Humidity values higher than 100% HOT 17
- F_CPU not defined for Arduino Nano RP2040 Connect HOT 3
- read() hangs with MkrWiFi + MkrConnector Board HOT 66
- DTH11 gets too short start impulse HOT 16
- setTempOffset and setHumOffset HOT 3
- Support for SonOff Si7021 HOT 10
- ESP32 error HOT 13
- Test sketch HOT 4
- Si7021 by Sonoff HOT 16
- DHT22 registers as type 70 in 0.4.14 HOT 12
- Support for DS18B20 HOT 3
- Sonoff Si7021 gives wrong temperature and humidity HOT 5
- Compiler warning, conversion float to double HOT 7
- Ticker compatibility HOT 12
- Add support for the AM2320, AM2321 and AM2322.
- consider an enhancement to be able to compile this lib directly under espressif/platformio without Arduino layer HOT 4
- Parallel processing of multiple Sensors HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dhtnew.