Welcome! Log In Create A New Profile

Advanced

Using GPIO on pogoplug with the DHT022 to measure temperature

Posted by jrey 
Using GPIO on pogoplug with the DHT022 to measure temperature
January 21, 2021 10:04PM
I have been testing the temperature sensor DHT022 with the 40-pin GPIO of a raspberry pi and it is working wonderfully. Now I am trying to see if the same thing can be done with a pogoplug or a dockstar. The sensor essentially uses 3 pins: a 3.3V, a ground and a output data (I believe it is binary). Just wondering if this is at all possible with the pogoplug?

Thank you.
Re: Using GPIO on pogoplug with the DHT022 to measure temperature
January 21, 2021 10:41PM
jrey,

Sounds like a 1-wire sensor. You should post the bootlog for the rPi when this is connected. And how you get the output data in userspace while it is running in rPi.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Using GPIO on pogoplug with the DHT022 to measure temperature
January 22, 2021 12:16AM
bodhi,

Thanks for prompt response. I think it has come across my eye that it is digital but not compatible with 1-wire in one of the spec sheet (if I got what I read). Anyway, I followed the instruction from
https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/python-setup and download a library from here.

Could you tell me where to find the bootlog in rPi? After installing the library, I then run a python script given there that looks like this:
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
 
import time
import board
import adafruit_dht
 
# Initial the dht device, with data pin connected to:
dhtDevice = adafruit_dht.DHT22(board.D18)
 
# you can pass DHT22 use_pulseio=False if you wouldn't like to use pulseio.
# This may be necessary on a Linux single board computer like the Raspberry Pi,
# but it will not work in CircuitPython.
# dhtDevice = adafruit_dht.DHT22(board.D18, use_pulseio=False)
 
while True:
    try:
        # Print the values to the serial port
        temperature_c = dhtDevice.temperature
        temperature_f = temperature_c * (9 / 5) + 32
        humidity = dhtDevice.humidity
        print(
            "Temp: {:.1f} F / {:.1f} C    Humidity: {}% ".format(
                temperature_f, temperature_c, humidity
            )
        )
 
    except RuntimeError as error:
        # Errors happen fairly often, DHT's are hard to read, just keep going
        print(error.args[0])
        time.sleep(2.0)
        continue
    except Exception as error:
        dhtDevice.exit()
        raise error
 
    time.sleep(2.0)


There was a lot of error during reading so the routine just ignores when that happens.
Re: Using GPIO on pogoplug with the DHT022 to measure temperature
January 22, 2021 03:23AM
jeyrey,

> Could you tell me where to find the bootlog in
> rPi?

If you don't have serial console, then dmesg output

dmesg

It should show how the sensor was detected.

=====

With the factory GPIO interface like rPi, it is easy. But on Pogoplug, you would have to do soldering to expose the pins. So I'm not sure that is what you want.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: