Temperature comparison using diode connected transistors as sensors, accuracy? - Page 1
Forum section: electronics / beginners

author: G-son
author_rank: Regular Contributor
timestamp: May 14, 2023, 09:44:26 am
content: I want to compare two temperatures and start/stop a fan depending on which is hotter, say around 1 degree C accuracy would be the highest requirement.How accurate results can you get by just grabbing two transistors of the same type, run perhaps 0.1 or 1mA from series resistors through the B-E junction and comparing the voltage drop? Are they close enough to give that accuracy or would some calibration be required? Just want to make sure the fan is on when there's cooler air available, and not when the air available is hotter.

author: Benta
author_rank: Super Contributor
timestamp: May 14, 2023, 09:56:36 am
content: Motorola used to supply transistors specially selected for this purpose. There was a +/-2% and a +/-3% version, MTS102 and MTS103.If you look for an old datasheet of those it might help you further.EDIT: the datasheet actually shows an application for differential temperature measurement:https://pdf1.alldatasheet.com/datasheet-pdf/view/941860/MOTOROLA/MTS103.html

author: David Hess
author_rank: Super Contributor
timestamp: May 14, 2023, 11:50:20 am
content: Look up "delta Vbe" temperature measurement. The change in forward voltage drop is proportional to temperature when measured at two currents with a constant ratio. This can be used to make an accurate temperature measurement while ignoring the variation in absolute forward voltage drop.Otherwise the forward voltage drop changes by about 2 millivolts per degree C so matching of the transistors to perhaps a millivolt would be required, which is not difficult, and is probably the easiest thing to do for just a couple units.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 14, 2023, 11:56:01 am
content: The scattering of Vbe is usually a bit larger than 2 mV, often more like 5 or 10 mV.One could use selection or adjust one of the currents to get the same VBE when they are at the same temperature.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 14, 2023, 02:20:06 pm
content: A PN juncion works quite well as a temperature sensor, but B.J. Transistors are not specified or tested for this. Result is that individual calibrarion is probably needed. The voltage over the PN juncion is also very dependent on the current, and you have to make sure to design that into your system. For a few circuits, you can easily add a potentiometer to adjust the current to get the same voltage with the same temperature, but for higher volume production this is inconvenient, and it's more common to use factory calibrated temperature sensors such as:https://en.wikipedia.org/wiki/Silicon_bandgap_temperature_sensor

author: langwadt
author_rank: Super Contributor
timestamp: May 14, 2023, 02:28:40 pm
content: PT1000 might be a better option, at 1mA they are about 3.9mV per degree C

author: G-son
author_rank: Regular Contributor
timestamp: May 14, 2023, 03:51:44 pm
content: Quote from: Doctorandus_P on May 14, 2023, 02:20:06 pmQuote from: Kleinstein on May 14, 2023, 11:56:01 amIndividual calibration isn't a problem, as long as the circuit remains fairly stable once calibrated.How about running the current for both transistors through one resistor, then into the center tap of a potentiometer, and from each end of the potentiometer to each transistor? tuning the pot increases current through one and decreases it for the other, I'm thinking a quite small difference would be enough to get them balanced, not enough to change their temperature? Clamp the two transistors together to ensure they are the same temperature, adjust to the same voltage, and then hook them to a comparator to get an output saying when A is hotter than B and Bob's your uncle.Quote from: David Hess on May 14, 2023, 11:50:20 amDelta VBE does look interesting and good for minimizing the need of calibration, but more than a few steps more complicated than the oneoff "junkbox parts" project level I am hoping for. Unless there's asimpleway to use delta VBE from universal components?Quote from: langwadt on May 14, 2023, 02:28:40 pmAs a temperature sensor it may absolutely be better. But they seem to start at close to $10 each and I don't have any I get a feeling they may be far better and more expensive than I may be able to get away with.

author: langwadt
author_rank: Super Contributor
timestamp: May 14, 2023, 04:43:04 pm
content: Quote from: G-son on May 14, 2023, 03:51:44 pmyou can get PT1000 much cheaper than that,https://www.conradelektronik.dk/p/yageo-m222-pt1000-temperatursensor-70-til-500-c-1000-3850-ppmk-med-radial-trad-172041

