We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

DHT11 and DHT22 temperature humidity sensor code



  • Put that source code up on GitHub. Looks like derivative work from the AdaFruit site, which is good (+1 for code reuse).

    Link to GH site please! 馃檪



  • Also, am able to run on 0.0.5 b244 and successfully getting data.

    It should be noted that I could not get data connecting to the 3.3V, instead I had to use the 5v connector for my DHT22 device.

    root@Omega-107F:~# ./checkHumidity 0 DHT22
    39.900002
    21.299999
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.900002
    20.700001
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    35.000000
    20.600000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    35.000000
    20.600000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.700001
    20.600000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.500000
    20.600000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.400002
    20.600000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.400002
    20.600000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.400002
    20.600000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.200001
    20.500000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.400002
    20.500000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.500000
    20.500000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    34.400002
    20.500000
    
    --Took a deep breath on the sensor here
    
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    47.200001
    20.700001
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    47.299999
    20.600000
    
    --Took a deep breath on the sensor here
    
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    63.000000
    21.000000
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    62.000000
    20.799999
    root@Omega-107F:~# ./checkHumidity 0 DHT22
    58.900002
    20.700001
    root@Omega-107F:~#
    


  • Cool!

    I'm a complete newcomer to the hardware/circuit/IoT stuff and for my first hardware project I was thinking about doing something with the Omega and a DHTXX.

    I've seen some examples of the DHTXX with Arduino and Raspberry, but I'm a little clueless about how to do it with the Omega since the output voltages seem to be different (only 2.8 for the Omega).

    Can you please share a picture or diagram of your setup?!



  • It works! 馃憤

    On pin 1 and +3.3V

    Screenshot:

    IMG_0181.jpg
    IMG_0182.png



  • Mine works too!! 馃憤

    IMG_3184.JPG
    IMG_3185.JPG



  • I'm a C dummy, how can I use it on my onion. Is there something in Python available.

    Thomas



  • @Thomas-Krampe Here an example in python:

    # -*- coding: utf-8 -*-
    import subprocess
    
    pinNumber = 8
    sensorModel = 'DHT11'
    
    proc = subprocess.Popen(['./checkHumidity ' + str(pinNumber) + ' ' + sensorModel], stdout=subprocess.PIPE, shell=True)
    (out, err) = proc.communicate()
    
    sensor_data = out.split('\n')
    humidity = sensor_data[0]
    temperature = sensor_data[1]
    
    print "Humidity:"
    print str(humidity) + "%"
    
    print "Temperature:"
    print str(temperature) + "掳C"


  • @Riccardo-Chiarini this is the script that actually uses the same application. i don't think he was looking for that kind of an example 馃檪



  • Hello!
    I'm a real newbie and can't solve a problem. after the line checkHumidity/bin# ./checkHumidity 11 DHT11 it says: syntax error: unexpected "(" (expecting ")")
    What does that mean? I'm really hopeless..



  • @J贸zsef-Schuck You're using the Omega1 binaries. They don't work on the Omega 2.



  • @WereCatf Where the binaries for omega2 can be found? Thanks.



  • 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/updating-the-omega.html

    Example

    root@Omega-1234:~/checkHumidity# ./checkHumidity 19 DHT22
    48.299999
    28.299999
    


Looks like your connection to Community was lost, please wait while we try to reconnect.