Interfacing

raspberry read temperature from DHT11

43 17105
MonkeyG  
Great, problem solved in v3.1
Here are the results using the code above.

root@lemaker:/tmp# ./TempTestDHT11
Use GPIO1 to read data!
Enter OS-------
Congratulations ! Sensor data read ok!
RH:62.0
TMP:31.0
Congratulations ! Sensor data read ok!
RH:59.0
TMP:30.0
Congratulations ! Sensor data read ok!
RH:58.0
TMP:31.0
Congratulations ! Sensor data read ok!
RH:58.0
TMP:31.0
Congratulations ! Sensor data read ok!
RH:59.0
TMP:30.0
Congratulations ! Sensor data read ok!
RH:58.0
TMP:31.0

ghoddan  
Hello Friends,
i'm trying to read the DHT sensor too. I copied the code julie20082004. But when i try to compile it with: gcc -o dht_read dht_read.c -L/usr/local/lib -lwiringPi
i get lots of errors like this:
dht_read.c:93:1 error: stray '\302' in program
dht_read.c:93:1 error: stray '\302' in program

ghoddan  
Does anyone know this error, what does this mean?

Thanks

ghoddan  
Hello,
i fixed the last problem. It was because i copied the code from the browser.
But now i have another problem:
when i run the programm, the result is:
Congratulation!....
RH: 255.255
TMP 255.255
???

Reply 11# MonkeyG

Hi MonkeyG,could you please share your code here?

Reply 10# MonkeyG


    the V3.1 version
digitalWrite( DHTPIN, HIGH );
    pinMode( DHTPIN, INPUT );
I set a delay 1ms in each function for steady the gpio level because I use a long wire to do the test,so  I will remove the delay in laser version .

Post Last Edited by actkk2000 at 2014-9-15 19:26

I tried Julie's script for WiringPi with DHT11 sensor and it worked out of the box.
No other script from internet worked for me, just the one in the first page of the post.
This has been tested on BananaPi running Raspbian 3.1
Previously it read temperature data from a DS18B20 probe, now it also can read humidity.
Then I modified my Python temperature script to read data from WiringPi script and show it in my led display.
It took me a couple days but at last I finally made it!


tosiara  
Edited by tosiara at Tue Nov 4, 2014 03:42

Hi,

I'm trying to make my DHT11 (sold as "R1B1") working. Connected "+" to 5V, "-" to GND, "out" to GPIO1 (pin #12 of CON3) (wiki)
Using Lubuntu 3.1.1 kernel 3.4.90, installed WiringBPI from here: https://github.com/LeMaker/WiringBPi
Compiled the code from the first post:
  1. gcc -o mydht11 mydht11.c -L/usr/local/lib -lwiringPi -lpthread
Copy the Code
When running code I get:
  1. # ./mydht11
  2. Use GPIO1 to read data!
  3. Enter OS-------
  4. Sorry! Sensor dosent ans!
Copy the Code
And program hangs
After running few times program seems to stop working at all, even no "sorry":
  1. # ./mydht11
  2. Use GPIO1 to read data!
  3. Enter OS-------
Copy the Code
And program just hangs
To make it reporting "Sorry" I need to reboot BananaPi

What should I try to debug? What is wrong: sensor, connection, WiringBPI, Lubuntu?

Please follow these intructions on how to connect DHT11:
https://learn.adafruit.com/dht-h ... docs-logging/wiring

You have to connect it to 3.3V on header 1 pin and to a 4.7k resistor (or 10k if it doesn't work)

tosiara  
Edited by tosiara at Tue Nov 4, 2014 07:00

Does it mean it is required to use 4.7K resistor?
Because current forum thread does not contain any information about connecting a resistor

You have to log in before you can reply Login | Sign Up

Points Rules