Quantcast
Viewing all articles
Browse latest Browse all 18582

DHT workaround for Galileo and Galileo Gen2 using 2 pins instead of one

The main reason the DHT temperature and humidity sensor does not work with the Galileo is because of the tight requirements of one-wire device like the DHT11 and DHT22 sensors.

 

With just one wire, DHT and many other one-wire devices will not work with the Galileo because the Galileo takes too much time when switching a pin from one direction to another.

This is because the Galileo uses IO expanders for the gpio that controls the pin direction and those IO expanders are connected to the Galileo via I2C.

 

One way to get the Galileo to play well with one-wire devices is to use two wires. One dedicated for INPUT and another for OUTPUT.

The workaround I am going to use only requires one extra hardware, a diode.

 

 

Image may be NSFW.
Clik here to view.
DHTGal.PNG

For this example, pin2 is connected to the DHT11.

Cathode of the diode is connected to pin3.

Anode of the diode is connected to the DHT.

 

 

I modified the Adafruit DHT library to work with the Galileo using two pins which I have attached.

I also had to modify replace delayMicroseconds() with a while loop because it is not very reliable for delays less than 200 us for the Galileo

 

Also attached the modified sketch example.

 

Errors are detected occasionally, when the bit pulses are not measured accurately but this is OK because it will fail checksum.

Image may be NSFW.
Clik here to view.
DHTGalSerial.png

 

Note that for the Galileo this will only work for pins 2 and 3 because those are the only pins that are fast enough.

For the Galileo Gen2 this should work for all pins except 7 and 8.

 

I have only tested this with the Galileo and DHT11.

I left my Gen2 at my office cube so I will have to verify it on that tomorrow.


Viewing all articles
Browse latest Browse all 18582

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>