author: David Hess
author_rank: Super Contributor
timestamp: May 15, 2023, 12:36:06 am
content: Quote from: Kleinstein on May 14, 2023, 11:56:01 amSure, but buy a lot of 10, and then check them all and one pair will likely match much better than 1 millivolt. It isn't like 10 transistors, or even 100, are expensive.Quote from: G-son on May 14, 2023, 03:51:44 pmI was thinking of something a little simpler. Match two transistors for Vbe at the same temperature and current, and then wire them in series as half of a bridge with the other half of the bridge being two precision resistors, with or without a potentiometer in the middle for trimming. Now when the bridge output is positive, one transistor is hotter than the other, and when the bridge output is negative, the other transistor is hotter than the other. Wire a comparator directly to the bridge output, with the positive lead going to the junction between the resistors so that lead can accept hysteresis from the output. Drive the bridge with a current instead of voltage, but that can just be a resistor to a fixed voltage supply.I did something like this once but not knowing any better I used 1N4148 diodes instead of transistor junctions. It worked fine, but 2N3904s would have worked better.

author: G-son
author_rank: Regular Contributor
timestamp: May 15, 2023, 07:40:37 am
content: That does indeed sound quite simple and and suitable for comparing temperatures! Would that be a wien bridge, or is that another type of measuring bridge? One of those things I've read about some time long ago, but never used.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 15, 2023, 07:51:24 am
content: Quote from: langwadt on May 14, 2023, 04:43:04 pmIf the temperature range is limited, there are NTC temperature sensor, that are about 10 x more sensitive than PT1000 or similar. The slightly better ones in a glass case may even be more stable than the cheap unprotected thin film PT1000. As an example:https://www.tme.eu/en/details/ttdo-10kc8-3/tht-measurement-ntc-thermistors/tewa-temperature-sensors/Pt1000 with 1 mA is a bit on the high power side and may react to wind. Normally PT1000 is used with 0.3 mA to keep the self heating low.For the bridge circuit one could use the resistors to trim for a possible small difference in the diodes / transistors.One could as well use a more current mirror like circuit and use the gain of the transistors to directly get an amplified output signal. So 2 NPN transistor at the negative / ground side with emitters to ground, the bases linked to one collector and same resistors at the collectors to the supply. The gain depends on the supply voltage and is on the order of Vsupply / 50 mV or some 100 fold for a 5 V supply.

author: Gyro
author_rank: Super Contributor
timestamp: May 15, 2023, 08:56:31 am
content: BAV99 dual diodes will give you 4mV/'C in a SOT23 low thermal mass smd package. For series diode configuration, you can snip the middle pin and mount them on bits of 0.1" stripboard etc. for wire strain relief.

author: David Hess
author_rank: Super Contributor
timestamp: May 15, 2023, 03:33:03 pm
content: Quote from: G-son on May 15, 2023, 07:40:37 amThey are the same thing. The precision resistors provide a reference at exactly one half of the excitation voltage which is generated across the two diodes in series, so the exact excitation voltage and current are not important. If the diodes match at the same temperature, then the output will rise or fall below the midpoint depending on which diode is hotter than the other.A temperature comparison circuit can be made using thermocouples in the same way with the thermocouples connected in series, except now the thermouples provide their own excitation. And because two thermocouples are used, no cold junction compensation is required to measure a difference in temperature. The voltage from the two series connected thermocouples is zero when their temperatures are equal. Another way to think of this is one thermocouple provides the cold junction compensation for the other.

author: magic
author_rank: Super Contributor
timestamp: May 15, 2023, 06:57:07 pm
content: Thermocouples generate very low voltage, demanding a more accurate opamp/comparator to obtain low error. For thermal diodes, even a lousy LM358/LM393 would likely suffice.The diode-diode, resistor-resistor bridge seems a more straightforward solution. Another simple one is to use two equal resistors as "current sources" for two grounded diodes and compare their forward voltages. Perhaps even less sensitive to resistor mismatch than the former option, but I'm not 100% sure.Transistors from one production lot usually vary less than 10mV, and a majority of them will be within maybe 3mV of each other. Quite easy to select a reasonable pair even from a lot of 10.Avoid touching them during matching because they all need to be at exactly the same temperature.

author: magic
author_rank: Super Contributor
timestamp: May 15, 2023, 07:07:50 pm
content: Quote from: Kleinstein on May 15, 2023, 07:51:24 amI like this. The added gain vastly decreases influence of the comparator's offset voltage.Or, if high precision isn't required at all, you could eliminate the stupid comparator chip and directly drive the base of a third transistor switching the fan. Or maybe make it four stages for more current gain.

author: fourfathom
author_rank: Super Contributor
timestamp: May 15, 2023, 07:11:57 pm
content: Just curious, is there any advantage to connecting the base to the collector in a transistor VBE temperature sensor? Or does the HFE variation make things worse?

