GithubHelp home page GithubHelp logo

lol_dht22's Introduction

Driver for DHT22/AM2302 Temperature and humidity sensors on 
Raspberry Pi.
Based on dht11.c: http://ubuntuone.com/6mT9cTREz90BUfvQD1AGNy (license unknown).
Requires wiringPi library.

./configure
make
sudo ./loldht
Raspberry Pi wiringPi DHT11 Temperature test program
Humidity = 42.90 % Temperature = 22.20 *C

License: Public domain. Do what you want. No warranties.

./configure options:
 --disable-silent-rules Show the make process (silent by default)
 --disable-secure Disable compile with FORTIY_SOURCE and stack-protector (enabled by default)
 --enable-development Compile with -g -O0 -Wall. Applies disable-secure automatically

autogen.sh: Autoconf boostrap. Development use only.

lol_dht22's People

Contributors

jkhsjdhjs avatar klausstocker avatar technion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lol_dht22's Issues

aclocal.m4 failed - raspberrypi

I keep getting the following error trying to build:

pi@raspberrypi:~/lol_dht22 $ make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /home/pi/lol_dht22/missing aclocal-1.15
/home/pi/lol_dht22/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
http://www.gnu.org/software/automake
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
http://www.gnu.org/software/autoconf
http://www.gnu.org/software/m4/
http://www.perl.org/
Makefile:313: recipe for target 'aclocal.m4' failed
make: *** [aclocal.m4] Error 127

Data not good, skip

My DHT22 since a couple of days (I upgraded to Raspian Strech), my DHT22 is not working any more. It alwayz said "Data not good, skip".

I was recompiling your software, did not work.

Then I modified dht22.c, line 81+82 to:

