bluehash 1,581 Posted June 26, 2012 Share Posted June 26, 2012 So an intentional delay? Quote Link to post Share on other sites
energia 484 Posted June 26, 2012 Share Posted June 26, 2012 *EDIT* Yes, that would do it. Or compare count to a larger number. Comparing counter to a greater number is preferred. This is the parameter that the I think the author used to "tweak" it into working. Robert Quote Link to post Share on other sites
Rei Vilo 695 Posted June 28, 2012 Author Share Posted June 28, 2012 Thank you for the solutions. I'll test them as soon as I can and keep you informed. Quote Link to post Share on other sites
Rei Vilo 695 Posted July 2, 2012 Author Share Posted July 2, 2012 Finally, it works! debug bits received 40debug 1, 75, 1, 6, 7D =? 7D debug checksum ok debug RH% 373 debug oC 262 RH% 37.3 % oC 26.2 *C Thank you for your help! I think it's time to consider buying an oscilloscope. :eh: Please find the library with a basic example attached: DHT22_430_main.zip mic, xv4y, bluehash and 1 other 4 Quote Link to post Share on other sites
Rei Vilo 695 Posted July 3, 2012 Author Share Posted July 3, 2012 ...and a picture! The DHT22 sensor is at the bottom-right part of the proto-board. The LCD is a Nokia 5110 compatible. Temperature and humidity are displayed with a double-sized font. bluehash, energia, Rickta59 and 2 others 5 Quote Link to post Share on other sites
Indian_villager 0 Posted September 17, 2012 Share Posted September 17, 2012 Is there a potential to modify this library for the DS18b20? I am way new to the microcontroller scene. I'm not asking anyone to simply solve this for me, a point in the direction to start would be good enough. I plan on looking at the arduino library to get things moving, but my knowledge of programming is limted so I will be pestering yall for help. Quote Link to post Share on other sites
gordon 229 Posted September 18, 2012 Share Posted September 18, 2012 The DS18B20 is a whole different animal. oPossum, Zeke and maybe RobG have posted Maxim 1-Wire code a good while back, search the forums, here's a link for starters: viewtopic.php?f=10&t=456 Quote Link to post Share on other sites
xv4y 46 Posted September 26, 2012 Share Posted September 26, 2012 Hi! I am back playing with Energia and the LaunchPad. I just ordered a DTH11 for around 1$ shipped from a Hong Kong seller on eBay. Planning to play with it later (also ordered a UHF transmitter, and a LCD, a remote temp/humidity sensor could be a nice toy). I haven't dig around this chip yet but I was crawling in the Energia forums and read your topic so I am jumping in. Thanks for the code examples! Regards, Yan. EDIT : Missed page 2 of the discussion and first writing the message did not see all the participants... Quote Link to post Share on other sites
L.R.A 78 Posted April 20, 2013 Share Posted April 20, 2013 does this work with DHT11? i saw a arduino post that said the DHT11 and DHT22 had diferent data types Quote Link to post Share on other sites
Rei Vilo 695 Posted April 20, 2013 Author Share Posted April 20, 2013 does this work with DHT11? i saw a arduino post that said the DHT11 and DHT22 had diferent data types I guess so. The one-wire connection is the same but data sent by the DHT11 is different. As I don't have any DHT11, I can't help much more, sorry Quote Link to post Share on other sites
L.R.A 78 Posted April 21, 2013 Share Posted April 21, 2013 I guess so. The one-wire connection is the same but data sent by the DHT11 is different. As I don't have any DHT11, I can't help much more, sorry :-( No problem :thumbup: Just got to adapt some stuff. Maybe will even use the DHT22 since it's more acurate Thanks Quote Link to post Share on other sites
icserny 9 Posted April 22, 2013 Share Posted April 22, 2013 Here is a late addendum to the original problem: As it was pointed out by Robert (in message #15), the discrimination of '1'-s from '0'-s is based on a simple comparison: if (counter > 6) The constant value of 6 is the "discrimination level". This value is good for the AVR chips, but is too small for other cards like MSP430 Launchpad, ChipKit UNO32, or GR-Sakura. The latest version of the Adafruit's DHT library therefore allows us to use an optional parameter to specify the preferred value of the "discrimination level". But how can you determine the optimal value? Especially, if you don't have an oscilloscope at home... Here comes the idea: let's print the observed counter values, then we can see some statistical distribution of these values. I added some debug features (which compile conditionally when the DEBUG symbol is defined. 1. Declare an array bytes having 40 elements. uint8_t res[40]; 2. Store the counter values for each of the 40 bits (just before the above mentioned comparison) #ifdef DEBUG res[j] = counter; #endif 3. At the end of DHT::read(void) function, print out the results: #ifdef DEBUG for(i=0; i<j; i++) { Serial.print(res[i],DEC); Serial.print(" "); if(i%8 == 7) { Serial.println(); } } Serial.println(j, DEC); Serial.print(data[0], HEX); Serial.print(", "); Serial.print(data[1], HEX); Serial.print(", "); Serial.print(data[2], HEX); Serial.print(", "); Serial.print(data[3], HEX); Serial.print(", "); Serial.print(data[4], HEX); Serial.print(" =? "); Serial.println(data[0] + data[1] + data[2] + data[3], HEX); #endif The result of a typical run on an MSP430G2553 can be seen here: 66 7 7 6 6 7 7 216 21 6 7 7 21 21 76 6 7 7 6 6 7 217 6 6 7 21 7 21 66 21 6 22 6 7 21 7401, 46, 1, A, 52 =? 52Humidity: 32.6 % Temperature: 26.6 *C7 7 7 6 6 7 7 216 22 6 7 7 21 21 66 6 7 7 6 6 7 217 6 7 7 21 7 21 217 21 7 21 7 6 22 20401, 46, 1, B, 53 =? 53Humidity: 32.6 % Temperature: 26.7 *C7 7 7 6 6 7 7 216 22 6 7 7 21 21 66 7 7 7 6 7 7 216 6 7 7 21 7 21 217 21 6 21 6 6 21 21401, 46, 1, B, 53 =? 53Humidity: 32.6 % Temperature: 26.7 *C You see, that the results can be divided in two groups: low values are 6 or 7 which means '0' and higher values of 20-21-22, which means '1'. In this case 15 is a good value for the discrimination level. So this is how the poor man's tool can substitute oscilloscope. :thumbup: Best regards, Istvan Cserny energia 1 Quote Link to post Share on other sites
RobLewis 7 Posted November 6, 2013 Share Posted November 6, 2013 Trying to figure out what, if any, changes would have to be made to support the F5529 version of the MSP430. I know it has some different default pin assignments than other versions. (This is from the .cpp file: _pin = pin; Where does this pin value get defined?) Thoughts? Quote Link to post Share on other sites
Rei Vilo 695 Posted November 8, 2013 Author Share Posted November 8, 2013 The pin value is defined in the constructor. See the example provided DHT22_430_main.ino at lines 68-70: #define DHTPIN P1_4 DHT22 mySensor(DHTPIN); Trying to figure out what, if any, changes would have to be made to support the F5529 version of the MSP430. I know it has some different default pin assignments than other versions. (This is from the .cpp file: _pin = pin; Where does this pin value get defined?) Thoughts? RobLewis 1 Quote Link to post Share on other sites
RobLewis 7 Posted November 8, 2013 Share Posted November 8, 2013 Thanks, found the pin definition. Also found this in the file: // Core library - MCU-based #if defined(__MSP430G2452__) || defined(__MSP430G2553__) || defined(__MSP430G2231__) // LaunchPad specific #include "Energia.h" #else // error #error Platform not supported #endif since my LaunchPad is a different model (F5529), is this going to fail? What would be needed to add support for it? Also, where do these variables get set? My guess: in the Energia app when you select the Board in the Tools menu. (Sigh. I have so much to learn and I'm not finding much in the way of documentation.) 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.