View: 8358|Reply: 3

Adafruit sensors

[Copy link]

2

threads

2

posts

20

credits

Novice

Rank: 1

credits
20
Published in 2016-4-7 16:53:20 | Show all floors |Read mode
Hi All!

Does anyone have experience in reading DHT11/22 sensors? I tried installing python libraries from Adafruit designed for RPI and Beaglebone platforms without success: running Adafruit-DHT.py raises errors accessing GPIO (line 90 read, line 77 read_retry)


7

threads

49

posts

234

credits

Intermediate member

Rank: 3Rank: 3

credits
234
Published in 2016-4-8 11:07:34 | Show all floors
just come here to see the answers




waterjet cutting machine http://waterjetapw.com
waterjetapw.com

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2016-4-8 22:27:21 | Show all floors
Edited by nopnop2002 at 2016-4-12 06:42

I confirmed the source code.
I think that adafruit/Adafruit_Python_DHT don't works.

There is such code.

def pi_version():
    """Detect the version of the Raspberry Pi.  Returns either 1, 2 or
    None depending on if it's a Raspberry Pi 1 (model A, B, A+, B+),
    Raspberry Pi 2 (model B+), or not a Raspberry Pi.
    """
    # Check /proc/cpuinfo for the Hardware field value.
    # 2708 is pi 1
    # 2709 is pi 2
    # Anything else is not a pi.
    with open('/proc/cpuinfo', 'r') as infile:
        cpuinfo = infile.read()
    # Match a line like 'Hardware   : BCM2709'
    match = re.search('^Hardware\s+:\s+(\w+)$', cpuinfo,
                      flags=re.MULTILINE | re.IGNORECASE)
    if not match:
        # Couldn't find the hardware, assume it isn't a pi.
        return None
    if match.group(1) == 'BCM2708':
        # Pi 1
        return 1
    elif match.group(1) == 'BCM2709':
        # Pi 2
        return 2
    else:
        # Something else, not a pi.
        return None

pi@raspberrypi:~ $ cat /proc/cpuinfo | grep Hard
Hardware        : BCM2708

orangepi@OrangePI:~$ cat /proc/cpuinfo | grep Hard
Hardware        : sun8i





0

threads

9

posts

62

credits

Registered member

Rank: 2

credits
62
Published in 2016-5-23 21:48:52 | Show all floors
Hi,
I have pluged 2 DHT11 sensors in the Orange Pi PC. The values are read out by a c-program.

https://github.com/ook/dht11-json

You must install WiringOP

https://github.com/zhaolei/WiringOP

and then you are able to compile the source with the command

cc -o bin/dht11 dht11.c -L/usr/local/lib -lwiringPi

In the c-listing line 16 (#define DHTPIN        7) you can set your IO-port. I this case is it IO-7.






You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list