DHT 22 Sensor does not Work :/
-
-
@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!
-
I am also looking for this. Hopefully someone has the file and can re-upload it. Thanks!
-
Any updates about this?
-
I am looking to, any hints?
-
Maybe if you use an arduino as interface between sensor and omega2, arduino libraries work very well and then trough UART you can pass the values to omega and read serial port with PHP or python., i was tryinig to adapt this python code (http://www.uugear.com/portfolio/dht11-humidity-temperature-sensor-module/) from raspberry PI to omega2 changing respective GPIO libraries without succes, so i decide implement arduino interface. https://ibb.co/evW87k
-
This post is deleted!
-
Hi all
Good news. I migrated original code successfully to work on Omega2!
See https://github.com/h0l0gram/omega2-checkHumidity for binary and source.Make sure your Omega2 has firmware >=0.1.10 b160 or it won't work.
root@Omega-1234:~# oupgrade -c > Device Firmware Version: 0.1.10 b160 > Checking latest version online... > Repo Firmware Version: 0.1.10 b160 > Comparing version numbers > Device firmware is up to date! root@Omega-1234:~#
See https://docs.onion.io/omega2-docs/using-the-omega-updating.html