MORA99 9 Posted September 25, 2014 Share Posted September 25, 2014 A library for reading dht sensors (temperature and humidity). Since dht sensors are pretty slow, I have used highlevel functions in the lib, there should be plenty of cycles even at 1MHz, but I have only tested it on the CC3200 sofar. Easy example, other functions are available for getting the raw values instead of float. if (dht::readFloatData(2, &temperature, &humidity, true) == 0) { Serial.print("T: "); Serial.print(temperature); Serial.print(" H: "); Serial.println(humidity); } Zip file included, source code lives at https://github.com/MORA99/Stokerbot/tree/master/Libraries/dht Note: This lib requires working micros, delayMicroseconds and pulseIn functions, if you are using it on CC3200 you may need to patch your Energia installation. dht.zip chicken, bluehash and KittyHawk 3 Quote Link to post Share on other sites
jeroavf 0 Posted September 29, 2014 Share Posted September 29, 2014 Hi MORA99 , I have tried your DHT lib with a DHT22 on a CC3200 and it is not functioning . After reading one more time your post here, I noticed the small letters note, where you say: "This lib requires working micros, delayMicroseconds and pulseIn" What do you mean with this note ? What modifications are needed to make it function ? Thanks in advance Quote Link to post Share on other sites
roadrunner84 466 Posted September 29, 2014 Share Posted September 29, 2014 Hi MORA99 , I have tried your DHT lib with a DHT22 on a CC3200 and it is not functioning . After reading one more time your post here, I noticed the small letters note, where you say: "This lib requires working micros, delayMicroseconds and pulseIn" What do you mean with this note ? What modifications are needed to make it function ? Thanks in advance It means you are supposed to have a sketch framework (Energia or CCS sketch) running, and have not tampered with either of these functions. He also states that for the CC3200 you may have to get things working, I suppose they're not working out of the box with Energia... Quote Link to post Share on other sites
MORA99 9 Posted October 8, 2014 Author Share Posted October 8, 2014 Sorry for late reply, see this thread for changes needed with the current energia release and CC3200 : http://forum.43oh.com/topic/5902-measure-short-amounts-of-time-with-micros/ Problem is that micros (and therefore pulseIn) and delayMicroseconds does not work correctly due to how the tick counter is handled. Quote Link to post Share on other sites
igor 163 Posted October 8, 2014 Share Posted October 8, 2014 Note for future, the current Energia release mentioned above is release 13. Link to similar library: There is another DHT22 library, targeted at the MSP430. http://forum.43oh.com/topic/2865-energia-library-dht22-temp-rh-one-wire-sensor/ There have been some efforts to adapt it to the Stellaris LP. http://forum.43oh.com/topic/2239-solved-dht22-temp-rh-one-wire-sensor-on-energia/page-3 Quote Link to post Share on other sites
nosk8fx 0 Posted November 9, 2014 Share Posted November 9, 2014 anyone noticed that with version 13 the sample libraries for DHT11, which perfectly worked with version 12, doesn't work anymore with 13? talking about the samples for arduino from DFrobot wiki page ... the project is verified, downloaded, but the values from the sensors are something strange. I tried again with version 12 and it is working good. didn't go in the details why, but something changed with version 13. regards Quote Link to post Share on other sites
igor 163 Posted November 10, 2014 Share Posted November 10, 2014 anyone noticed that with version 13 the sample libraries for DHT11, which perfectly worked with version 12, doesn't work anymore with 13? talking about the samples for arduino from DFrobot wiki page ... the project is verified, downloaded, but the values from the sensors are something strange. I tried again with version 12 and it is working good. didn't go in the details why, but something changed with version 13. regards Would help to mention what platform you are using (MSP430, Tiva, C2k) - obviously not the CC3200, since not supported in 12. (On Tiva would think that the problems with the Energia delay routines might be an issue, and would suggest using the patch. However that would also be true of version 12.) Quote Link to post Share on other sites
nosk8fx 0 Posted November 10, 2014 Share Posted November 10, 2014 MSP430 Quote Link to post Share on other sites
iamfun 0 Posted December 4, 2014 Share Posted December 4, 2014 hi, i am using the library which is posted above.since u mentioned energia version 12 i downloaded that.but the problem is i don't see anything in my serial monitor window.i tried with both version 13 and verison 12 of energia but nothing worked out for me.you did not mention any pin numbers.can you help my telling me what changes i need to do so that it works on any of the port.for example can know how i can change it to read data from pin 1.7(port 1 pin 7). Thank you ps:i am a newbie to energia so my questions seems weird.i am sorry for that. Quote Link to post Share on other sites
kingofl337 0 Posted December 13, 2014 Share Posted December 13, 2014 So, time has gone by bugs have been fixed and I was trying the DHT code with my CC3200 and DHT11. Energia Version 0101E0014 and I'm not able to get the sensor to work. It seems to work ok with the DHT11 if you change true to false. Quote Link to post Share on other sites
MORA99 9 Posted December 18, 2014 Author Share Posted December 18, 2014 So, time has gone by bugs have been fixed and I was trying the DHT code with my CC3200 and DHT11. Energia Version 0101E0014 and I'm not able to get the sensor to work. It seems to work ok with the DHT11 if you change true to false. static int8_t readFloatData(unsigned char pin, float *temperature, float *humidity, boolean dht22); The true/false is to set if the sensor is a dht11 or dht22, so thats intended. The main difference is precision and the dht11 requires a bit more delay. Quote Link to post Share on other sites
Rei Vilo 695 Posted January 9, 2015 Share Posted January 9, 2015 Energia 14 uses more RAM than previous releases. Quote Link to post Share on other sites
KittyHawk 4 Posted February 20, 2015 Share Posted February 20, 2015 A library for reading dht sensors (temperature and humidity). Since dht sensors are pretty slow, I have used highlevel functions in the lib, there should be plenty of cycles even at 1MHz, but I have only tested it on the CC3200 sofar. Easy example, other functions are available for getting the raw values instead of float. if (dht::readFloatData(2, &temperature, &humidity, true) == 0) { Serial.print("T: "); Serial.print(temperature); Serial.print(" H: "); Serial.println(humidity); } Zip file included, source code lives at https://github.com/MORA99/Stokerbot/tree/master/Libraries/dht Note: This lib requires working micros, delayMicroseconds and pulseIn functions, if you are using it on CC3200 you may need to patch your Energia installation. Hello, Mora. I tried your library and found that code does not works properly all the time. After system was powered up, few readings is OK and after that readFloatData() and readRawData() returns error (on my MSP430G2553 Launch pad). I fixed this problem and also added two classes which buffers data from DHT22 and saves them in the internal memory. So, when you want get data faster than 1 time per 2 seconds (for DHT22) data will be returned from internal memory. How can I send this fixes to you? Do you want them? Quote Link to post Share on other sites
MORA99 9 Posted February 20, 2015 Author Share Posted February 20, 2015 Very nice, I noticed that I get quite a few errors on dht in my project, but I sleep the chip alot so didnt investigate it much. You can send the changes to me by mail if you like, and I will update the github/lib. Quote Link to post Share on other sites
KittyHawk 4 Posted February 21, 2015 Share Posted February 21, 2015 Very nice, I noticed that I get quite a few errors on dht in my project, but I sleep the chip alot so didnt investigate it much. You can send the changes to me (jkn@air-port.dk) by mail if you like, and I will update the github/lib. Hello. I sent you all data. Please, tell me if you like it Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.