author: magic
author_rank: Super Contributor
timestamp: May 15, 2023, 07:30:59 pm
content: The base has tens to hundreds ohms of parasitic resistance in a typical TO92 transistors. Joining it with the collector bypasses this and any problems like mismatch/drift it could cause.I think Vbe is also more consistent between units that way than with open collector, but again, not entirely 100% sure if I remember right. Go measure your own bag of transistors

author: mawyatt
author_rank: Super Contributor
timestamp: May 15, 2023, 07:44:09 pm
content: Also, due to negative feedback the VBE Source has a much lower AC active impedance "looking" into a CB connected VBE transistor, rather that just a BE Junction.Best,

author: fourfathom
author_rank: Super Contributor
timestamp: May 15, 2023, 09:51:15 pm
content: Quote from: mawyatt on May 15, 2023, 07:44:09 pmYes, I've done a few designs with the base-collector connection, thinking that the effects of load impedance and base resistance would be minimized. I'm pretty sure I saw this recommended many decades ago, but I don't recall if this advice was authoritative or just speculation. These days I have a bag full of MPC9700s for when I want a temperature sensor -- easier calibration than a random VBE.

author: MathWizard
author_rank: Super Contributor
timestamp: May 16, 2023, 06:33:05 am
content: Quote from: Doctorandus_P on May 14, 2023, 02:20:06 pmOne computer PSU I worked on ages ago, it had a shrink wrapped diode, tucked up inside the bundle of output cables, as a temp sensor. I never finished working on that PSU, but I've been curious about what circuit they went with for it. They used a 10k ohm thermisitor on some heatsink, so at the time it I was surprised to find a diode in the bundle of cables.Just last week I learned some equations for diodes with a temperature coefficient, next I should see what they are for common BJT's

author: Terry Bites
author_rank: Super Contributor
timestamp: May 16, 2023, 09:48:24 am
content: Diode connected 2N3904s will work fine. You want to use the same type of transistor.As pointed out, you don't need any close matching, you can exploit the semicondutor physics directly.The Vbe of the junction is directly proprtional to the current at any given temperature.If you switch between two currents (I1, I2) as a fixed ratio, then∆VBE = Tabs* 198µV* LOG10(I1/I2), say 6mV at 30'C. I plotted this in excel, the slope and offset (for 10:1) are V = 0.0002T + 0.0541Switch the currents, say 10:1, now we have a delta Vbe corresponding to abs temperature. A rectangular waveform with an amplitude of ∆VBEA take on this theme is here.www.edn.com/transistor-%E2%88%86vbe-based-oscillator-measures-absolute-temperature/Simple and precise T to f conversion. Its ideal as a uC can read it without any extra signal conditioning. Very handy for a variety of uses.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 16, 2023, 10:02:59 am
content: Th elinked application note is about the the method of using 2 different current levels for the same diode and look only at the difference. In short the difference in the VBE for a pair of 2 current is directly proportional to the absolute temperature with relatively little variability between parts / units. So signal is smaller (e.g. 0.1 mV / K range, depending on the current ratio).It should be OK to use this meathod also in a bridge configuration and thus get an AC signal proportional to the temperature difference with rather little offset even without well matched parts.

author: tszaboo
author_rank: Super Contributor
timestamp: May 16, 2023, 10:09:29 am
content: Quote from: langwadt on May 14, 2023, 04:43:04 pmBoth are true, PT1000 as individual sensor can be reactively cheap compared to buying it as a cable assembly, with high accuracy, and larger measured temperature range. You get PT1000s to 0.1K or even better specs, NTCs with 1K accuracy and diodes or diode connected transistors are a bit lower than that.If you just want temperature sensing on a PCB usually the easiest is that you use a LM75 or better sensor, and outsource the complexity of measurement to semicon makers.

author: David Hess
author_rank: Super Contributor
timestamp: May 16, 2023, 03:02:29 pm
content: Quote from: tszaboo on May 16, 2023, 10:09:29 amRTDs would be nice to use, but I keep finding that they are too physically large for what I am doing, and calibration of the signal conditioning circuit is not trivial.My current interest is signal conditioning of K type thermocouples for higher accuracy, but there are no published examples of analog linearization.QuoteI like the delta Vbe method with a transistor, and there are SPI/I2C building blocks which implement it with an external junction. For lower accuracy single projects like a fan control, just calibrating out the Vbe offset is enough.There is also a more accurate triple delta Vbe method which removes the effects of lead and spreading resistance, but I do not know of any ASICs which implement it.

