Using 1-Wire device with Intel Galileo

Many people have had trouble with getting 1-Wire devices to work with the Galileo and Galileo Gen2 boards.

The main reason is that the Galileo and Galileo Gen2 uses IO expanders for many of  its GPIOs. Even with the pins Arduno header pins that have native SoC IO speeds, it is not possible because the GPIOs that control the muxing of those pins uses pins from the IO expanders.

http://bigdinotech.com/tutorials/galileo-tutorials/using-1-wire-device-with-intel-galileo/

Galileo Muxing For Pin2

 

Galileo Cypress IO Expander

Galileo Cypress IO Expander

 

If we look at the two images taken form the Galileo schematic, IO which is connected to the Arduino Digital 2 pin, is controlled by a mux pin IO2_MUX. This pin is then connected to the Cypress IO expander.

The end result is there is significant latency when switching pin direction using pinMode() becuase it requires I2C transactions with the IO expanders.

 

I will show a way to use 1-Wire device with the Galileo and Galileo Gen2 boards.

The trick is to use 2 pins instead of 1. For the Galileo, pins 2 and 3 must be used since they are the only pins fast enough to achieve this. For the Galileo Gen2, any pins except pins 7 and 8 can be used.

For this tutorial, I will use a DHT11 sensor which a very cheap and popular 1-Wire humidity and temperature sensor.

 

The Proper Way

The proper way of doing this is to use a tri-state buffer.

This works because, when pin 3 is pulled HIGH, the tri-state buffer prevents the HIGH signal from being passed to the other side. However, the 1-Wire device still sees a high signal because of the pull-up resistor.
When pin 3 is pulled LOW, the signal passes through the tri-state buffer and a LOW signal is detected by the 1-Wire device.

The Easy Way

For the easy way the only extra hardware needed is a diode such as the 1N4148 signal diode. This essential works the same way as the tri-state buffer method where only a LOW signal passes through because current only passes in one direction through a diode.

Since we are now using two pins, we will also need to make changes in the libraries used. As an example, I modified the DHT-11 library from Adafruit.

 

 

 

Serial Output

 

 

 

3 thoughts on “Using 1-Wire device with Intel Galileo

  1. Ahmad

    Hallo,

    I am trying to measure the Humidity and Temprature with Intel Galileo Board genration 1 using DHT11 but it doesnot work.
    I downloded the Library and the code .
    Here is the Error :
    Arduino: 1.5.3 (Windows 7), Board: “Intel® Galileo”

    Arduino: 1.5.3 (Windows 7), Board: “Intel® Galileo”

    sketch_sep05a.ino:18:23: error: ‘DHT11’ was not declared in this scope
    sketch_sep05a.ino: In function ‘void setup()’:
    sketch_sep05a.ino:24:6: error: ‘class DHT’ has no member named ‘begin’
    sketch_sep05a.ino: In function ‘void loop()’:
    sketch_sep05a.ino:33:16: error: ‘class DHT’ has no member named ‘readHumidity’
    sketch_sep05a.ino:35:16: error: ‘class DHT’ has no member named ‘readTemperature’
    sketch_sep05a.ino:37:16: error: ‘class DHT’ has no member named ‘readTemperature’
    sketch_sep05a.ino:47:17: error: ‘class DHT’ has no member named ‘computeHeatIndex’

    can you send for me at my email adress the code and the library with zip file?
    Can you please help me ?

    best Regards
    Ahmad

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *