1

I want to get the temperature from a thermistor, so I made a voltage divider (3.3V to 10k resistor and between ground a 10k thermistor) I read the ADC between the 10k resistor and the thermistor. The BCOEFFICIENT is 3977, the NOMINAL TEMPERATURE is 25C and I use the simple B parameter equation. I'm not sure where I'm doing mistake, I read room temperature as 10.5C which was suppose to be around 24C. The following is the part of the program that I used for temperature sensor(developed in AVR studio),

 #define TEMPERATURENOMINAL 25
 #define TERMISTORNOMINAL 10000
 #define BCOEFFICIENT 3977
 #define SERIESRESISTOR 10000
{
float ke1,tempa,xin
ke1 = adc_get_value(peak_adc2,peak2);
xin=(1023/ke1)-1;
xin=SERIESRESISTOR/xin;
tempa=xin/TERMISTORNOMINAL;
tempa=log(tempa);
tempa/= BCOEFFICIENT;
tempa+=1.0/(TEMPERATURENOMINAL + 273.15);
tempa=1.0/tempa;
tempa-=273.15;
dip204_set_cursor_position(1,3);
//sprintf(ui, "Temp is %.2f deg", Ref);
sprintf(ui, "Temp is %.2f deg", tempa);
      dip204_write_string(ui);
}

I checked the voltage using multi-meter for instance in between the thermistor and 10k resistor and in the EVK 1100 using the following line

ke1 = adc_get_value(peak_adc2,peak2)*3.3/1024;

I get the same voltage in both. Not sure where I'm doing a mistake, Hope someone guide me in right direction

Cedric
  • 17
  • 8
  • In `sprintf(ui, "Temp is %.2f deg", Ref);`, shouldn't it be `tempa` instead of `Ref`? – D Krueger Dec 21 '15 at 19:15
  • @DKrueger - My bad, I was trying something else. Even with `tempa` I'm not getting right results. – Cedric Dec 22 '15 at 00:28
  • What voltage do you read, and what value does your software calculate at that voltage? – sifferman Dec 22 '15 at 08:46
  • @sifferman - When I connect the ADC pin to the circuit and read at the room temperature (24C)I get 2.17V in software and in multimeter I read the same voltage. However, when I disconnect the ADC wire to the EVK1100 board, I read 1.64V in the circuit. I didn't notice this voltage difference before, so what I did was I set the input voltage to the circuit from 3.3v to 1.7v.(So that when I connect the ADC pin to the circuit I get 1.64v) Now I get the correct temperature value. – Cedric Dec 23 '15 at 05:07

1 Answers1

2

Your code looks correct to me, and I suspect a hardware problem may be the culprit.

It seems likely you have inadvertently connected two 10K-ohm pull-up resistors between the ADC input and the +3.3V reference: perhaps one is already populated on the EVK1100 board, and you have added another one externally connected to your thermistor. This would be equivalent to putting both 10K-ohm resistors in parallel with each other, which would be equivalent to a 5K-ohm resistor in series with the thermistor. At 25°C, the thermistor resistance Rt would read 10K ohms, which would produce a voltage of:

+3.3V * (Rt / (Rt + 5K))

= 2.20V

instead of the correct +1.65V. This number is very close to the result you are seeing (+2.17V @ 24°C).

You can verify this hypothesis by looking at the schematic and/or PCB for the EVK1100 to see if a 10K-ohm pull-up resistor is connected from the ADC input to +3.3V. If this is the problem, remove one of the two resistors and you should see correct behavior.

sifferman
  • 2,955
  • 2
  • 27
  • 37
  • You are right! I was very careless(right now banging my head against the wall). The ADC pin has 3.3V reference, somehow I missed that. All I needed was simply connect the thermistor. Thanks a lot. – Cedric Dec 23 '15 at 06:18