PDA

View Full Version : NTC resistor



NL2TTL
- 25th September 2005, 18:19
Does somebody already made something with a NTC in it.
I like to build a NTC controlled fan circuit, but need a schematic and source to read a 47 KOhm NTC resistor.

CocaColaKid
- 26th September 2005, 20:19
I gave up on this approach and used a digital temp sensor instead. A lot less hassle.

markedwards
- 27th September 2005, 03:00
NL2TTL,

What pic are you using?
I use a 10K NTC thermistor, 10K fixed resistor voltage divider connected to an analog input on a 16F819. I get approximately 6 counts per degree F resolution.
I also use the hardware PWM to control 400 watts of fan motors based on temperature.
I also recommend Darrel Taylor's averaging routine. It works great!
http://www.pbpgroup.com/modules/wfsection/article.php?articleid=7

Mark

NL2TTL
- 28th September 2005, 20:01
I'm using a NTC because the costs are lower, and the PIC i'm using is a 16F877.

markedwards
- 29th September 2005, 03:20
NL2TTL,

What are you trying to acheive?
What temperature range are you planning to control?
Do you plan on using PWM?

35 degrees C Off
40 degrees C 50% duty factor
45 degrees C 70% duty factor
50 degrees C 70% duty factor

65 degrees C 100% duty factor


Mark

NL2TTL
- 29th September 2005, 08:07
yes something like that, only a resistor (NTC) is not liniar so to compensate that you have to use a formula.

Dave
- 29th September 2005, 11:50
Why not have a look at AN685 from Microchip. It's about Thermistors in Single Supply Temperature Sensing Circuits.

Dave Purola,

markedwards
- 29th September 2005, 14:35
NL2TTL,

Try these 2 routines;

This is how I read A/D converters with 10 bits resolution (0 - 1023)
The average routine is Darrel Taylor's averaging routine followed
by a simple linearization.

ReadAD: ' Read A/D converters with 10 bits resolution (0 - 1023)
ADCIN 0,AD0 'read channel 0...AN0
VALUE = AD0 >> 6
Sensor = 0
gosub Average
AD0 = VALUE
ADCIN 1,AD1 'read channel 1...AN1
VALUE = AD1 >> 6
Sensor = 1
gosub Average
AD1 = VALUE
ADCIN 2,AD2 'read channel 2...AN2
VALUE = AD2 >> 6
Sensor = 2
gosub Average
AD2 = VALUE
ADCIN 3,AD3 'read channel 3...AN3
VALUE = AD3 >> 6
Sensor = 3
gosub Average
AD3 = VALUE
ADCIN 4,AD4 'read channel 3...AN4
VALUE = AD4 >> 6
Sensor = 4
gosub Average
AD4 = VALUE
Return

Average: ' Average Analog values -=-=-=-=-=-=-=-=-=-=
IF Value = ADavg[Sensor] Then NoChange
IF ABS (Value - ADavg[Sensor]) > FAspread OR Value < AvgCount Then FastAvg
IF ABS (Value - ADavg[Sensor]) < AvgCount Then RealClose
ADavg[Sensor] = ADavg[Sensor] - (ADavg[Sensor]/AvgCount)
ADavg[Sensor] = ADavg[Sensor] + (Value/AvgCount)
GoTo AVGok
FastAvg:
ADavg[Sensor] = Value
GoTo AVGok
RealClose:
ADavg[Sensor] = ADavg[Sensor] - (ADavg[Sensor]/(AvgCount/4))
ADavg[Sensor] = ADavg[Sensor] + (Value/(AvgCount/4))
AVGok:
Value = ADavg[Sensor] ' Put Average back into Value
NoChange:
if AD0 >= 435 then RA = 66 'thermistor linearization
if AD0 >= 446 then RA = 67
if AD0 >= 450 then RA = 68
if AD0 >= 456 then RA = 69
if AD0 >= 461 then RA = 70
if AD0 >= 477 then RA = 71
if AD0 >= 473 then RA = 72
if AD0 >= 479 then RA = 73
if AD0 >= 486 then RA = 74
if AD0 >= 492 then RA = 75
if AD0 >= 499 then RA = 76
if AD0 >= 506 then RA = 77
if AD0 >= 513 then RA = 78
if AD0 >= 519 then RA = 79
if AD0 >= 526 then RA = 80
if AD0 >= 529 then RA = 81
if AD0 >= 535 then RA = 82
if AD0 >= 544 then RA = 83
if AD0 >= 548 then RA = 84
if AD0 >= 552 then RA = 85
if AD0 <= 438 then RA = 59
if AD0 >= 562 then RA = 58
Return



This is how I determine my fan speed. In my case the minimum Fan speed is
60%.

IF RA <= SETPOINT Then cbs
ERROR = (RA - Setpoint )
IF ERROR <= 2 then FANSPEED = 153 '60%
IF ERROR >= 3 then FANSPEED = 178 '70%
IF ERROR >= 5 then FANSPEED = 204 '80%
IF ERROR >= 7 then FANSPEED = 229 '90%
IF ERROR >= 9 then FANSPEED = 255 '100%
CASE 2
cbs: FANSPEED = 153 ' manual spd 1
CASE 3
FANSPEED = 204
case 4
FANSPEED = 255
end select
IF FANSPEED > SPD + 50 THEN SPD = SPD + 2 'softstart or slowly
IF FANSPEED > SPD THEN SPD = SPD + 1 'change speed
'IF FANSPEED < SPD + 50 THEN SPD = SPD - 10
IF FANSPEED < SPD THEN SPD = SPD - 1
hpwm 2,SPD,32767 ' PWM 32 KHz
return

I hope this helps get you started.

Mark

NL2TTL
- 29th September 2005, 16:44
I requisted a few digital samples by maxim, and gonne try it with those.
Because the failure is mutch lower, thanks for al the replys

CocaColaKid
- 29th September 2005, 16:54
Which ones are you getting from Maxim?

Maniac
- 29th September 2005, 18:16
Hello

I got exited to see the code Mark posted. I am in the process of building a controller. It will need to cycle between 2 temperatures using a thermistor and a small heater. Did anyone have built something similar using a PIC?
Attila