author: tszaboo
author_rank: Super Contributor
timestamp: May 16, 2023, 03:22:21 pm
content: Quote from: David Hess on May 16, 2023, 03:02:29 pmThere are RTDs in 0603 packages, Vishay for example makes them.About the calibration: You don't need to calibrate if your reference resistor is 0.01% and 1-2ppm/Ktriple delta Vbe method: Sounds interesting but I only found an EDN article without images, and it didn't make sense without it. Do you have any examples of it?K type thermocouples for higher accuracy: Analog devices has some quite mature parts that do this. Cerdip packages, analogue input and output, usually obsolete and very expensive chips. But maybe there is some info available about them?

author: David Hess
author_rank: Super Contributor
timestamp: May 17, 2023, 01:45:01 am
content: Quote from: tszaboo on May 16, 2023, 03:22:21 pmIn an analog design I would still need to 3 point calibrate gain, offset, and the linearity, which either requires 3 reference temperatures and a lot of time, or the right 3 precision resistors, which unfortunately nobody apparently sells. Doing this gives a useful 0.005 degree accuracy. I suppose I could *make* the reference resistors.In a digital design would I trust the results without checking the calibration?QuoteThe EDN article is the only reference that I am aware of. The original had schematics. The math is straightforward.QuoteI think that is just the cold junction compensation which has nothing to do with linearization. My current accuracy is limited by linearization. If I want something better, I may have to do some curve fitting based on the NIST tables for thermocouple response. I had just hoped that someone had already done and published the work.

author: magic
author_rank: Super Contributor
timestamp: May 17, 2023, 08:30:42 am
content: Measure at 1mA, 2mA, 3mA.Calculate (V2-V1)-(V3-V2), which is:(ΔVbe(2/1)+1mA·R) - (ΔVbe(3/2)+1mA·R) = ΔVbe(2) - ΔVbe(3/2) = ΔVbe(4/3)where ΔVbe(x) is the ideal delta-Vbe for current ratio x and R is the unknown series resistance.You may want the first current much lower for a greater ratio and higher sensitivity.The differences between subsequent currents must be the same for I·R cancellation to work.

author: tszaboo
author_rank: Super Contributor
timestamp: May 17, 2023, 10:29:08 am
content: Quote from: David Hess on May 17, 2023, 01:45:01 amFor such high accuracies, yes a calibration of the measurement circuit is necessary. How I do it in our production (to lesser specifications):-1KOhm Vishay bulk metal foil resistor is connected instead of the PT1000 for gain cal.-The offset is measured by shorting the inputs.I've verified the circuit and method to work to work much better than the Class A RTD that we buy.Vishay precision group will make foil resistors to any resistance values that you need, they are 20-30 EUR each, and Digikey carries a few standard values.For the thermoucouples, the part number is eg. AD595 and it indeed doesn't do linearization, just cold junction compensation. I guess everyone nowadays does this digital. Even though it could be a simple JFET or regular transistor with some passives to do this compensation.Quote from: magic on May 17, 2023, 08:30:42 amI guess transistors are cheap, so you could use the same circuit with different setpoints measuring 3 different transistors. While keeping the wire length and width same on the PCB?

author: magic
author_rank: Super Contributor
timestamp: May 17, 2023, 05:00:38 pm
content: Quote from: tszaboo on May 17, 2023, 10:29:08 amThis is a method for measuring temperature with one transistor, relying on fundamental diode physics, without transistor matching or individual calibration of each sensor.If you are suggesting using multiple such sensors to solve the original problem, i.e. comparing two temperatures, then sure.If you are suggesting using three transistors at three DC currents for the triple Vbe method, then nope, you would need to match them for Vbe or calibrate the resulting circuit.

author: David Hess
author_rank: Super Contributor
timestamp: May 17, 2023, 07:52:52 pm
content: Quote from: tszaboo on May 17, 2023, 10:29:08 amHmm, that gives me an idea. If I had 3 reference resistors which are not the exact values, but are stable and known values, I could still do it, at least down to 0.05C. From Linear Technology application note 11:To calibrate this circuit, substitute a precision decadebox (e.g., General Radio 1432K) for RP. Set the box to0°C value (100.00Ω) and adjust the zero trim for a 0.0Voutput. Next, set the decade box for a 140°C output(154.26Ω) and adjust the gain trim for a 1.400V outputreading. Finally, set the box to 400°C (249.0Ω) and trimthe linearity adjustment for a 4.000V output. Repeat thissequence until all three points are fixed. Total error overthe entire range will be within ±0.05°C. The resistancevalues given are for a nominal 100.00Ω (0°C) sensor.Sensors deviating from this nominal value can be usedby factoring in the deviation from 100.00Ω. This deviation,which is manufacturer-specifi ed for each individualsensor, is an offset term due to winding tolerances duringfabrication of the RTD. The gain slope of the platinum isprimarily fixed by the purity of the material and is a verysmall error term.QuoteThe Fluke 80TKs that I am using have some analog linearity correction. Otherwise the curves are available from NIST if you want to implement it in the analog or digital domain.QuoteDelta Vbe measurement works by measuring the difference in Vbe of a single transistor at two different currents which have a constant ratio. The difference in voltage is then proportional to absolute temperature times a constant from the fixed ratio of the difference in currents, with an error term from the unknown series resistance. No calibration is required.Triple Vbe measurement measures the difference using three currents, which removes the error term from the unknown series resistance.The resistance is not just the lead resistance, but also the unknown base/emitter/collector spreading resistance in the transistor itself. Using a transistor with low spreading resistance, like an LM395, MAT series, or common "low noise" transistor minimizes this error if it is not compensated for, or use a minimum of excitation current to minimize its effect.

