0
votes

Some time ago I was connecting DHT11 sensor to Arduino UNO and wrote a simple library based on the one from Arduino website.

At the moment I'd like to connect DHT11 to Intel Edison with Arduino Expansion Board running Yocto Linux. While trying to rewrite the library to Python I expected a problem with microseconds's sleeps in that language and finally decided to remake Raspberry Pi DHT11 Library using mraa. However, sensor isn't working as well. I found the topic on Intel forum blaming Edison ports fast IN/OUT switching inability. The proposed solution using two wires also didn't help me.

After this introduction, a few questions come to my mind:

  1. Since both Raspberry and Edison are computer systems with real processors and Linux (unlike the Arduino which consists of simple microcontroller), why are people facing a problem with DHT11 on Edison, while those who are using Raspberry aren't?

  2. What is the source of those problems? Is it connected with non-deterministic OS timing on Edison (RPi has the same, hasn't it?), with digital pins flaw or both?

  3. Is it even possible to solve this using two wires (alternatively with a diode)? Maybe it's impossible without a suggested tri-state buffer?

  4. What is the simplest way to connect one-wire devices to Edison?

1

1 Answers

1
votes

The 1-Wire protocol, as you know, requires deterministic timing. It is not possible to do deterministic timing on a computing platform like Edison, or even a PC. You might get somewhere close to it using usleep() but your app may get interrupted at any time, thereby messing up your timings.

What you need to do when using a system without deterministic timing of GPIO is attach the sensor using an interface. That interface should use a small micro which DOES have deterministic timing. (ie a Pic, ATTINY, etc).

  • OR - Use an existing peripheral on your system which does have deterministic timing, such as a UART.

I wrote a blog-post some years ago on how you can use a UART to do 1-Wire protocol. You should be able to find it here: http://wphost.spider-e.com/?p=231