CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SHT11-too high temperature readings

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
tomcuga



Joined: 12 Jul 2007
Posts: 15

View user's profile Send private message

SHT11-too high temperature readings
PostPosted: Wed Jul 14, 2010 12:05 am     Reply with quote

Hello,
My SHT11 sensor shows too high temperature values.
When I used 5V power supply with formula T=0.01*raw-40.1
temp reading was about 3.0 degrees higher and with 3.3V
sensor supply and formula T=0.01*raw-39.7 I have about
2.0 degrees higher value.

I used Hansolo's drivercode
http://www.ccsinfo.com/forum/viewtopic.php?t=28564&highlight=sht11
I didn't change anything except
output_bit(x,0) - output_low(x)
output_bit(x,1) - output_high(x)

My PIC is 18F2525 with 20MHz clock.
I used sht11 board from Mikroelektronika:
http://www.mikroe.com/sr/tools/sht1x-proto/
It has 1K pull-ups on both SCL and DATA lines.

Is there anything that I can try/do about it?

I have one more question about Hansolo's code:

This function definition confuses me:
Code:

void sht_rd (float & temp, float & truehumid)

What is the function of address operator & in function
definition? I expected & operator in calling function
and then pointer variable in function definition if
call by reference is used, but here is usual call by value:
Code:

sht_rd (restemp, truehumid);

Thanks
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Jul 14, 2010 7:14 am     Reply with quote

Are you taking into account the heat generated by the operation of the SHT11 itself? Calculate the power dissipated by the SHT11, times the thermal resistance and see if that is a large part of your error. It makes sense it would be greater for 5V than for 3V.

I have never used your SHT11 so its self-heating may be minuscule, but for some sensors it is not.
_________________
The search for better is endless. Instead simply find very good and get the job done.
tomcuga



Joined: 12 Jul 2007
Posts: 15

View user's profile Send private message

PostPosted: Wed Jul 14, 2010 12:54 pm     Reply with quote

I found on Mikroelektronika's forum topic about the same problem I have.
Self heating is obviously a problem with this sensor. Some people suggest
to supply sensor from PIC pin - to be able to supply sensor only during
measuring. I try that but without any improvement.
I remove 1K pullups and put 10K only on SDA line as datasheet suggest.
I gain significant improvement with this - the part of excessive heat was obviously due to too lower pull up resistors which Mikroelektronika put on the sht1x board.
But I still have about 1.0 to 1.2 degree error so I'm still not happy. Shocked
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Jul 14, 2010 3:32 pm     Reply with quote

tomcuga wrote:
...
Self heating is obviously a problem with this sensor. ...
But I still have about 1.0 to 1.2 degree error so I'm still not happy. Shocked


I think you need more research into your problem.

I use my own driver. I have used these sensors for years in precision temperature sensing environments without seeing any noticeable error however the environment I am using in ranges from around 0 to 45 deg C. I cannot comment on the operation characteristics outside this range.

I suggest looking at the mechanism you are using to compare the temperature with your reference. Comparing an aspirated reference with a non aspirated sensor or comparing an aspirated sensor with a non aspirated reference will produce non meaningful results.

Things to be considered:
1. Are the reference and sensor under test identically aspirated?
2. Are they equally shield from solar radiation?
3. Are they immediately adjacent?
4. Are they of equivalent thermal mass?
5. Is the reference's calibration current, certified and in spec?
6. Have you inadvertently turned on the sensor's heater?
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
tomcuga



Joined: 12 Jul 2007
Posts: 15

View user's profile Send private message

PostPosted: Thu Jul 15, 2010 1:23 pm     Reply with quote

Thanks SherpaDoug and asmallri.
I am able to answer only on asmallri's questions 2 and 6. I'm not the expert
in temperature measurement so I don't understand other questions
Embarassed
Yes, my both sensors are close each other in my lab so there is no direct sun radiation. Also, I understand sensor protocol and code I use very well so I did not turn on sensor heating.
I don't have any special thermometers so as a reference I used Dallas DS18B20, my UT70B digital multimeter which shows 31 degree in situation on the picture and my home weather station which shows 31.2 degree.
So SHT shows the highest value. I know that i am comparing apples and pears but... These results are now ok I think.
Somehow, I believe to DS18B20 the most.

Can somebody just explain to me this strange definition:
Code:

void sht_rd (float & temp, float & truehumid)

maybe I have some black hole in my C knowledge.
Thanks to all.
http://tinyurl.com/35ww75e
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jul 15, 2010 2:05 pm     Reply with quote

He's using Reference Parameters in the sht_rd() function. It's a way to
return more than one value from a function.

Normally a function only returns one value. To return two or more
values you could use Global variables, but that's considered sloppy
programming. You could return a structure, but it takes time to
type in the structure definition. A quick way is to use reference
variables. Some (or all) of the parameters are not used to pass a
variable to the function (though, they could be). They are used to
hold the return values.

In the case of sht_rd(), notice that he defines the function as void.
But he then uses Reference Parameters for the temperature and the
humidity. That means that when the function is done and returns to
main(), the 'restemp' and 'truehumid' variables will hold the result.
You can see in main(), that he doesn't initialize those variables. He calls
sht_rd() and then uses printf() to display them. That clearly shows
that sht_rd() puts the results of reading the SHT chip into those variables.

Some online descriptions:
http://pages.cs.wisc.edu/~hasti/cs368/CppTutorial/NOTES/PARAMS.html#ref
http://www.macs.hw.ac.uk/~pjbk/pathways/cpp1/node170.html
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Jul 15, 2010 4:16 pm     Reply with quote

For testing in the lab I often put several temperature sensors in an insulated cup of water and give it a stir. All the sensors will soon be at the same temperature.

This may not be good for a humidity sensor, I don't know much about them.
_________________
The search for better is endless. Instead simply find very good and get the job done.


Last edited by SherpaDoug on Fri Jul 16, 2010 4:13 am; edited 1 time in total
tomcuga



Joined: 12 Jul 2007
Posts: 15

View user's profile Send private message

PostPosted: Fri Jul 16, 2010 12:07 am     Reply with quote

Thank You very much PCM Programmer for great explanation as always!
I understand that, but it's more "clearer" to me and easier to understand
to use pointer variables:

send variables addresses to function

sht_rd (&temp, &truehumid)

and received it with pointer variables in function

void sht_rd (float *temp, float *truehumid)

It's the same thing in principle. Correct me if I'm wrong.

Thanks again! Rolling Eyes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group