Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

demo not working #12

Open
nailgilaziev opened this issue Feb 25, 2017 · 9 comments
Open

demo not working #12

nailgilaziev opened this issue Feb 25, 2017 · 9 comments

Comments

@nailgilaziev
Copy link

DHT22 Library Demo
Requesting data...Polled to quick 
Requesting data...Sync Timeout 
Requesting data...Sync Timeout 
Requesting data...Sync Timeout 
...

adafruit library works fine and sensor is good too

@jpenner64
Copy link

Ran into the same problem when porting all my work to a new laptop. During this process I upgraded Arduino IDE from 1.6.1 to 1.6.13. Compiling/Uploading on old IDE works fine, on newer version results in Sync Timeout errors.

I have ensured I am using the same project Hardware, Code, and DHT22 library, only two differences are the physical laptops, and the IDE versions. Rule out laptop immediately, but suspected that either A) some compiler settings or updates not applied, and/or B) inherently this compiler versions results AVR performance changes not compatible with the current version of the DHT22 library.

Same project hardware

  • Base is an Arduino pro-mini 3.3vdc 8Mhz, or 5vdc 16Mhz
  • DHT22 powered by 3.3vdc or 5vdc on separate source
  • Have Identical Development and Production platforms
  • AM2302 applied in different configurations:
    • 4 wire with 4.7k
    • 3 wire PCB with 5.1k (Primary configuration)
    • 3 wire Keys PCB with 10k
      Same project software including DHT22 library
  • Functional code for project running for 10 months on 1.6.1 compiler
  • DHT22 library from Ben Adams/Craig Ringer Version 0.5: 15 Jan 2012 used
    Minimalized testing
  • Using examples with the DHT22 Library and pro-mini 8/16Mhz also results in Sync Timeout

Other libraries tried with success, but would like to see if there is something with this library that can be tweaked. I'll take a look and begin to understand AM2302 (DHT22) better, the DHT22 library, and other posts. However, I may he to result to using/integrating another available library.

We will see how it goes....

@junwoo091400
Copy link

junwoo091400 commented Apr 5, 2017

Yeah, I currently have my updated version of DHT22 Library on my repository named 'myCODES'. After some experiment, I found out that delayMicroseconds(2) in the .cpp file didn't actually delay 2 Microseconds but rather delayed about 1.6 us or so. So I changed all the timing settings (if(retryCount>SOMETHING)) => 'changed SOMETHING' and it worked fine. And also, the 'Sync Timeout' would likely to be caused by that too. Since the Library looks at the ACK pulse as one of those bits. However I think this is a wrong approach. This is because ACK pulse and DATA signals are completely different! ACK pulse_LOW is 80us. Which is much longer than correct pre_bitSending LOW pulse. That is probably why you get the 'Sync Timeout' . So I added 2-part ACK perceiving in my code too. If you are interested, come and check it out! I mostly changed the 'readData()' function!

@mandria
Copy link

mandria commented Jul 1, 2017

i've got the same problem,

the sensor used with this library seems to give always the sync error,

i'm using arduino uno rev3
ide - arduino 1.6.10 or arduinostudio or stino2017 ST3 (same error)
@junwoo091400 i'll try your version of the library,
thanks for the share

@nadin2
Copy link

nadin2 commented Oct 26, 2017

hi how are you i am sonia kadiri
please contact me here let talk
[email protected]

@SOS-Bob
Copy link

SOS-Bob commented Dec 20, 2017

Thank you junwoo091400! Wrestled with this for a while and then found this post. In DHT22.cpp file changing all the values of 'delayMicroseconds(2)' value from 2 to 5 fixed it and my gear shows now temperature and humidity values.
Arduino model Genuino, DHT22 SEN0137, using guide: DHT22 Temperature and humidity module SKU:SEN0137, the only sensor library used: Arduino-DHT22-master

@junwoo091400
Copy link

junwoo091400 commented Dec 21, 2017

@SOS-Bob I'm glad to hear that I helped!
Actually, after that post, I got 'sync_timeout' using my library. So I thought my modification isn't good as it should be.

So do you mean that you changed the 'original DHT22' library's delayMicroseconds(2) to delayMicroseconds(5) and it worked fine?

I will ditch my modification and try your method.

@pfichtner
Copy link

Got the same problem and changing the delay from 2 to 5 micros did fix it.

@mrLieto
Copy link

mrLieto commented Mar 24, 2019

Same problem ,getting _sync_timeout. Changing 2 to 5 helped. GREAT. Thank you all.

@ASDBigmac
Copy link

Also worked for me using an Attiny84 @ 8Mhz for a Lorawan Project

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants