Jorjel 0 Posted June 16, 2014 Share Posted June 16, 2014 Hello everyone ! I started to use Energia to create simple projects using MSP430G2553 LaunchPad and somehow I've succeded until now! Today I encountered a problem as I was trying to read values from a HIH-4000-001 humidity sensor.The sensor is powered with 5V and can return a value ranging from 0.826 V to 3.976V coresponding to 0 - 100 % RH. Because 3.976 V is much more than the MSP430 can manage I used a 1:2 resistive divider to scale down the signal.Moreover the sensor needs an load resistance of minimum 80kohms so the resistors I used for my divider were R1= 36kohms and R2=68kohms.NOW comes the error : Regarding that , the RH level is normally around 50% that would corespond to a value of 1.3 V after the scale-down so in terms of ADC readings that would be around 445 and that is the value I get but, if I take multiple readings 1 sec apart of each other this is what happens : 445 442 443 0 0 0 443 440 ..................... Why 0 ? Can anyone tell me ? If I measure for some period of time the output of the sensor, the multimeter indicates a constant value of 1.3 V so I assume that the ADC is the problem! Please help me solve this issue as I need to create a functional project for my Bachelor Degree ! Thanks in advance ! Quote Link to post Share on other sites
dubnet 238 Posted June 16, 2014 Share Posted June 16, 2014 Posting your code would be helpful since it looks like that is where the problem may reside. Also, you may want to check this post for additonal information to include: http://forum.43oh.com/topic/4824-information-to-provide-when-asking-for-help/ Having all the information greatly increases the possiblity that someone can identify the problem and provide the assistance you are looking for. Jorjel 1 Quote Link to post Share on other sites
Jorjel 0 Posted June 16, 2014 Author Share Posted June 16, 2014 Posting your code would be helpful since it looks like that is where the problem may reside. Also, you may want to check this post for additonal information to include: http://forum.43oh.com/topic/4824-information-to-provide-when-asking-for-help/ Having all the information greatly increases the possiblity that someone can identify the problem and provide the assistance you are looking for. The function that transforms adc readings into RH % is listed below : int Read_RH(int pin , int temperature){ int temp_compensated_RH=0; int RH=0; float Vcc=5.0; float Vout=0; Vout=analogRead(pin)*(3.0/1023); // transforming adc readings into voltage values; RH=((Vout/Vcc) - 0.16)/0.0062; // RH formula for T= 25 Celsius - derived from HIH-4000-001 datasheet; temp_compensated_RH=RH/(1.0546-(0.00216*temperature)); // temperature compensation acording to HIH-4000-001 datasheet ; return temp_compensated_RH; } But when I call this function the values returned are odd positive or negative values so I tried to see what does the ADC return by simply calling Serial.print( analogRead( P1_6 )) because P1_6 is the pin for my sensor.So when I call the Serial.print function the values returned are similar to what I first posted ! Quote Link to post Share on other sites
abecedarian 330 Posted June 16, 2014 Share Posted June 16, 2014 Did you disconnect the jumper for the LED2? Jorjel 1 Quote Link to post Share on other sites
abecedarian 330 Posted June 17, 2014 Share Posted June 17, 2014 @@Jorjel I'm glad you 'liked' my post, but did this solve your problem? energia 1 Quote Link to post Share on other sites
Jorjel 0 Posted June 17, 2014 Author Share Posted June 17, 2014 @@abecedarian I couldn't test it because I need some "tools" that I don't have at home ! today I will test this issue and will come back with the results.. ! If this strange behaviour of the ADC can have some other reasons I am all ears ! Thanks a lot ! Quote Link to post Share on other sites
gwdeveloper 275 Posted June 17, 2014 Share Posted June 17, 2014 You might consider switching to the HIH-5030 as it operates at 3.3v. I never had any luck with accurate readings using a HIH-4000 on the Launchpad. Quote Link to post Share on other sites
Jorjel 0 Posted June 19, 2014 Author Share Posted June 19, 2014 Problem solved! Topic can be closed! Thanks to @@abecedarian ! Quote Link to post Share on other sites
abecedarian 330 Posted June 20, 2014 Share Posted June 20, 2014 Problem solved! Topic can be closed! Thanks to @@abecedarian !Glad to hear. Sometimes the most simple things cause the biggest headaches. 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.