Jul 01

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.

Average rating  1 2 3 4 5fYou must login to vote

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…..

If you found this post useful or interesting, please consider giving me a tib.
Tibs are pocket-change for the internet™.
Jun 14

Fully Programmable Modular Bench Power Supply – Part 4

After a fair amount of playing about, measuring and trying things I finally arrived at a working design. I am happy I have what I think is a good starting point of rest of the project. I have something that is working and feels much more stable under a varying capitative and resistive loads, I have a high degree of confidence that I am now on the right track. Having resolved the issues with stability I have now added a current shunt, high-side current sense amp and current error amp for current regulation, I have also added a couple of amps in comparator mode to sense the regulation state to show if the regulator is in constant volts or constant current mode or out of regulation all together.

PSU Schematic Version 0.4a

To sense current I have used a high-side current sense amp type MAX4080F, this is a really nice single chip solution designed for the exact purpose, it has a wide supply range and the “F” version has a x5 gain factor. Using a high-side current sense amp means that I do not need to sense in the ground return path which in turns helps keep things simple. The MAX4080F reads the voltage dropped across the current shunt which is made up of 10 x 1R resistors in parallel. The voltage read is multiplied by 5 and delivered to the output pin. In this configuration a load of 0-5A gives me a voltage output of 0-2.5v which is fed back to the current error amp limiting current to what has been set on the CC_REF input.

Here is a quick video taken to show the constant current limiter kick in as a filament lamp warms up and current demand drops. Turn the PSU output on and the cold lamp draws current beyond the limit set (indicated by the red LED), but as the lamp warms up and draws less current the PSU transitions from CC mode to CV mode smoothly.

In Part 3 I mentioned the idea of having a very stable low-power full voltage range regulator, this is what I created around Q5 and Q6, with R8 acting as its load. The IRF540 Q4 is then simply acting as a voltage follower which scales up the power handling, its source simply follows the voltage on the collector of Q5. This configuration works really well and is much more stable (more on that in a second), but its not perfect. I am not entirely convinced about the use of a FET as the final pass device any more. Its easy to drive because of the low drive current needed, but being a linear regulator circuit the output FET never does the one thing that its really good at which is being turn hard on, so despite having a positive grid bias supply that will allow this, its never used. The FET device is perfect for the pre-regulator switch (Q2) so I don’t need to change that but it would seem like there is an opportunity to simplify this circuitry further in the final output and driver section, so this is not yet a finished design, but its certainly a workable one. The decision may well come down to the bill of materials in the production, if we are using the FET for the pre-regulator, then we may as well use the same device as the pass transistor – we shall see….

For now I am not expecting to use the pre-regulator, it is in effect wired out by being switched on by default, If you were to build this circuit as as and do not wan’t pre-regulation (as would be the case in the 0-6v configuration) you would simply exclude Q2, Q3 and their associated bias resistors and put a link on the board between the drain and source pins where Q2 would have been. The pre-regulator will be introduced later and is specifically required to lower the overall heat dissapation of the regulator circuit under certain load conditions. The pre-regulator switching control will be done by the micro processor in the main but I do need to add some direct analogue feedback mechanism to ensure the regulators dynamic response is not impacted by any software or hardware latency the micro controller would introduce in this setup. Basically the idea is to sense any significant change (ac coupled) on the control point at the junction of D8 and D9 and if detected turn the pre-regulator hard on for a set period of time, lets say 250ms or so which will ensure full power is immediatly available to the drain of Q4 which will regulate as required. During this forced on time, Q4 will dissipate all of the heat generated by the power dropped across the regulator. Because of this forced on time, the micro controller will have time to sense the large amount of power being dissipated by Q4 by sensing the voltage differential between PRV_MON, I_MON and V_MON and will start driving PRE_REG to take over, in effect this is a lazy pre-regulation control that will only kick in once the load has stabilised, the micro controller will slowly wind down the power delivered into the resevour caps by switching the 100Hz drive from the bridge rectifier on the rising and falling slope of the half cycle, keeping a reasonable differential across Q4 for the given load. The pre-regulator control switching will be synchronised to the line frequency which will be sensed via the AC_SENSE signal.

