How can I use diode to measure temperature

OBW0549

Joined Mar 2, 2015
3,566
One method that works well and gives good accuracy is described on Page 7 of this Linear Technology application note. It works best using a diode-connected transistor (i.e., base and collector connected together), but would probably give fairly decent results with a plain old diode, too.
 

Alec_t

Joined Sep 17, 2013
15,105
You can magnify the temperature effect by configuring the transistor as an 'amplified diode', i.e. by having a resistor from collector to base and another resistor from base to emitter. Many moons ago I used this technique in a simple LM324 opamp circuit to make a thermostat for my central heating system.
 

OBW0549

Joined Mar 2, 2015
3,566
I wonder how well the circuit would work with CMOS analog switches such as the CD4066?
Probably just as well, though it would take a few more parts. The LTC1043 is a handy little beast, in part because it's got four SPDT analog switches, and also a built-in oscillator for operating them. Saves PCB space and works real good.
 

RichardO

Joined May 4, 2013
2,270
Probably just as well, though it would take a few more parts. The LTC1043 is a handy little beast, in part because it's got four SPDT analog switches, and also a built-in oscillator for operating them. Saves PCB space and works real good.
It depends on priorities. If I am being cheap (typical) than I use the pieces-parts I have on hand. If I am doing a production design then optimizing for size, weight and power makes sense.

I have done both for diode temperature measurement. One version had a dozen hand-matched transistors for a home project. The other used a Maxim or National Semi part that worked the same as the Jim Williams circuit and had a serial interface.

p.s. I would not do the hand-matching scheme again. At the time I was not familiar with the switched current method used by Jim Williams. :(
 

mcgyvr

Joined Oct 15, 2009
5,394
Why are you choosing a diode for temperature measurement and when you have no clue how to do it and need to be walked through the whole process?
you can buy an off the shelf temperature measurement device if you need to measure somethings temperature..

Are these guys just doing your homework or something?
 

Thread Starter

Layan_AK

Joined Mar 28, 2017
79
Why are you choosing a diode for temperature measurement and when you have no clue how to do it and need to be walked through the whole process?
you can buy an off the shelf temperature measurement device if you need to measure somethings temperature..

Are these guys just doing your homework or something?

I have a project for instrumentation LAB :)

My prof suggest to use diode to measure temp ^_^

Regards
 

GopherT

Joined Nov 23, 2012
8,009
Don’t measure reverse current. A diode simply changes forward voltage by -2.1 mV per degree Celsius. That is, each degree warmer, the voltage drop of a diode goes down by 2.1mV.

Then if you multiply (amplify gain) -47, you’ll get a 0.1 volt change at the output of your amplifier for each degree change.

Notice it says, minus 47 gain, you need an inverting amplifier.

Finally, you need some reference point (offset) because you don’t want to just measure temp change, you want to have 0-degrees C, read, zero volts on your meter. I’ll let you think about that.
 

Thread Starter

Layan_AK

Joined Mar 28, 2017
79
Don’t measure reverse current. A diode simply changes forward voltage by -2.1 mV per degree Celsius. That is, each degree warmer, the voltage drop of a diode goes down by 2.1mV.

Then if you multiply (amplify gain) -47, you’ll get a 0.1 volt change at the output of your amplifier for each degree change.

Notice it says, minus 47 gain, you need an inverting amplifier.

Finally, you need some reference point (offset) because you don’t want to just measure temp change, you want to have 0-degrees C, read, zero volts on your meter. I’ll let you think about that.
you mean i should read the voltage at 0 degree and use the same value as a refrence point ?
 

GopherT

Joined Nov 23, 2012
8,009
I mean you could do it like this. The offset is used to adjust your reference point (set zero volts when the diode is in ice water (at max gain).

Then look up room temperature with a thermometer and adjust the gain potentiometer to achieve output voltage = thermometer temp divided by 10.



8F3FDBDC-A497-4E28-88FB-CF80110E5BDA.png
 

Thread Starter

Layan_AK

Joined Mar 28, 2017
79
thanks a lot for your appreciated effort :)

should i adjust the reference point at the max gain ?! why ?

how i determine the max gain and the resistors' values in the circuit ?
 

joeyd999

Joined Jun 6, 2011
6,204
Why not just attach the diode and a few resistors, pots, and caps to an ICL7106 -- no other active components -- and be done with it?

