Low-cost Temperature Measurement

As part of the Fully Programmable Modular Bench Power Supply project I needed to measure the temperature of the heat sink in order to provide some thermal protection. The aim is simple enough, monitor the temperature of the heat sink and if it gets too hot shut it down until the temperature returns to an acceptable level. As it turns out there is more to this than one might think.

Firstly I needed to decide on a sensing device. There are numerous options to choose from falling into three main categories of passive, active linear and active digital.

Passive devices like RTD’s and Thermister’s are available in all sorts of types and are basically resistors that change value with temperature. These devices need circuitry around them and can be complicated to use mainly because their rate of change is expressed as a percentage per degree which in practice means a very non-linear response curve to temperature change. For my needs this was too complicated, at best I would need some kind of signal conditioning, feed into the micro controlled ADC and a software map of temperature vs. voltage to get a reading.

Digital devices such at the Dallas DS1821 can be connected to a micro-controller or in the case of the DS1821 a 1-wire serial bus. The device can be queried and it will return information about the current temperature it is sensing. These are very nice all digital devices but carry the penalty of cost, they are not cheap, costing upwards of $2 a piece. Because of cost I decided not to pursue the use of these

Analog devices are solid state devices that provide a variable voltage out that directly relates to temperature being sensed and are basically linear. These devices are typically low cost, simple three pin devices with power in, ground and volts out. The following are good devices to look at: –

I was thinking about the Bill of Materials for my project and was not really wanting to add yet another part. I had read somewhere that silicone has a very linear temperature co-efficient of around -2mV/°C of temperature change, which means if you measure the voltage drop across a diode or transistor junction you will see a 2mv decrease in voltage dropped for every degree of temperature rise. As my circuit was already using some PN2222 devices which are general purpose NPN transistors and LM358‘s I thought it would be an interesting exercise to see if a simple discrete temperature sensor could be built.

Pen, paper, breadboard, some bits and an hour yielded the following circuit:

Temperature Sensor

This circuit provides a voltage swing of +1.5v to +3.5v for a temperature range of -50°C to +150°C. I was only able to test it down to a few degrees below zero but it tracked all the way up to 150°C without any problems. The data sheet for the PN2222 states it will operate down to -50°C so I have no doubt it will track downwards. Room temperature was at around 2v, I used a type K thermocouple and a Fluke 289 meter to calibrate it. The results of this circuit are surprisingly good and I did not add one single item to the BOM on the project, every component was already in use elsewhere in the circuit.

Home » Low-cost Temperature Measurement

PSU Version 0.2

Pictures showing the first prototype build of the regulator circuit and numerous scope starches of the resultant instability and noise

HP/Agilent E3631A Power Supply Teardown


PSU Version 0.4a

Photo's covering the development of the Bench PSU regulator described in Part 4

Temperature Sensor

Photo's of a discrete temperature sensor

Unfortunately the problem came when I needed to couple the device thermally. The main heat generating device on the project in question is an IRF540 in a TO-220 package. Bonding the PN2222 to the heat sink close to the device was my plan but in testing what I found was the lag between the IRF540 junction temperature and the heat skink temperature was enough that under extreme conditions the device will self-destruct long before the heat skink is hot enough to tell the control circuitry to shutdown. I found that the temperature on the plastic front of the device was much hotter than on the heat sink so I think the sensor really ought to somehow be mounted on the front of the device where the thermals are closer to the junction temperature than the heat sink. This exercise also convinced me to change the device to a bigger IRFP240 which is physically bigger and has better thermal properties. Although the data sheet for the IRF540 puts the device well within spec, I am more comfortable with the bigger package, more surface area must mean better thermal properties.

Back to the BOM – the PN2222’s that are in use in the project are in an SMT package so there was no practical way to thermally couple the two devices which meant I would need to add a TO-92 packaged device to the BOM and that really took away any advantage I had gained by using components already in the BOM for the project. I thought it still worth publishing the circuit as it may be of some use to others, pretty much any op amp and any silicon diode or transistor will yield much the same results.

In the end I opted to use the MCP9700A device from Microchip Technology, this is accurate enough for what I need and costs around $0.50 for a one-off. Still more expensive than the discrete design but I am trading that off for simplicity. The MCP9700A has a known temperature range and a known voltage output so interfacing to the MCU is as simple as connecting it to one of the ADC channels and measuring 10mV per degree of temperature – easy…..

This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.


  1. Hi Gerry,

    Outstanding series on the power supply, but I could not duplicate the results of the temp. circuit.
    Is the output taken from the circuit or from the micro controller? Seems like the circuit has a gain of 3.09 (6800/2200) and can not produce an output of 10mv / degree.

    Looking forward to the HV version of the power supply which should be much less expensive than the HP.

    Best Regards,

    1. Hi Russ,

      Silicone changes its voltage drop by a little over 2mV pr degree C, the gain was only approximate based on resistors I already had in the BOM so it won’t be exactly 10mv per degree but its pretty close from what I can remember. You can play about with the gain to get it closer.


  2. Hi Gerry,

    Thank you for the quick response – especially on a Sunday concerning a circuit you no longer plan to use. I learned some things about op amps via this circuit. The output is very sensitive to the 5 volt supply. Room temp output for 5.5 volts is computed to be 2.06 v. Room temp output for 5.0 volts is 1.69 v.

    I am also impressed with the gentleness of your posts – even if someone is a little bit rude.
    Please keep up the good work, and thank you for sharing your many talents.

    Do you have an estimate on the cost of the PC board?

    Best Regards,

    1. Hi Russ, you are most welcome. The circuit is very sensitive to the PSU as you say, the reference is s simple resistor divider. In a better implementation (i.e. in my PSU project) I would use the 4.096 refernce voltage which would stabilise it considerably. However for a crude temperature sensor its cheap and easy to do. Glad you learned something. Are you talking about the OCXO board? or the PSU board? I actually have no idea on either just now – they won’t be expensive for the bare boards – I am not trying to make a living off them – perhaps a little markup to help support the blog activities and stuff to teardown 🙂 Gerry

  3. I would guess that you have many people following your PSU development and would like to know how much the PC board will cost as well as the parts. I would like to have a PSU, but it would be hard to justify given the nature of my projects (very small). In addition I’m not sure I could solder surface mount parts.

    Looking forward to your continued adventure – even if I can not justify a PSU.

    Best Regards,

    1. Well the bare boards would not cost that much, say $12 each or something like that. The problem is, thats really just the tip of the iceberg. The PSU uses some expensive Linear Technology parts and I have not even gotten to the front panel controller yet, the PSU is not going to be a cheap build, it is an effort to design something that is at the high end of PSU specs, as much an academic exercise to see what can be achieved. But, I will build myself a three channel one – after all, I cannot go to all that effort and then not make one for myself 🙂

      I was thinking about (after I finish the current PSU project) designing another bench PSU that is programmable too, but simple and really cheap to build, that would interest a lot of folks I believe and it would be fun to see how much can be designed out while keeping a reasonable specification.


  4. $12 sounds reasonable – especially considering the cost of a high end PSU. I have not seen an inexpensive PSU. I expect you would find a lot of people interested in such a project – maybe even more than those interested in your current PSU.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.