DHT 22 Sensor does not Work :/
-
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
-
@h0l0gram PSA: wiki.onion.io is documentation from the original Omega1 days!
See docs.onion.io for our shiny, brand new documentation.
For updating, see: https://docs.onion.io/omega2-docs/using-the-omega-updating.html
-
@MultiDJRoni ,
The picture of the connections show the wires on one side and the sensor on the other side of the breadboard. These lines usually don't connect across the middle. IE it is an open circuit, so you can place an IC in the middle. Try connecting it all on one side.
-
This post is deleted!
-
@h0l0gram Thank you for the excellent conversion code for checkhumidity. It works great for me. The only issue I am having is that if the DHT22 sensor is plugged into the Omega before the omega is turned on, the omega won't boot. I have to disconnect the sensor to gt the omega2 to boot.
Has anyone else seen this?