Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
1,015 Views

Why my dht11 or dht22 not work in my intel galileo gen 1 ?

I have try the air temperature&humidity sensor (dht11 & dht22) in arduino use this sketch:

include "DHT.h"

# define DHTPIN 2

# define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

void setup() {

Serial.begin(9600);

dht.begin();

}

void loop() {

float h = dht.readHumidity();

float t = dht.readTemperature();

Serial.print("Kelembaban: ");

Serial.print(h);

Serial.print(" Suhu: ");

Serial.println(t);

delay(1000);

}

thats work on arduino,, but not work on my galileo gen 1... what should i do? i need your help, thankyou

Tags (1)
11 Replies
Highlighted
Honored Contributor I
12 Views

Hi Radikia_Cuber,

The problem is thoroughly described at . There are several workarunds, all of them use either pin 2 or pin 3, such as that at (I've used it in an Intel Galileo, aka "Gen1", as yours).

HTH,

Fernando.

0 Kudos
Highlighted
Novice
12 Views

Hello FGT,, thankyou for your reply... but i still not understand what AlexT_Intel say,

thats mean we must wait a minute ? or the other? what must i change in the sketch to read the temperature and humidity dht11 ?

0 Kudos
Highlighted
Honored Contributor I
12 Views

Radikia_Cuber wrote:

Hello FGT,, thankyou for your reply... but i still not understand what AlexT_Intel say,

thats mean we must wait a minute ? or the other? what must i change in the sketch to read the temperature and humidity dht11 ?

The problem is basically about the time needed to read a pin, not the delay.

I suggest you download and use the example I posted in the second thread I referred to in y previous post, i.e. more specifically, /servlet/JiveServlet/download/394464-150988/DHT11Example2.zip https://communities.intel.com/servlet/JiveServlet/download/394464-150988/DHT11Example2.zip. It can be used "as is" and you can see the change I made in the library as well as the example with which I've used it. In my case, most of the readings made every 1 second were successful, some of them failed (maybe 1 every 8 IIRC). Failed reads do not mean the DHT11 is not reachable anymore, just retry up to the point you can read a value.

HTH,

Fernando.

0 Kudos
Highlighted
Novice
12 Views

I suggest you download and use the example I posted in the second thread I referred to in y previous post, i.e. /message/394464# 394464 Re: DHT workaround for Galileo and Galileo Gen2 using 2 pins instead of one, more specifically, /servlet/JiveServlet/download/2673-101960-394464-150988/DHT11Example2.zip https://communities.intel.com/servlet/JiveServlet/download/394464-150988/DHT11Example2.zip

Thankyou,,

I have try that,, but still not work... the temperatures and humidity show 0.00.

Is there another way again? for dht11 or dht22?

0 Kudos
Highlighted
Honored Contributor I
12 Views

What do you have? DHT11 or DHT22?

Please send a picture of your setting and specifically your connections.

0 Kudos
Highlighted
Novice
12 Views

I have dht11 and 22, but i want use dht22...

Like that,, Blue wire to 5v, yellow o pin 3 and black to gnd... i try use your code, but it show 0.00

I also try use dht11, there are 3 pin in the dht11 almost same with dht22... the first pin (in the left) to 5v, middle pin to pin 3, and right pin of dht11 to the gnd

But same, the result show 0.00

Please help, thankyou

0 Kudos
Highlighted
Honored Contributor I
12 Views

Well... I don't know what it could fail... my 3-pin DHT11 is ("mostly") working:

"

...

Humidity (%): 40.00

Temperature (C): 20.00

Humidity (%): 40.00

Temperature (C): 20.00

Humidity (%): 40.00

Temperature (C): 20.00

Humidity (%): 40.00

Temperature (C): 20.00

Humidity (%): 40.00

Temperature (C): 20.00

Humidity (%): 64.00

Temperature (C): 160.00

Humidity (%): 40.00

Temperature (C): 20.00

Humidity (%): 40.00

Temperature (C): 20.00

Humidity (%): 80.00

Temperature (C): 40.00

"

Take into account there are erroneous values (e.g. "Temperature (C): 160.00"), which are easy to detect and fix.

My Current setting is almost the same as yours, except I'm using a 3-pin DHT11

Check you are using the correct pins in your 4-pin DHT11.

HTH,

Fernando.

0 Kudos
Highlighted
Novice
12 Views

Thankyou FGT ,, that's work

My mistake before is my dht11 is broke, i try to use new dht11, thats work good...

0 Kudos
Highlighted
Honored Contributor I
12 Views

Radikia_Cuber wrote:

Thankyou FGT ,, that's work

My mistake before is my dht11 is broke, i try to use new dht11, thats work good...

Congrats, you have your setup "up & running". And thank you for let me know the problem.

BR,

Fernando.

0 Kudos
Highlighted
Novice
12 Views

Hi FGT,

I want to ask something about your sketch of dht11

Can i change the value of result dht11 from integer to float??

if can,, how can?

0 Kudos
Highlighted
Honored Contributor I
12 Views

Radikia_Cuber wrote:

Hi FGT,

I want to ask something about your sketch of dht11

Can i change the value of result dht11 from integer to float??

if can,, how can?

Hi Radikia_Cuber,

I think you can. I did not change that part of the original library I used, I changed only the that described in the Readme.txt. Maybe the new DHT library/ies already have the change to float made. Anyhow, I did not decide anything about types, just timing, so I don't know about types.

HTH,

Fernando.

0 Kudos