DHT12 i2c ir one wire use

Hey there. I'm trying to use Aosong DHT12 sensor.
This sensor can be used with i2c and one wire connections.
I've tried one wire with DHT11/22 node but couldn't make it work.
I tried i2c too, but didn't work neither.
Is there a library or node that works with this sensor?

By the way, I'm using raspberry pi 3 b, last version of raspbian and Node Red. And I have enabled both I2C and one wire interfaces as well remote gpio.

Thanks in advance.

Always good to search the flows library - https://flows.nodered.org/search?term=dht

Thanks for the reply.
In fact I have installed that node. And even used it before with DHT11 sensor.
But I have a DHT12 Wich is slightly different and I can't make it work.

I've never come across a DHT12. DHT11 and DHT22 is all I've used and I stopped using them a long time ago because of accuracy and drift issues.

If that node doesn't work, you may need to reach out to the author but if they don't have a DHT12, it may be difficult for them to support it.

Is there an Arduino library that supports it or maybe a Python library? That might at least give some clues as to what is needed. Additionally, it is often seems easier to do IoT sensors using an Arduino or ESP8266/ESP32 rather than directly on the Pi.

1 Like

There's no python library.
But there's an Arduino library. https://github.com/xreef/DHT12_sensor_library

Could it be portable to Python?

I expect it could be translated by someone who knows both C++ and Python very well. Of course, they would need to want to do it as well.

As I've not come across this sensor previously, perhaps it isn't commonly used, at least in home automation?

Otherwise, I'm afraid that your other options are to get a better supported sensor or use an Arduino or ESP device (they can be programmed using the Arduino IDE and so can use the same libraries) instead.

This sensor is the actualization of DHT11. So I'm guessing it's relatively new. It may be because of that that It isn't well supported.
I'm gonna keep trying with Python and I2C and if I don't succeed I will try with another sensor.

Anyway, thank you so much for your help.

AS Julian (@TotallyInformation) said, the DHT series of sensors are pretty poor for accuracy. The DHT12 is an I2C sensor, NOT 1-wire. Have a look at the SHT31 from Sensirion, this is available on a breakout board from many suppliers.

SHT31 is way out of my budget.
But anyway, i managed to make it work with one wire and the DHT22 node.

Thanks everyone for your help.

1 Like

These should be in the right price range:

  • HTU21D (replaces SHT21, SI7021, HDC1080) - should be around the same accuracy if not slightly better than the BME280/BMP280

    Cheapest I found with a quick search was Ā£0.97 + Ā£0.87 shipping to the UK

  • BMP280 - high-accuracy, low drift, low cost.

    The BME280 is the same sensor with a barometric pressure sensor added.

    Cheapest with a quick search. Ā£0.27 + Ā£0.64 shipping to the UK.

  • DHT11, SHT11, DHT22, AM2301/dht21, AM2302, AM2303/dht22

    None of these are recommended due to poor factory setup and drift over time. They are also quite slow to respond, will sometimes return invalid values and recover poorly from extreme conditions (e.g. 100% humidity).

    These now appear to be more expensive (though not by much) than the BMP280's

Cheapest DHT12 I could find in stock was about Ā£0.92 + Ā£0.48 shipping to the UK.

So actually, you would be better off with a BMP280 which is well supported and cheap.

3 Likes

Could you post your flow please?

Thanks for the info. I will look into these.

And ghayne, I can't right now.
I can't access to my flow editor.
When I fix it I'll post it. :wink:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.