Average rating  1 2 3 4 5fYou must login to vote

Back to the regulator stability topic, I have removed all the capitative loading around the driver and output circuit and instead reduced the bandwidth of the control loop by including frequency-dependnat negative feedback on both the voltage and current error amps. The aim was to significantly lower the gain of the loop above the point where the feedback becomes positive and the servo action becomes unstable. The simple first order filtering built around R33/C11 and R34/C12 provides a very stable control loop in this configuration. DC conditions remain in tact but as the frequency rises in the circuit, then the negative feedback starts to kick in via C11 and C12 lowering the gain in the feedback loop. The filtering could be improved and there is definitly some improvements I need to make at very low output voltages (0-50mv). The basic regulator circuit I have ended up with is pretty classic and has been done many times before so there is nothing new, but for me what I have achieved is creating a circuit from the ground up and getting my own understanding up to a level that allows me to properly comprehend the behaviour and problems that can occur with such a circuit and some basic ideas on how one would tackle the problems when they do arise.

The regulator in the configuration shown means there is a x10 voltage gain, so for 0-3v in I get 0-30v out, and for current limiting, for 0-500mV in I get a 0-1A current limit. Doing some basic testing I was able to drive a load well above the rated power of 30W (almost 50 watts) without a problem and with good load regulation. The regulator tracks very accurately according to my Fluke 289 and Agilent 34401A into both load and no load conditions. I was able to short the output out while it was driving into a half load, full load and no load with no damage or noise problems – the current limiting works nicely. I have yet to do any testing around dynamic response, I don’t have a programmable DC load so I need to work up a simple test rig to do this which I will leave for another article.

I have based the entire design on a single rail power supply for the op amps, using single supply op amps type LM358, these are common, low cost devices. I have tried using LT1013 precision op amps in this circuit but there is not any improvement over the LM358’s, primarily because the circuit remains accurate because of the control loop that ensures this, so precision op amps are not needed.

As a final check, I was measuring the output noise on a scope which was looking pretty disappointing, I was getting 25-60mv of white noise and some very minor high frequency ringing, I think the latter could well have been scope leads etc. Slugging the output with a big electrolytic cap helped reduce the noise but it was still present. Having tried a few things I suddenly realised that my test setup was flawed in relation to noise testing. I was using the 0-6V range on my Agilent E3631A to derive my CV_REF control voltage which is bad. Firstly the Agilent PSU generates some noise, about 2-3mv worth of it and secondly, my regulator circuit is a x10 amplifier so i was amplifying whatever noise the E3631A was generating by a factor of ten. I tried the same test but driving the CV_REV signal from a 1.5v AA battery cell and low and behold the noise figures plummeted to below 2mv on the output into a load at 16v – lovely. I have not carried out tests of any substance yet but the early results are very encouraging.

So I now have a working regulator, what next? In Part 5 I am going to set the regulator aside for a while and turn my attention to the digital control circuit. I am going to use a micro controller with a DAC and ADC to try to create stable and accurate control reference voltages to drive the regulators CV and CC reference inputs as well as relatively accurate and high resolution metering to measure the output volts, current delivered and pre-regulator voltages. I want to achieve good accuracy for both reference voltage generation as well as metering but plan to try various configurations, DAC/ADC’s and software approaches to see see what can be achieved at a sensible component price point.

If you found this post useful or interesting, please consider giving me a tib.
Tibs are pocket-change for the internet™.
Jun 04

Fully Programmable Modular Bench Power Supply – Part 2

Now the overall high level system design and parameters are set (see Part 1), its time to get down to some practical design. As I specifically do not want to use one of those “out-of-the-box” all in one regulator chips the first thing we need is a working linear voltage regulator that we can build upon. Using the prototyping breadboard I created the following circuit. The objective was to set up and verify the DC conditions for a basic regulator. Unlike a classic regulator circuit where there is typically a fixed reference and a variable resistor (POT) in the feedback loop, this regulator calls for something slightly different because our micro controller and appropriate DAC will generate an accurate reference voltage between 0 and a couple of volts, the exact value of which will be set by the user; the regulator circuit must track this reference voltage and set its DC output to a multiple of that reference.

