DHT22 fail - OneWire DS18B20 fail..... It can't be this hard just to get temps?

Platform Pi4B running Hassos

So after reading the homeassistant DHT22 temp documentation I went out and bought some DHT22’s. I spent a massive amount of time messing around trying to get them to read data only to find out that the PI4 was not compatible due to adafruit issues…there is a 10month old pull request on the issue.

So then I went and bought some OneWire DS18B20 waterproof sensors from ebay thinking they would be my savior… but no, I cannot get these beasts to work either!

I have added dtoverlay=w1-gpio-pullup to config.txt and attached the sensor on gpio4 (pin 7)

I also tried without the pullup flag, defining gpio4 as well as trying a different gpio pin… no help.

I tried running the onewire on both the 3.3v pin and 5v pin… no help

I tried running the sensor in parasitic mode with both pos and neg connected to earth pin…no help

I have tried different gpio pin, different ground pin and different 3.3v pin ( though multimeter shows all power and ground pins are fine)

Then I figured perhaps I may have messed around with something when I was playing with the previous DHT sensor… so I wiped the SD and put a fresh install of Hassos 5.10 on… no help.

When listing W1 devices I just get a couple of 00-80000000 folders which i’ve read is normal when nothing is found.

I bought my DS18B20’s from ebay so I wondered if they were incompatible though they did say Arduino compatible on the listing… I took a drill to one of the sensors and found the chip is a fake version made by a generic chinese company,

I have ordered some Dallas made DS18B20 chips to see if that makes any difference.

Am I not doing something blindingly obvious here ?, Most of these issues that I have read about have been down to wiring incorrectly…but this is not my issues after triple checking pinout diagrams and trying lots of different ways (as well as testing pins with multimeter) along with stripping the sensor wires back and just soldering directly to the pins to ensure good connection.

I assume Hassos default user can access gpio pins fine out of the box ?

Any advise would be greatly appreciated

Are you running the 64 bit version or the 32 bit version of HassOS?

32-bit is required for GPIO support)

32bit, I did note the lack of gpio support on the 64bit when I went for the fresh install (im sure i would have noted that on the original install too)

Have you got a 4k7 resister between data and 3v3 pins?

I’ve had no trouble getting them to work with esp devices.

I’ll paste my config

dallas:
  pin: GPIO14
  update_interval: 5s

Then check the log for a sensor id:
Then set up a sensor in the code with that id:

sensor:
  - platform: dallas
  - name: temperature
  - address: insert sensor id here

Double check the GPIO vs. Pin No. You need to be using the GPIO No. for the DHT22 sensor.

^^ Is this in your esp config?..I don’t see any mention of this config when using pi gpio pins directly?

I am using pi onboard pullup resistor, no external…I will try find a resistor to rule this out today !


Silvrr… There is an open pull request for the known incompatibility issue re DHT22

The 4.7k resistor is needed to inject power into the data pin.

Edit
If you have multiple sensors, just one resistor at the beginning of the data pin series, if your going to connect multiple to one pin.

1 Like

I will give an external resistor a go next, thanks… most examples show people just using the pullup resistor flag on the pi gpio pin in config though ?

Afaik it is a must for a dallas sensor, there is no way around it. I use them with a 4.7k resistor.

Im still waiting on the Dallas branded chips… still using the clone chinese chipped sensors at the moment

The other thing I should note is that a “pull up resistor” is typically used for a switch. It’s looking to be pulled to power or ground. Sometimes referred to as high and low or on and off.

Dallas sensors send digital information. The resistor in this case is injecting power. It’s acting as a gate to so the power only flows in one direction.

1 Like

Well Mr Mike, you have just solved my mystery!.

Tore open an old psu and found a 2k and 2.7k resistor that i strung together and used. Loaded HA back up and instantly saw the sensor device!.

I must have read 5 separate guides, including the official documentation that said either use an external 4.7 resistor or use the -pullup flag in config!.. such a simple issue massively complicated by bad/outdated info.

Thankyou for you advise mate, you probably saved me from throwing the thing at a wall!.

Glad the resistor did the trick

1 Like

Thanks Sam… You were the first to say resistor looking back, muchos gracias !

no problem. its always these little things that are easily overlooked like a tiny resistor.

Wow, I’m running 64bit HassOS on my RP-4 and GPIO is running fine. 1-wire and contacts.

Interesting, the docs say otherwise. I wonder if they are out of date or just not all functions are supported so they don’t state support.