This'd be a half-hour project for me on a breadboard.

Edit: actually, it was -- in middle school.
 

nsaspook

Joined Aug 27, 2009
16,254
thanks All :)



View attachment 138596


not clear :(

how to use this method with mcu ?
http://ww1.microchip.com/downloads/en/AppNotes/93016A.pdf

Example code using the PIC18 internal diode.
C:
/* two point temperature diode calibration code from
* http://www.ti.com/lit/an/sbaa073a/sbaa073a.pdf
* https://www.ccsinfo.com/forum/viewtopic.php?p=173294
*/
#define ZERO_DEGC_IN_CENTIK 27315ul // centi-K = 0.01K units
struct {
// alpha numerator and denominator
uint16_t alphan; // ADC bits
int32_t alphad; // 0.01K units
} calibration;
/*
* Initialize module
* 89.5F (31.9C) = alphan 293
*/
void inttemp_init(void)
{
// arbitrary values
calibration.alphan = 293;
calibration.alphad = 319 * 10 + ZERO_DEGC_IN_CENTIK;
}
/*
* Single point calibration to assumed ambient temperature
*/
void inttemp_calibrate(int16_t temperature)
{
// alpha = delta diode voltage / temperature
calibration.alphan = inttemp_deltav();
calibration.alphad = ((int32_t) temperature * 10 + ZERO_DEGC_IN_CENTIK);
}

/*
* use the CTMU to measure the internal temp diode and return a voltage
* It's only good for about +- 1.0C resolution at best but it will work
* for time measurement calibration drift
*/
uint16_t measure_chip_temp(uint8_t mode)
{
L.ctmu_data = LOW;
L.ctmu_data_temp = HIGH;
ADCON1bits.VCFG = 2; // Vref+ = 2.048
ADCON0bits.CHS = TEMP_DIODE; // Select ADC channel
CTMUCONHbits.CTMUEN = LOW;
if (mode) {
CTMUICON = 0b01111111; // 55uA CC max trim +62%
} else {
CTMUICON = 0b01111110; // 5.5uA CC max trim +62%
}
CTMUCONHbits.CTMUEN = HIGH;
CTMUCONHbits.IDISSEN = LOW; // end drain
PIE3bits.CTMUIE = LOW; // don't generate CTMU interrupts for edges
CTMUCONLbits.EDG1STAT = 0; // Set Edge status bits to zero
CTMUCONLbits.EDG2STAT = 0;
CTMUCONLbits.EDG1STAT = 1; // start current source
wdtdelay(20); // CTMU setup time before sampling
ADCON0bits.GO = 1; // Start conversion
wdtdelay(20); // wait for ISR to update buffer
CTMUCONLbits.EDG1STAT = 0; // deactivate current source
CTMUICON = 0x00; // current off
return L.pic_temp;
}
/*
* Measure delta voltage across internal diode at two currents.
*/
uint16_t inttemp_deltav(void)
{
uint16_t v1, v2;
v1 = (uint16_t) lp_filter((float) measure_chip_temp(LOW), 1, HIGH);
v2 = (uint16_t) lp_filter((float) measure_chip_temp(HIGH), 2, HIGH);
return v2 - v1;
}
/*
* Read current internal temperature in 0.1C
*/
int16_t inttemp_read(void)
{
// temperature = delta diode voltage * (1 / alpha)
return((int32_t) inttemp_deltav() * (int32_t) calibration.alphad / (int32_t) calibration.alphan - ZERO_DEGC_IN_CENTIK) / 10;
}
 
Last edited:

GopherT

Joined Nov 23, 2012
8,009
thanks a lot for your appreciated effort :)

should i adjust the reference point at the max gain ?! why ?

how i determine the max gain and the resistors' values in the circuit ?

Set it at max gain because the output of an op amp is zero when the voltage to the (-) and (+) inputs are the same - no matter what gain. Use a 10-turn trimmer potentiometer to get the exact zero point. Bring it to a positive value and turn until you get no decrease with additional turns (may not get all the way to zero* (see note below).

Then, once you find the “zero” reference, any decrease in the diode forward voltage as the diode warms up, will cause the voltage to increase (inverting amplifier).

* if you want to read negative voltages, (below zero temperatures), you can power the op amp with two 9v batteries in series. Use the node between the two as the ground for the ground symbol in the schematic. That way, Vcc will be +9V and Vee will be -9Volts.
 
Top