Le Potato with DHT22

Hi there,

I was hoping that someone could assist me with retrieving values (temp/humidity) from a DHT22 sensor. I think what I need to do is to use the Adafruit_DHT library in Python to retrieve these values, but I’m running in to an issue even getting started with that. When I try to run the AdafruitDHT.py script, it fails to run because it is not on actual Pi hardware - “RuntimeError: Unknown platform”. Is there any workaround for this, or any other way to retrieve values from the sensor?

I have the sensor’s data line plugged in to pin 5, and from “lgpio header 7J1” I can tell that this pin is on chip 0 line 4. I ran “gpioget 0 4” and it just returns a value of 1. What am I doing wrong here? I’ve tried the sensor on both 3.3v and 5v.

Any help is appreciated, thank you!

Have you tried installing Adafruit_Blinka and the circuitpython DHT22 library?

Installing CircuitPython Libraries on Raspberry Pi | CircuitPython on Linux and Raspberry Pi | Adafruit Learning System

Adafruit_Blinka does have board support for the Le Potato and I know it works for digitalio library and I2C. I have had a few problems with SPI and raised an issue accordingly but no other problems.

Thank you for the reply! I just installed both with PIP3 and got much further than before (actually getting something from the sensor). I get back 1 of 2 messages: mostly “A full buffer was not returned. Try again.”, and occasionally “DHT sensor not found, check wiring” (I know that one is somewhat expected with this sensor). I’ve read that the first message is a known problem with the Adafruit_CircuitPython_DHT module.

That being said, is there a better temp/humidity sensor (perhaps I2C as I think that would make this more flexible for our use-case) that is known to work with the Le Potato?

(Note that I am no longer using pin 5 on the 40 pin header in the below scenario - now on header 2J1 pin 2, with another sensor connected to 2J3 pin 3.)

import time
import board
import adafruit_dht

dhtDevice = adafruit_dht.DHT22(board.P2J12, use_pulseio=False)
# P2J33  P2J12