author: langwadt
author_rank: Super Contributor
timestamp: May 17, 2023, 10:57:46 pm
content: https://web.archive.org/web/20171127055015/http://www.thermometricscorp.com:80/pt100

author: MrAl
author_rank: Super Contributor
timestamp: May 18, 2023, 06:23:28 am
content: Quote from: G-son on May 14, 2023, 09:44:26 amHello,Not sure if anyone mentioned this yet but if your temperature setting is always the same you can get really good repeatability which is the most important.For example, if the temperature of one is 20C and the other 22C and that's always the case, then you can just measure two diodes and do the math. The two diodes should always show the same Vd voltage for those two temperatures.If you have to have a wider spread, like first 20C and 22C, and then 24C and 26C, then the two diodes just have to track. That's a little different so you would have to introduce some calibration which may come from a gain stage and offset adjustment.

author: Chalcogenide
author_rank: Regular Contributor
timestamp: May 18, 2023, 07:30:55 am
content: I don't know how cost sensitive the application is, but there are dedicated ICs that allow "remote diode" temperature measurement (like LTC2996 and LTC2997) that might work.

author: G-son
author_rank: Regular Contributor
timestamp: May 18, 2023, 08:47:55 am
content: Well, thank you all, I have learned much more than I expected here! Some about the accuracy I need and simplicity and low price I like, some about far higher accuracy but that may be useful for another project some other day!I think I'm good for now, but feel free to keep the discussion going, I'll read it all and might even understand some of it!

author: MrAl
author_rank: Super Contributor
timestamp: May 19, 2023, 03:17:48 am
content: Quote from: Chalcogenide on May 18, 2023, 07:30:55 amHi,Interesting idea, but these look like they come in very small packages, like QFN with pin spacing very small. The whole chip of the 2996 is just 3mm by 3mm, square. There are 5 pins within about 2.5mm spacing (ha ha). Maybe use with an adapter or something.Any ideas for larger packages?

author: MrAl
author_rank: Super Contributor
timestamp: May 19, 2023, 03:20:10 am
content: Hello again,After i posted my previous post i remembered there are other ways to do it, such as with a microcontroller. You can then get chips that measure temperature and send the info to the uC chip digitally. I think you can also get analog versions too though. These would not use diodes as sensors however, the chips themselves are the temperature sensors.

author: RoGeorge
author_rank: Super Contributor
timestamp: May 19, 2023, 09:49:43 am
content: Quote from: G-son on May 14, 2023, 09:44:26 amTo compare, there's no need for accuracy, only precision. The two sensors have to be precisely matched with each other, and have to have at least 1*C resolution, their accuracy (how true they are relative to the absolute temperature) doesn't matter.Might worth considering buying some thermocouple wires, with one end to one side, and the reference (cold junction) on the other side. The fan would be controlled by the sign of the produced voltage. This should have very good precision, since the metal of the wires has a uniform composition. However, this approach will have to deal with microvolts, would probably need a zero offset (chopped) opamp would be needed.Might be easier to buy precision thermistors, so to avoid any calibration. They are easy to read with an ADC, can be accurate to less than a fraction of a *C (random search resul, +/- 0.2*Chttps://atcsemitec.co.uk/product-category/precision-ntc-thermistors/).Since you only need to cool, might be possible to self calibrate while running.Use whatever two sensors (uncalibrated), start the fan, and if the other side doesn't get any cooler, stop the fan and adjust the calibration data.

author: langwadt
author_rank: Super Contributor
timestamp: May 19, 2023, 11:45:03 am
content: or just use two LM35 or similar and be done with it