Hong Kong
Asked — Edited

Question: Using Dht11 Humidity &Amp; Temperature Sensor

Hello everyone,

I am a newbie in this community, and just joined in the last month. It is a honor to start a conversation here in the forum.;);) ;)

Currently, I am trying to integrate DHT11 into my robot. I am not very sure about how to apply this single-wire two-way serial interface with ezb v4. Could everyone please share his/her knowledge about this here? :)

I have gone through the past discussions about this topic, and it seems no progress has been made during the past one year.

So is it possible to use single-wire two-way serial interface with ezb v4? As far as I know this single-wire serial communication is kind of popular for MCU. Hope to hear from DJ regarding this issue.


ARC Pro

Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.

#1  

You will need 2 wires for serial communications... 1 for data and the second for ground (common ground)... Also the ezb4's data pin is 3.3v so you may need a logic level shifter if the DHT11 is 5V..

#2  

It looks like the sensor require 5V, Ground and Signal. It is a one way signal in that it doesn't receive data. It only sends data to the EZ-B. The datasheet for the sensor will tell you if it sends 5V or 3.3V serial signal. The EZ-B serial port is 3.3 V so as Richard said, you might use a logic level converter to handle the conversion from 3.3V to 5V and 5V to 3.3V. It is also possible to just use one of the digital pins instead of the serial port for this sensor I believe.

PRO
USA
#3  

if you have a plain sensor DHT11 4 pins can't be used with an EZB.

if you have a shield with some electronics and i2c protocol then you can use the EZB i2c interface.

PRO
USA
#4  

if you really want to use the DHT11 then the solution is to use an arduino mini 3.3v, do some code, read the DHT11 sensor and print the values to the serial port, then connect the arduino serial port to an EZB's serial port.

I recommend looking for a I2c sensor, one example:

https://www.adafruit.com/products/1899

PRO
Canada
#5  

Looking at the Datasheet it seems that the DHT11 can be used at 3.3V. The input voltage is rated from 3-5.5VDC. The timing may be difficult to do with the ez-b but from a voltage stand point it will work.

PRO
USA
#6  

the problem is the timing like you said.

check the library code here: https://github.com/adafruit/DHT-sensor-library/blob/master/DHT.cpp

cycles of 40, 80 milliseconds.

I had inconsistent readings using windows IoT and a raspberry due to the timings.

I gave up, i used an i2c sensor.

Hong Kong
#7  

Thank everyone for sharing opinions.

Let me clarify more about this issue:

First, I do not think the power supply is an important/serious issue here, 3.3 V or 5V. At least, The solution is obviously approachable, since it is not that hard to find a way to convert from 3.3V to 5V, or 5V to 3.3V.

Second, most importantly, what matters here is the data communication. What I got is not just a DHT11 sensor, but a DHT11 sensor module, with the sensor and its extension circuit. The module has three pins: GND, Power, and data (digital).

Why here is only one digital I/O for the sensor module? Because it uses 1-wire bus communication system! :) The single digital I/O seems to transport data in both ways. For those who are not familiar with 1-wire bus, here is the wikipedia link: https://en.wikipedia.org/wiki/1-Wire

So what bothers me is whether this 1-wire bus system can be used in ARC?

Of course, 1-wire bus protocol can be used with most MCUs by C programming. Then my doubt is can ezb v4 accepts 1-wire bus protocol? or it will get very complicated.

Moreover, thank you, @ptp. Using an alternative humidty/temperature sensor, matching the existing interface of ezb v4, is also a good choice, for sure.

Everyone, please state your ideas.:) :)

United Kingdom
#8  

If you search the forum there's a (really old) post from me about the DHT11.

However, the short answer to this sensor is to attach it to an Arduino, there are many examples for this sensor and the Arduino out there, all work well.

Then use the EZ-B to talk to the Arduino and get the data from the sensor via Serial or I2C.

That was much easier than attempting to figure out how the DHT11 "works". The sensor sends both Humidity and Temp data at the same time. Why waste the EZ-B/EZ-Builders resources on deciphering this when Arduino can do it and simply send the data as two separate values depending on what you call for?

However, I will say that the DHT11 isn't that accurate - at least mine isn't. The temperature can fluctuate by about 3 degrees Celcius in either direction