Giter Club home page Giter Club logo

Comments (12)

rgabo74 avatar rgabo74 commented on September 13, 2024

I did further investigation. I found about 30% of individual readings are returned with Checksum error. I am doing thousands of readings in a day. It is possible multiple errors are happening during reading the data and checksum bytes and with a small probability still the checksum is correct, so the data is accepted and passed. Better success rate on individual readings would reduce the risk...

from adafruit_python_dht.

Dmole avatar Dmole commented on September 13, 2024

In The current example None is returned for the reading if there is a Checksum error, so maybe this issue can be closed.

from adafruit_python_dht.

melroy89 avatar melroy89 commented on September 13, 2024

I see the same behavior. As dmole said, I will try to use the if .. is None statement. But still as you can see, the values aren't None, but are in fact a value (although it's wrong).

humid_temp
readings

from adafruit_python_dht.

rgabo74 avatar rgabo74 commented on September 13, 2024

I debuged further what is happening. I found high percentage of measurements rejected in the background due to wrong CRC. Most of these are ignored by the driver and the measurements are repeated, however there are some measurements where the bit reading is incorrect but the CRC result is a false positive. There are the ones you see as a bad measure. Since this this is not a kerner level driver, I don't believe this can be avoided especially if your linux is doing many other things like mine.Finally I implemented the am2302 data read on an Arduino pro mini and I am reading the temperarure data from the Arduino via i2c bus on the Pi. I have no false reading since then.Sent from
Yahoo Mail for iPhoneOn 29 Sep 2015 22:28:13, Melroy van den Berg wrote:I got the same issue. Sometimes the readings are not correct. I got a AM2301 sensor, but in the code I'm forced to use 'AM2302' (notice the '2' at the end). Nevertheless, sometimes I see that humidity and temp_1 is really strange and incorrect. temp_1 is the reading from AM2301 sensor. The other temperatures are other sensors and not relevant.

β€”Reply to this email directly or view it on GitHub.

from adafruit_python_dht.

JosefRypacek avatar JosefRypacek commented on September 13, 2024

Hi, I also got a lot of bad values. Maybe in 30-50% I get humidity 3005% and wrong temperature. So I done easy check - if humidity is < 0 || > 100 then don't save values to database. In future I'll try to repeat measuring.

Is there any way, how to check if CRC check has been successful false positive). or CRC is not checked while DHT22 measuring?

Thanks

screenshot_2015-10-02_11-31-24

from adafruit_python_dht.

Dmole avatar Dmole commented on September 13, 2024

If you want this to work more reliably;

  • nice all other things you have running,
  • run this as root (to have access to lower nice values)
  • use only the c portion
  • return the raw values (not the calculated H, and T)
  • use the calibration signal instead of the magic number
  • use the linux RT patch.

You can't expect this to work if you are sharing the CPU with other things.

from adafruit_python_dht.

melroy89 avatar melroy89 commented on September 13, 2024

@Dmole
Wait wait, wait a second. You are saying I can't do readings on BeagleBone Black with Debian (they advised to install), and using GPIO pins for 1-wire for AM2301 sensor? 1-wire works perfectly with another waterproof temp. sensor, BS18B20, which also uses 1-wire protocol.

Maybe you are right at some point. But CRC should just work. Again I got correct readings with the other sensor (BS18B20). Which uses the Linux Kernel driver:
http://lxr.free-electrons.com/source/drivers/w1/w1.c

I created a device tree for the BS18B20 sensor.

from adafruit_python_dht.

Dmole avatar Dmole commented on September 13, 2024

@Danger89
A Kernel driver has much higher priority than a user space script so you don't need to do much to get it close to real time. Also this is analog (length of a signal), 1-wire protocol is digital(pattern of signals).
Also the Kernel driver is likely not ignoring the calibration signal.

https://en.wikipedia.org/wiki/1-Wire#Example_communication_with_a_device

from adafruit_python_dht.

melroy89 avatar melroy89 commented on September 13, 2024

Ok, so maybe it's an idea to use w1-gpio? And maybe it's also an idea if this Adafruit python library try to use this w1-gpio Linux kernel driver?

from adafruit_python_dht.

Dmole avatar Dmole commented on September 13, 2024

@Danger89 This library exists because the package does not conform to the w1 protocol. but yes using a package that does is highly advisable.

from adafruit_python_dht.

melroy89 avatar melroy89 commented on September 13, 2024

@Dmole
Damn. omg that's true .. -,- In that case the only good solution is to create a Adafruit DHT Linux kernel driver for this special 'w1 protocol'.

from adafruit_python_dht.

tdicola avatar tdicola commented on September 13, 2024

There's actually a kernel driver for the DHT11/22/etc. sensors now, it's part of the iio subsystem and you can find a little more Pi-specific info here on using it: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=113988 and https://www.raspberrypi.org/forums/viewtopic.php?f=31&t=117938. Yeah it's definitely a good step in the right direction if you're running into checksum and other errors. The python code really just makes a best effort at reading the signal from userspace--if anything else is taking a lot of CPU or resources then it can be problematic to get a good reading. The kernel driver should help a bit since it won't be affected as much by other processes monopolizing the CPU. I haven't used the kernel driver myself yet though so just be aware it might require some device tree configuration and other Linux setup.

from adafruit_python_dht.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.