if (1==1) { ....

So, no matter how the data looks like, it will output the data. This is the output:

pi@pimaster ~/dht22/lol_dht22 $ sudo ./loldht usage: ./loldht <pin> (<tries>) description: pin is the wiringPi pin number using 7 (GPIO 4) Optional: tries is the number of times to try to obtain a read (default 100)Raspberry Pi wiringPi DHT22 reader www.lolware.net Humidity = 6553.50 % Temperature = -3276.70 *C

I tried another DHT22, because I thought it was broken. Any suggestions?

Data values are twice as high

Hello,
I have a weird issue with my two DHT22s: from time to time the data given is exactly twice as high as some seconds before:
dht22
I already tried different gpio pins, different DHT22s, tripple checked the wiring (the hardware should be ok).
Raspian Jessie 2017-07-05 on RP3B
Any ideas?
Thanks in advance!

loldht gives "data not good, skip" but works with AdafruitDHT.py

Hello,
I have a raspberry pi 2 and I'm trying to setup a Raspberry Pi Vivarium Controller at raspiviv.com. I purchased 2x AM2302 wired DHT22 from Adafruit.

I have one wired to GIPO pin 3 and the second to pin 5. I am able to run the example program and return the temp / humidity successfully:

sudo python AdafruitDHT.py 2302 2
sudo python AdafruitDHT.py 2302 3

The first command argument 2 corresponds to physical pin 3 and the second command argument 3 corresponds to physical pin 5. If I do a:

gpio readall

this shows that physical pin 3 yields a wPI 8 and BCM 2; physical pin 5 yields wPI 9 and BCM 3. I'm guessing the AdafruitDHT.py is looking at BCM.

I am now trying to get the wiringPi loldht command to work. If I try

sudo loldht 8

It just reads "Data not good, skip". No matter what I try for the numerical argument it doesn't work. wiringPi is the core for the vivarium controller software.

Any suggestions?

Thanks!

Data not good, skip

Hi there,

I'm trying to debug my Pi (I'm building 3 zero's to be this: http://www.instructables.com/id/Raspberry-Pi-Temperature-Humidity-Network-Monitor/) - but I ain't getting any results from the sensors.
I have 3 sensors (AM2302) lying around, and all the same (same store, same layout) - alle three no results ("Data not good, skip").
I had a raspberry zero running and working before with one of these sensors.

Where can I start to resolve this?
Is it a dependency?
is there a go low where it should high?
is there something missing in the /boot/config.txt ?

Can compile at raspbian buster -ERROR: aclocal-1.15: command not found

Get following error message from configure:

CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /lol_dht22_src/missing aclocal-1.15 
/lol_dht22_src/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
make: *** [Makefile:313: aclocal.m4] Error 127

Patch at my Dockerfile with:

RUN git clone https://github.com/technion/lol_dht22 /lol_dht22_src && \
    cd lol_dht22_src && \
    sed -i 's/1\.15/1\.16/g' configure && \
    ./configure && make && \
    mv /lol_dht22_src/loldht /loldht && rm -Rf /lol_dht22_src

Use resin/rpi-raspbian:buster base image, RPI 3b+ with Hypriot OS 1.11.

Regards
Peter

how to use this

Hi, could you post more detailed instructions on how to use this?
./configure prints error:

configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."

DHT22 / AM2302 running on Odroid C1? / Help

Hi i need help,
there are four problems:

  1. I am a beginner
  2. im a user of a Raspberry (works) and an Odroid C1 (don't work)
  3. i don't know how i do fix this configure error
    checking for wiringPiSetup in -lwiringPi... no
    configure: error: Fail to find wiringPi library -> there is a ported wPi version for C1 on github (https://github.com/hardkernel/wiringPi)
    -> tests: the libs exists in /usr/lib/ and in โ‰ˆ/odroid/wiringPi/wiring/pi
    -> @libwiringPi.so
    -> *libwiringPi.so.2.0
    -> @libwiringPiDev.so
    -> *libwiringPiDev.so.2.0
    ...but the configure program don't find it?
  4. There is a Userpost in odroid c1 forum, he changed the delaytime from 1 ms to 2 ms (exeperimental but it works for him)
    http://forum.odroid.com/viewtopic.php?f=111&t=14417

Thanks for Hints

ludwich

More Stabel readout on Buster Linux

Here a few changes to get stable readouts also on Buster linux.
was very unstable after updating...

This change is important for retrys - because without this the retrys most likely fail:
Beginning of read_dht22_dat()
...
pinMode(DHTPIN, OUTPUT);
digitalWrite(DHTPIN, HIGH);
delay(500);
digitalWrite(DHTPIN, LOW);
delay(10); /
digitalWrite(DHTPIN, HIGH);
delayMicroseconds(5);
pinMode(DHTPIN, INPUT);

Change the counter from 16 to 14 for a better 0/1
if (counter > 14)
dht22_dat[j/8] |= 1;

and in main() function increase the delay to 3 seconds between retrys - the dht-22 need at least 2s to recover from broken communication.
And decrease the final wait time to 500ms - no need to spend such long time there.
while (read_dht22_dat() == 0 && tries--)
{
delay(3000);
}
delay(500);
if(lock)
close_lockfile(lockfd);

And to fix a race condition that the state of a pin could change between the while loop and the line below it:
uint8_t readInWhile = HIGH;
...
// Warte auf Flanke... - initial High->low
while ( (readInWhile = sizecvt(digitalRead(DHTPIN))) == laststate) {
counter++;
delayMicroseconds(2);
if (counter == 255) {
break;
}
}
laststate = readInWhile;

Hope this helps, for me this is a stable connection again, over a very long wire (50m).

The process will wait for good data forever

In dht22.c the code

while (read_dht22_dat() == 0) 
{
  delay(1000); // wait 1sec to refresh
}

will keep the loop running forever if you get bad data. Maybe you could have a parameter that specifies the max number of iterations (which would roughly translate to seconds since there is a one second delay in the loop).

Lock file is in use, waiting...

I got this error today, and now it appears constantly. I don't receive any usable data anymore.
Tried recompiling the program, but it's still the same.

sudo ./loldht
Raspberry Pi wiringPi DHT22 reader
www.lolware.net
Lock file is in use, waiting...
Lock file is in use, waiting...
Lock file is in use, waiting...

lockfile.h - add /lock an loldht runs without sudo

Hi,

please change lockfile.h:
#define LOCKFILE "/var/run/lock/dht.lock"

Because with this change, loldht can execute without root-permissions.
I thing, this directory has the permission for all users to write a file, not only root.

THX
Florian

First read always fails

Testing several iteration always the first read fails.
After some google search I found https://github.com/winlinvip/SimpleDHT which has a well documented sequence reading the temp data.
I adapted the init sequence to the same way SimpleDHT does.
After that the read always works on the first attempt.
Snippet from dht22.c
pinMode(DHTPIN, OUTPUT);
//digitalWrite(DHTPIN, HIGH);
//delay(10);
digitalWrite(DHTPIN, LOW);
delay(20);
// then pull it up for 20-40 microseconds
digitalWrite(DHTPIN, HIGH);
delayMicroseconds(25);
// prepare to read the pin
pinMode(DHTPIN, INPUT);
----<>---
If not called frequent it works with my setup everytime.
Attached dht22.c as txt since github wont allow .c
dht22.txt

Error compiling

sudo make

make: *** No targets specified and no makefile found. Stop.

Data not good (again?)

Hi there, everything ran fine at least two years up till yesterday, but upgrading the kernel to 4.14.72-1 (Arch Linux) got me also "Data not good" even if the 2 microseconds fix is in the code. I cloned wiringPi and lol_dht22 but didn't got better. Hardware: Raspberry 1B. I'll try another sd card to copy a backup to see if the error goes away.

Update: I verified that running the pi1b with kernel 4.14.66-1 (from my backup) lol_dht22 is working as before. So this is no hardware failure. Now with a second check on kernel 4.14.72-1, I now get (after a couple of "Data not good") always
Humidity = 0.00 % Temperature = 0.00 *C
Has anyone similar problems with this kernel version?

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.