Alex Woolford
Alex Woolford

Reputation: 4563

how to read temperature/humidity sensor attached to an Intel Edison?

I'm trying to create an DHT11-based temperature/humidity sensor with Intel Edison and mraa via Python:

Intel Edison with breakout board

The documentation for Python's mraa package was a bit thin on example code.

There's a lookup table to associate physical pins to mraa pin numbers. The GP44 pin on the breakout board is mraa pin 31:

>>> import mraa
>>> mraa.INTEL_EDISON_GP44
31

The gp44 port was configured as an ouput port:

>>> gp44_pin = mraa.Gpio(31)
>>> gp44_pin.dir(mraa.DIR_OUT)

When I read from the gp44 pin it returns zero:

>>> gp44_pin.read()
0

Looking at the C examples, it seems that the DHT11 sensor returns a byte array that can be deciphered. I stumbled across some more specific instructions to decode the bytes but, undfortunately, the code examples were specific to the Raspberry Pi and I'm working with Intel Edison.

Ideally, I'd like to call methods that return temperature and humidity, but a byte array would would also work since I have the 'decoder ring'. Can you see what needs to be done in order to return the temperature/humidity (or byte array)?

Upvotes: 0

Views: 761

Answers (1)

huz_nk
huz_nk

Reputation: 26

A sample C code for DHT11 with Intel Edison is there in one of the links you already shared. One of the section "The Software" describes in detail how the sample program is designed to read the data.

Also there is a discussion on this thread on issues with DHT11 sensor or any other sensor that uses one wire with Edison or similar boards.

Upvotes: 1

Related Questions