Code Monkey home page Code Monkey logo

Comments (9)

SOS-Bob avatar SOS-Bob commented on July 20, 2024 2

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

from arduino-dht22.

pfichtner avatar pfichtner commented on July 20, 2024 1

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

from arduino-dht22.

mrLieto avatar mrLieto commented on July 20, 2024 1

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

from arduino-dht22.

jpenner64 avatar jpenner64 commented on July 20, 2024

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....

from arduino-dht22.

junwoo091400 avatar junwoo091400 commented on July 20, 2024

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!

from arduino-dht22.

mandria avatar mandria commented on July 20, 2024

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

from arduino-dht22.

nadin2 avatar nadin2 commented on July 20, 2024

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

from arduino-dht22.

junwoo091400 avatar junwoo091400 commented on July 20, 2024

@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.

from arduino-dht22.

ASDBigmac avatar ASDBigmac commented on July 20, 2024

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

from arduino-dht22.

Related Issues (4)

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.