while True:
        temperature_c = dhtDevice.temperature
        humidity = dhtDevice.humidity
            "Temp: {:.1f} C    Humidity: {}% ".format(
    except RuntimeError as error:
    except Exception as error:
        raise error



DHT22 is a I2C temperature regulator. First enable the proper I2C device via ldto and then point the library to the proper I2C device.

I don’t believe the DHT22 sensor is an I2C device so I’m not sure that approach would work.

If Michaelredus could provide details of the DHT sensor that would be helpful. Depending on the configuration/ breakout board then pull up resistors may be required ?

I would have definitely stuck with regular gpio pins - P29 P31 P33 P35 P37 are a good bet.

It might also be a good idea to confirm that the chosen pin can read a simple output from a switch using the digitalio library first.

Overview | DHT Humidity Sensing on Raspberry Pi or Beaglebone Black with GDocs Logging | Adafruit Learning System

These definitely are the most common sensors for this application - I have one kicking around somewhere so I’ll try and find it and test it with the Le Potato.

I didn’t think this sensor was I2C, but based on librecomputer’s response I found that maybe it is using onewire? Going off of that I tried to apply the onewire overlay (w1-gpio) and use pin 7 on header 7J1, that resulted in the sensor actually returning “None” readings (which I think is just null, see screenshot below). I will definitely give your suggestion a try here shortly.

Here is the exact sensor that I’m using (It has a 512 SMD resistor onboard):
DHT22 Sensor on Amazon

For reference, here is the latest python code I am using:

import time
import board
import adafruit_dht

dhtDevice = adafruit_dht.DHT22(board.P7) #, use_pulseio=False)
#dhtDevice = adafruit_dht.DHT22(P2J33) #2J12

while True:
        temperature_c = dhtDevice.temperature
        humidity = dhtDevice.humidity
        #    "Temp: {:.1f} C    Humidity: {}% ".format(
        #    temperature_c,humidity
        #    )
    except RuntimeError as error:
    except Exception as error:
        raise error


Interestingly, in this configuration I can actually get what I think is the sensor’s address? (This may have been possible in the previous configuration, I didn’t try).

It seems that most of the time I end up right back at the “A full buffer was not returned. Try again.” error.

potato@lepotato:~/test $ sudo python3 basic_dht.py
Traceback (most recent call last):
  File "/home/potato/test/basic_dht.py", line 7, in <module>
    temperature = dht.temperature
  File "/usr/local/lib/python3.9/dist-packages/adafruit_dht.py", line 274, in temperature
  File "/usr/local/lib/python3.9/dist-packages/adafruit_dht.py", line 230, in measure
    raise RuntimeError("A full buffer was not returned. Try again.")
RuntimeError: A full buffer was not returned. Try again.
import board
import adafruit_dht

dht = adafruit_dht.DHT22(board.P31)

temperature = dht.temperature
humidity = dht.humidity


Just for science, I switched the script to look at P37 rather than P31 where the DHT22 is hooked up and indeed every time I got the “DHT sensor not found, check wiring” error.

Well the good news is your not alone - I get the full buffer was not returned error so it seems that there is an issue with the CircuitPython DHT Library for this sensor.

I hooked up the DHT22 to a NodeMCU ESP8266 (along with an ILI9431 which is another frustration) and in about 1/2 an hour I had a fully functioning system with a color 320x240 display using the Arduino ILI9431 library and the Arduino Adafruit DHT sensor library. In the process I confirmed my Hardware was ok.

I’ll dig into the CircuitPython DHT 22 library to see if I can figure out the problem as it would be great to have appropriate solutions for such common activities on the Le Potato.

Well that’s good to know - here is some information I was able to gather that may assist you:

By looking for the error message in the source module (adafruit_dht.py) I figured out that not all of the pulses are making it back, so I modified the the module to print the number of pulses in the array when the condition that triggers the buffer error is met and I found that the number of returned pulses is wildly different each time.

In my tests I only get about 70 of the required 81 pulses.

This definitely seems to be more of a problem with the Library and Linux Architecture.

There does seem to be some comparable sensors with I2C capability for the same sort of price range as the DHT11 so it seems like that is the better route to go - but it doesn’t help you !!

It will be a good opportunity to dig out the Oscilloscope to try to get a bit more information. I do know that the circuitpython library can’t use pulseio with Linux and so is forced to use a cruder routine which clearly isn’t reliable.

I left a script running over the weekend that just polled 2 sensors constantly - alternating between each every second or so and would break once it returned a valid reading. It did manage to finally get one valid reading over the weekend after many runs (19,344 to be exact). My goal here is to have a temp/humidity sensor in a room different to the Le Potato. The DHT22 in theory should be perfect for that, I read somewhere on a spec sheet that it can transmit down a considerable length of wire. If I’m not mistaken, I2C is only good for a very short distance right? What do you think may be another viable alternative if this sensor doesn’t work out? I’ve read about one wire, and maybe that’s something to look in to but (granted I’m not entirely sure what I’m looking for) I could only find sensors such as the DS18B20 that don’t include humidity.


AHT10/20 seem like pretty good options for an I2C board and there is a library for them.

adafruit-circuitpython-ahtx0 · PyPI

My old Xmas light Pi2 based led matrix has been going up for the last 10 years and the cables are at least 20ft long to an MCP23017 based I/O expander driving 32 outputs to create multiplexed characters & patterns so I would say its pretty reliable !

Going off of that, we will give this sensor a try. Once they arrive and I give them a try I will update this thread. Thanks again!

Update as promised:

The AHT20 sensor arrived, however it gives pretty inaccurate readings, I will mess with my script and see if I can get it reading correctly.

However, I also got some DS18B20 sensors that use the 1-wire protocol and those are working perfectly! I have multiple sensors with their data lines both leading back to the same pin on the Le Potato and am able to read each sensor’s value accurately. The only downsides to these sensors are that they don’t have humidity reading capabilities and also that since they have a larger thermal mass they are slower to respond to changes in temperature. If only I could get a 1-wire humidity sensor then we’d be in business…

DS18B20 (one in a light fixture for testing, the other just getting an ambient temp):
These seem pretty spot-on.

AHT20 (in ambient temp, near the ‘cool’ DS18B20):
The humidity may be accurate, but the other measurements for sure aren’t.

Glad you at least got some values. I will take a deep dive into the DHT22 some time but busy on a few other projects at the moment.

I too, have the same exact problem “A full buffer was not returned. Try again.” Same sensor as well.

Also same here :smile: - if you have a moment, can you share how you were able to get 1-Wire devices to work on the AML-S905X-CC / Le Potato?

So far, I’ve tried adding dtoverlay=w1-gpio to boot/config.txt, but cannot get anything to show up after:

sudo modprobe w1-gpio
ls -l /sys/bus/w1/devices/

Did you have to do anything special with pin outs?

Thanks in advance!!

Did you read about the Libre Wiring Tool ?

Libre Computer Wiring Tool - Hardware - Libre Computer Hub

Normally you can just enable the Overlay using the tool and you don’t have to mess with any other configuration.

There does appear to be a w1-gpio overlay, which I suspect Michael used but he can comment further !!

thank you @Iain_R - normally i’m better at digging (was a long night :sweat_smile:) - appreciate it!

ldto enable w1-gpio

did the trick on GPIOCLK_0 #7


Be nice people! this is my first try all this.

Couple things confusing me. here’s my set up.

Le potato with debian from their website.
I enabled GPIO from the rasp-config menu
I ensure the Config.txt has that famous line.
to be sure, I enable w1-gpio

I’m currently trying to set a DS16B20.
I made a mistake when I ordered my resistor and currently only have a 2ohm. maybe that the core issue? the 4 Ohm is on its way.

First questions

  • Should I use 5.5 or 3V, the sensor seems to support both. FYI, I will have 2 sensors connected to one wire. Simply tring to get one going.

  • which pin!?!? pin 5 seems to be for GC0:4 would that be the one? I also notice people connecting to pin 7. I tried both, doesn’t seem to work.

Because I’ll be using openhab to report my value, I need to have (unless you have better idea) w1/device/XYZ configure. When I ls ondevice, I don’t see anything.

Please help!

I just found this:

It should be possible to use the sensor with an overlay.


I’ve been trying to look at DHT-11/DHT-22 DTO’s for other boards. So far I’ve only found a RPi overlay, and contains some Pi specific weirdness per usual. This is what I’ve come up with. It compiles and enables, but nothing new shows up in /sys/bus/iio/devices/ :

 * Overlay to enable DHT-11/DHT-22 Temperature/Humidity Senor


#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/gpio/meson-gxl-gpio.h>

/ {
	compatible = "libretech,cc", "amlogic,s905x", "amlogic,meson-gxl";

	fragment@0 {
		target-path = "/";
		__overlay__ {
				dht11: dht11@0 {
					compatible = "dht11";
					gpios = <&gpio GPIOCLK_0 GPIO_ACTIVE_HIGH>;
					status = "okay";