cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

OK I am new at temperature sensors, I have a STLM20 sensor with an attached below transfer function.

   

according to my calculations, T should equal the following:

   

T=85.543*(1.8641-V0)

   

is this correct? because it is measuring -15.75 degrees C.

0 Likes
15 Replies
Anonymous
Not applicable

 Ok so I solved the negative temperature problem.

   

the problem is now it is reading too high (27.5 degrees) in a 20 degrees environment.

   

any advice?

   

 

   

int main()

   

{

   

float T;

   

int32 voltcount;

   

float volt;

   

char str[16];

   

LCD_Start();

   

ADC_Start();

   

ADC_StartConvert();

   

    for(;;)

   

    {

   

ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);

   

        voltcount=ADC_GetResult16();

   

        volt=ADC_CountsTo_Volts(voltcount);

   

T=85.543*(1.8641-volt);

   

sprintf(str, "%+1.1f", T);

   

        LCD_Position(0u,0u);

   

        LCD_PrintString(str);

   

CyDelay(1000);

   

    }

   

}

0 Likes
Anonymous
Not applicable

Is this reading by the PSoC5 or by a multimeter?

0 Likes
Anonymous
Not applicable

 by POSC5.

0 Likes
Anonymous
Not applicable

Is the ADC reference set to a Vdd derived reference or the internal

   

bandgap 1.024 reference ? If former Vdd is +/- 5% typically out of

   

a regulator.

   

 

   

You need to perform a complete signal path error analysis to know

   

what accuracy, precision you will get.

   

 

   

Regards, Dana.

0 Likes
JoMe_264151
Expert II

The equation given in the PDF is mixing units mV and V. You should take that into account when you rearrange the equation,

   

And where do you get the Item 85.543 from?

   

 

   

I calculate

   

Vo - 1.8663V = T[°C] * 11,8639mV/°C = T * 11.8639mV

   

T = (Vo - 1.8663V) / 0.011.8639 V

   

As you can see a calibration at the midpoint of your temperature scale could get rid of some errors.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

0 Likes
Anonymous
Not applicable

dividing 1/0.0118639 yeilds 85.543.

   

I have used (0.0 to 2.038 single ended 0 to Vref*2) input range of the ADC with a 100K conversion rate and it gave me more reliable results. but still there is a big difference between the real value and the measured value.

   

I am switching to the long equation. any idea on how to get the sqaure root of a float number?

0 Likes
Anonymous
Not applicable

The sensor tolerance is +/- 1.5 C, what are you using to determine T to

   

compare to PSOC result ? Ice bath one of the easy methods to cal a T

   

sensor at one point.

   

 

   

GCC and sqrt -               http://forums.debian.net/viewtopic.php?f=8&t=109385

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 I am using an old digital thermometer that is installed in a digital watch. it is currenttly reading 26 degrees while my sensor is reading 24.5 degrees.

   

1.5 degrees is tolerable error. thanks everyone 

0 Likes
Anonymous
Not applicable

 The first thing you should do is to use the equation for V0 that is relevant for your temperature range (given in Table 2 of the attached document). Secondly use a more accurate temperature sensor than using a digital thermometer that is installed in a watch. This will give you true temperature reading to compare with PSOC result.

   

 

0 Likes
ETRO_SSN583
Esteemed Contributor

@deniz, just a thought, do you think customer still watching a 6 month old thread ?

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Well Dana, most people won't do that. But I'm a special case, I even check threads that are more than a year old 

   

weird? or simply eccentric? 

0 Likes
HeLi_263931
Honored Contributor II

At least regular visitors here can look for forum with new stuff since their last visit (you just need to remember when it was :). And inside there the newest threads are on top making it easy to find new stuff even after a week or so.

0 Likes
ETRO_SSN583
Esteemed Contributor

Realtime examination of all your thread history history pretty awesome.

   

 

   

But is this a geometric progression of time needed, and soon you will have no time

   

to eat, sleep 😞

   

 

   

Reagrds, Dana.

0 Likes
Anonymous
Not applicable

 Hahahahaha you're absolutely right. I need to stop doing that 

0 Likes