LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with measuring DHT22 Humidity & Temperature Sensor

I want to measure relative humidity and Temperature using the DHT22 and labview, here are the hardware i have:

cDAQ 9174, a power supply for the DHT22 and a digital I/O Module (NI 9401). How could i find the Temp, Hum measurements with labview?

 

Regards.

0 Kudos
Message 1 of 10
(4,336 Views)

What is a DHT22, who makes it?  Do you have a link to its datasheet?

0 Kudos
Message 2 of 10
(4,302 Views)

DHT22 is a humidity/temperature digital output sensor and here's the datasheet: https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf 

 

 

0 Kudos
Message 3 of 10
(4,291 Views)

Well I'm not saying you can't do it, but it might be a bit difficult to read this with NI hardware.  The reason is because you need to pull the line low, meaning set the digital out, then pull the line high, meaning set the digital out again, then you need to turn the digial into an input and start reading a buffered input.  The issue I think you'll have is changing from an output to an input will likely mean closing the DAQ task, and starting a new one, and I'm unsure how long that will take, and I'm unsure how quickly the hardware will respond.  Attached is an example that might work depending on response times, I don't have actual hardware to test with.  I've also never had to use a digital as an input and output, alternating between them quickly so there maybe some better technique to do it faster that I'm unaware of.

0 Kudos
Message 4 of 10
(4,276 Views)

Hoovah gave some good recommendations.  But I would consider finding another device to use.  Beyond the communication scheme being complex, I don't trust anything where it is a pretty bad translation to English.  It tells me it is a knock off Chinese sensor that isn't going to have much support because they couldn't hire an English speaking person to credit the bad translation.

0 Kudos
Message 5 of 10
(4,270 Views)

There is also a document on this website that can help. It can be found Here but it was implemented on FPGA (myRIO Chasis) which i don't have. And the issue is I have never used LabView before nor have any experience with National Instruments, its just i needed to use it for a project i am working on. I was able to do basic programs like reading a thermocouple and export data on excel, etc..

0 Kudos
Message 6 of 10
(4,264 Views)

The sensor itself is a cheap chinese electronic for sure.  But in the Arduino and maker community these sensors have been used for years with the amount of success that is acceptable for those types of applications.  Want to know when your clothes are dry by measuring heat and humidity?  Don't care about exactly how precise it is?  Then this is a perfect solution.  There's plenty of examples of china coming out with some cheap seemingly crappy solution that takes off in these maker communities.  It does have poor support, and poor documentation, but if you go into it knowing that, and can get a working solution from a <$10 sensor then you're probably happy regardless.

 

http://playground.arduino.cc/Main/DHTLib

 

Good luck getting it working.  If you get anything worth sharing please do.  If you are stuck another solution that will work with more effort, is to use LIFA, or LINX, and modify the firmware to take the sensor measurements (using the public libraries) and then spit that over to your PC via USB.  

0 Kudos
Message 7 of 10
(4,252 Views)

OH just thought of a solution that would work with your hardware (but I can't test it)  Have the Data line of the DHT22 go to two different lines of the 9401.  One is always set to DI taking continuous data (that then needs to be processed) and the other line is always a DO.  You can start the DO task, set it to low then high then close the task.  After that the sensor should spit out your data, and you can already be reading it on the DI line.  Your DI shoud first see the low and high you generate on the DO line, and then the data that follows it should be your sensor information that needs to then be parsed.

0 Kudos
Message 8 of 10
(4,247 Views)

@Hooovahh wrote:

OH just thought of a solution that would work with your hardware (but I can't test it)  Have the Data line of the DHT22 go to two different lines of the 9401.  One is always set to DI taking continuous data (that then needs to be processed) and the other line is always a DO.  You can start the DO task, set it to low then high then close the task.  After that the sensor should spit out your data, and you can already be reading it on the DI line.  Your DI shoud first see the low and high you generate on the DO line, and then the data that follows it should be your sensor information that needs to then be parsed.


Have you looked into this document? https://decibel.ni.com/content/docs/DOC-39175

 

it has a complete DHT22 project, but as I said it was done on FPGA which I don't have.. if you take a look at the block diagram you might understand how it was programmed. It still looks a bit complicated to me due to my lack of knowledge in labview.

0 Kudos
Message 9 of 10
(4,241 Views)

@iMalik wrote:

Have you looked into this document? https://decibel.ni.com/content/docs/DOC-39175


Yes I have, the problem isn't the software (which is documented in several places on the internet and in that document).  The problem is your setup and your hardware.  If you are sticking with the hardware you have, post some code, try some stuff, tell us what works and what doesn't because no one here so far has the sensor and hardware to test with.

 

If you want to learn more about LabVIEW feel free to try out some of these free training resources:

 

Here are some free training links if you are interested:

 

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide 

Learn NI Training Resource Videos

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required

Message 10 of 10
(4,233 Views)