DHT 22 Sensor does not Work :/
-
Hey Guys
I have tried to make a weather station to read how frustrating it is to go out this morning xd
I have done this following this Tutorial here: https://wiki.onion.io/Tutorials/PHP-DHT11-DHT22-Sensor-Examples
But my Problem is, that it just shows 0`s
Here is my "Result Page" and my PHP script, and also how i plugged in the Sensor. ![alt text](http://i.imgur.com/afiVQnB.jpg)http://imgur.com/a/YGbNR
Thans a lot for your help and have a nice day :thumbsup_tone2:
-
@MultiDJRoni The code is for Omega1 and that's why it ain't working. fastgpio.c and fastgpio.cpp need changes to work on the Omega2.
-
@WereCatf Oh :C And where do i need to change it? And what do i need to change?
Im sorry, im new in the "IOT" and i have just some expirience with the Arduino, but i really like the Omega. So im thankfull for everyone that can help me
-
@MultiDJRoni please use google first !
-
@Luciano-S. said in DHT 22 Sensor does not Work :
@MultiDJRoni please use google first !
That's quite rude. None of his questions are really answerable by Google anyways.
-
@MultiDJRoni Well, if you're new to IoT and you only have some experience with Arduino, I am going to assume you wouldn't have the skills to understand the changes needed. (Don't take this as an insult.) So, here's a link to my version of the said package: https://dl.dropboxusercontent.com/u/11811685/checkHumidity.tar.gz -- I changed the code and I compiled it for the Omega2, but I haven't actually bothered testing if it works or not. Please, do report back if it works, so others may also benefit from it.
-
-
@Luciano-S. OP's problem is that the code in question uses mmapped access to the GPIO-registers directly to set and get their state, but the code was using wrong register-addresses, as it was for the Omega1. It's a complicated thing for a relatively inexperienced person to solve and I doubt he'd have been able to figure out what to Google for in the first place.
Anyways, I'll just go back to lurking and waiting, if he replies back with success or no success.
-
@Luciano-S i googled the whole morning xd But there was nothing that really helped me out
@WereCatf Thank you so much for your help! Well, if i now check the Temperature with "./checkHumidity 1 DHT22" it says "Segmentation fault" and the PHP does still just show "0`s" :c
-
@MultiDJRoni What firmware-version are you on? If your firmware-version is newer than 0.1.6 b137 then that's the issue -- see the thread https://community.onion.io/topic/1208/do_page_fault-sending-sigsegv-to-fast-gpio-for-invalid-read-access-from-00000600/3
-
Ok im downgrating the Firmware and text back as soon as i know something new
-
@WereCatf Ok it works more or less now xd But now it says "Unable to read sensor, check the wiring, pin number!"
Code:
<?php
$result = get_dht_values(6, "DHT22"); // change the pin number and DHT type accordingly
$message = $result[0];
$temp = $result[1];
$humidity = $result[2];if( $message == "success" ) {
// if successful, happy days let's spill the data out
echo "<p>The current temperature is <b>" . $temp . "Ā°C</b> and the humidity is . <b>" . $humidity . "%</b>" ;
} else {
echo "Error: " . $message;
}function get_dht_values($pin, $dht_type) {
if( ( $dht_type != "DHT22" ) && ( $dht_type != "DHT22" ) ) { return array("Invalid DHT Type", 0, 0); } // Run the command using the exec() function, delivers the output in $output exec("/root/checkHumidity/bin/checkHumidity $pin $dht_type 2>&1", $output, $return); // -255 = bad if( $output[0] == "-255.000000" ) { return array("Unable to read sensor, check the wiring, pin number!", 0, 0); } // must be all good, lets return the data $output[0] = number_format( (float)$output[0], 2, '.', '' ); // temp $output[1] = number_format( (float)$output[1], 2, '.', '' ); // hum return array( "success", $output[0], $output[1] );
}
The Sensor is connected to PIN 6 on the OMEGA 2
-
@MultiDJRoni I just tested my code with a DHT22 on GPIO11 and it's working just fine and peachy for me. You should check that the pin you're using actually works and that your DHT-module has a pullup-resistor and capacitor (and you should add those, if they are missing).
-
@WereCatf Hmm, it still does not work
-
@MultiDJRoni Did you test that the GPIO-pin works?
-
@WereCatf Yes, i tried 1,6 and 11
-
@WereCatf Hmm, i tried a different Breadboard, re arranged the Cables etc. and i still get an error
-
@MultiDJRoni I would like to help, but I don't know what's wrong. I know it works fine for me, so the error isn't in the code.
-
@WereCatf hmm Well anyways thanks for trying to help me
-
Dropbox link is no longer valid. Does someone have working bins for Omega2?
Thanks!