junki Posted September 1, 2016 Posted September 1, 2016 I am trying to use a DHT21 with a Lamobo R1 aka Banana PI R1 to read temperature and humidity, with Armbian/Jessie and a 4.5.2 kernel. A Lamobo R1 is basically an A20 board raspberry pi compatible, with an inverted compatible raspberry pi v2 bus. I have setup it up in GPIO5, raspberry pin compatible 24, WirinPi 5, physical pin 18, according to a table here, plus the GND and +5V pins. I tried to read the temperature and humidity with and without the recommended resistor. While the temperature is reading fine, and is also corroborated by a DS18b20 sensor connected to GPIO2, which indicates the setup is fine, the humidity is always at 99.9%. I have installed the WiringPi compatible library from WiringBP repository. However, using for instance DHT21-AM2301 or lol_dht22 I have got always the output of Humidity as 99.9% or 99.90% A custom kernel module for this chip, am2301 simply hangs the machine. What I have found until now is: It seems to work with Raspberry and Arduino; The chip is highly sensitive to timings, even in a raspberry; Some people did report it only worked in GPIO1 and GPIO2 in the original raspberry, whilst the other GPIOs had much greater latency; There is a much more complicated hardware setup to connect it to a I2C, in which I am not particularly interested; Some people also theorise it only works with kernel 3 (however I am reading temperature) Lamobo R1 seems to have a pullup pin bus by default; Readings can be done only every second; The physical implementation of the R1 bus relating to the rpi allow me to get without the resistor; the limit of cable seems to be 25m, and there are anecdotal tales of people achieving 60m with UTP cable. Mine is no longer than 20cm. Does anyone has anything else to add? Additional notes as per comments: Humidity comes first than temperature; as @ChrisStratton theorised, humidity bits are all 1; I have already tested two DHT21 sensors with the same results. The output of gpio readall is +----------+-Rev3-+------+--------+------+-------+ | wiringPi | GPIO | Phys | Name | Mode | Value | +----------+------+------+--------+------+-------+ | 0 | 17 | 11 | GPIO 0 | IN | Low | | 1 | 18 | 12 | GPIO 1 | IN | High | | 2 | 27 | 13 | GPIO 2 | IN | Low | | 3 | 22 | 15 | GPIO 3 | IN | Low | | 4 | 23 | 16 | GPIO 4 | IN | Low | | 5 | 24 | 18 | GPIO 5 | OUT | High | | 6 | 25 | 22 | GPIO 6 | IN | Low | | 7 | 4 | 7 | GPIO 7 | IN | Low | | 8 | 2 | 3 | SDA | ALT5 | High | | 9 | 3 | 5 | SCL | ALT5 | High | | 10 | 8 | 24 | CE0 | IN | Low | | 11 | 7 | 26 | CE1 | IN | Low | | 12 | 10 | 19 | MOSI | ALT5 | Low | | 13 | 9 | 21 | MISO | ALT5 | Low | | 14 | 11 | 23 | SCLK | ALT5 | Low | | 15 | 14 | 8 | TxD | ALT0 | Low | | 16 | 15 | 10 | RxD | ALT0 | Low | | 17 | 28 | 3 | GPIO 8 | IN | Low | | 18 | 29 | 4 | GPIO 9 | ALT4 | Low | | 19 | 30 | 5 | GPIO10 | OUT | High | | 20 | 31 | 6 | GPIO11 | ALT4 | Low | +----------+------+------+--------+------+-------+
vlad59 Posted September 2, 2016 Posted September 2, 2016 Hi, I'll try to help even if I only own many DHT22 and no DHT21. I have one Banana Pi (basically the same as Lamobo R1) which is reading temperature and humidity (with the DHT22), here is my configuration : * the program used is lol_dht22 on top of WiringBp * the DHT22 is powered with 3.3V (not 5V) * my cables are small (10~15cm) * I have a 4.7K pullup resistor (it was mandatory for me, removing it caused bad CRC almost everytime), I guess you can use resistor from 1K up to 10K with the same effect. * I used it with legacy kernel (3.X) for one year and use it with modern kernel (4.X) for another year and it's still going * my Banana pi is up 24/7 and read value from DHT22 every 15 minutes So my advice : use 3.3V, use a real pullup and make sure there is zero load on your Lamobo when you make the test (to make sure all timings can be handled)
vlad59 Posted September 2, 2016 Posted September 2, 2016 Another advice. If you need a good quality sensor (especially for humidity), BME280 is a better choice (with a higher price, I know) and you get a pressure sensor for free. it's also using i2c so easier to handle. If you wish to keep the price low SHT21 can be found around 3€ (Aliexpress) and it's still i2c.
Recommended Posts