I’m trying to use an RPi Pico W as a temp/humidity sensor using a DHT20.

It kind of works - at least sometimes, but I keep “losing” sensors more or less randomly.

I connected everything up like here (using MicroPython): https://github.com/flrrth/pico-dht20 There are currently 4 sensor-boards, 3 soldered, one on a breadboard.

The error modes I could observe are:

  1. DHT20 fails to init - sometimes after the first read, sometimes after days. Resetting the machine works sometimes, if not, power cycling usually does the trick

  2. The board just “stops” after about 5min - the serial console just says “device disconnected”. Power cycling is the only option.

My measurement work by having a timer fire every minute, connect to wifi, read from the sensor, and then send an mqtt message (either the values or an error message) and shutdown wifi again.

My current ideas why it could fail (but I’m not an electronics guy at all):

  • There is some kind of “rogue current” messing with some IC.
  • Some component is broken
  • Maybe the power draw is too low or issuing sleep() messes with the USB-power connection somehow?

For me the problem is, I don’t really know where to look for errors. The software works in principle, the soldering seems to be good enough to sometimes work for days, and looking too deep into the whole electronics side is beyond my capabilities.

  • @JoCrichton
    link
    English
    11 year ago

    Do you have a pull up on the DHT20? If not that could explain the reliability issues. 4.7k is needed according to the datasheet.

    Not too familiar with the RPi Pico but you might need to disable the internal pull ups if you do that but they are likely too weak so I wouldn’t rely on them.

    • AggressivelyPassiveOP
      link
      fedilink
      English
      11 year ago

      I looked it up here: https://aqicn.org/air/sensor/spec/asair-dht20.pdf (I guess that’s the same datasheet you used)

      There it says:

      To avoid signal conflicts, the microprocessor (MCU) must only drive SDA and SCL at low level. An external pull-up resistor (for example: 4.7kΩ) is required to pull the signal to a high level. The pull-up resistor has been included in the I/O circuit of the DHT20 microprocessor.

      This sounds to me like it’s already present in the package? I also haven’t seen any tutorial using any resistors (though that may be just an “error” made by all of them to keep it simple).

      • @JoCrichton
        link
        English
        2
        edit-2
        1 year ago

        Yeah on that specific board it looks like it’s included . I was just going from experience. I just wired such a sensor to an Arduino the other day and I was having problems without the pull up. I was seeing garbled data packets on the data line.

        edit: you can easily confirm this by measuring the resistance between VCC and Data on the sensor.