The following schematic shows my initial 30 minute attempt at building such a regulator.

PSU Schematic Version 0.1

I should state at this point that the circuit is basic and is missing lots of things that one would expect to find. The purpose of this initial design was not to create a perfect regulator but was to setup a circuit to verify the basic DC conditions and theoretical practicality of the circuit.

The circuit is built around a FET pass device (type IRF540) which is the power workhorse. Unregulated power into the drain with the load placed on the source. The op-amp is configured as a simple error amplifier. The op-amp will move its output up or down (depending on the input state) in order to get its two inputs as close together as possible. Because the op amp drives the power device and the negative input of the op-amp is derived from the output that the power device we have a closed loop servo circuit and this is in essence what a typical regulator is made up of.

Because of the closed loop nature and the tight feedback loop, one of the biggest problems with these types of control circuits is stability. Each component and any introduced capacitive or inductive loading will create phase shifts (all components exhibit parasitic capacitance and inductance). Phase shifts will put the circuit into positive feedback at certain frequencies so there is a good possibility that such a circuit will become an oscillator at certain frequencies. As a consequence, a great deal of attention needs to be paid to this problem in the design which needs to ensure that it works reliably and remains stable within the scope and specs of the requirements. The more voltage and current range required the more difficult it is to tune the circuit to be stable of the range. Component choice, DC conditions, speed/bandwidth, gain, noise and PCB/Track layout all matter a lot here. It’s for this reason that many power supply designs avoid discrete solutions in favour of a one-chip solution. Discrete regulators are hard to make, and even harder to make reliable and stable and to be honest, most people cannot be bothered when there is a $2 off the shelf IC that will do the job most of the time. However, a professional grade programmable bench power supply needs something more than what these one chip solutions offer.

Considering the breadboard approach to building the above circuit (see photo) under moderate loads the regulator circuit was pretty stable, actually I was very surprised just how stable it was.

Birds Nest Construction

I thought I was on my way but very quickly realised I was actually on the wrong track. The reason why this design is stable is because it does not have much gain, in fact it has a gain of just 2. So put 2 volts into the V_REF input and get 4 volts out. The driver transistor Q1 is in effect a current amplifier in this configuration – the op-amp has to swing its output pretty much the range of the desired output. For low voltage requirements where you con comfortably run your entire circuit from a single supply this is a very good approach because of the inherent stability of the circuit. However, this design requires a regulated output of 0-30v which would require the unregulated input voltage after the rectifier and reservoir caps to be about 45 Vdc. Not many op amps can run at this level, and those that can are only just within range so we would be right on the edge of the spec for the device which does not make for a robust design and I personally don’t like components being pushed to their limits – it feels wrong, a bit like driving your car continuously in the red like, you can do it but not many people want their car to scream like that all the time.

In order to facilitate ease of use and the modular design I have set out to achieve, I want to create a regulator module that runs from a single AC power source, a single winding from the mains transformer. Many bench PSU’s (for example, like the Agilent E3631A I recently repaired) have multiple internal power supplies where the control circuitry is powered separately from the main power source. This makes it easier to design for higher regulated voltages and helps with things like noise immunity too but because of the design goals I have set it’s not an option for this design.

The design needs to take into account some system design constraints. No split supply for the op-amps, so we need to use single-supply capable devices. The op-amps and control circuitry need to run at a much lower voltage than the pass device and regulator output and the only way that is possible is by introducing voltage gain outside of any op amp. Voltage gain using an emitter follower (or equivalent approach) provides the level translation needed and lots of gain but that’s where the stability problems start.

In Part 3 I will describe the next evolution of the regulator circuit where I introduce gain and a considerable amount of instability and start to formulate a workable solution.

If you found this post useful or interesting, please consider giving me a tib.
Tibs are pocket-change for the internet™.