PDA

View Full Version here: : OPAMP temperature control circuit


rcheshire
24-10-2015, 07:05 AM
Nothing new about this but cheap to build and accurate - a little temperature controller made up of parts from Jaycar and a TMP36 temperature sensor. No doubt room for improvement.

It's just an op amp voltage comparator circuit switching a transistor on and off to drive the gate of a mosfet or whatever might be driving a high current load.

The TMP36 goes to the + (non-inverting) pin with the temp setting (mv) potentiometer hooked up to the - (inverting) pin.

The 8v supply is nominal and is followed by a two stage voltage divider, which sets ~5v into the second voltage divider used for temperature setting - room for a range of power supply voltages.

The TMP36 does not require calibration and has a linear output from 100mv (-40C) @ 10mv/1C up to 125C. It has an offset of 500mv which corresponds to 0C. Very easy to set a target temperature for cooling or heating; e.g., 300mv = -20C.

The opamp is an LM324 (a single channel opamp would do) quad channel so it's possible to drive 4 circuits - dew heating, cooling and so on.

Fixed - (On the test bench it does very well but needs a -40 to -50mv offset when setting target temperature, as it tends to sit above. I think this is due to the stepping up of the output voltage with each mv of difference from the target. The correction is quite small and not adequate to overcome the thermal imposition. So aim lower for the target. Otherwise it ticks over +/- 1mv (0.1C) of the 'target' setting.)

Schematic shows it driving a Peltier (TEC) device.

EDIT: the humble test bench - target temp and holding about 38mv above - need to preset lower. The difference reduces with a decrease in temperature.

EDIT: modelling the simulator opamp to approximate the LM324 as closely as possible and then stepping the sensor input in mV increments shows a gap of 30mV between the target and actual temperature (mV). The mosfet/TEC requires all the opamp output voltage to maintain temperature.

EDIT: updated this simple fix to the over temperature problem. Another voltage divider transparently reduces the opamp input by 50mv so that the operator gets and sees the target temp.

The_bluester
26-10-2015, 07:54 AM
The issue with it not landing on the target temp is probably endemic so to speak. As your error (Temperature difference actual to target) reduces the drive to produce the correction also reduces and simple circuits like that often run out of puff a little way off the target.

Another design that can be very effective is the PID controller, often used in cars for closed loop control of idle speed or boost pressure in turbo cars. PID being Proportional, Integral, Derivative.

Proportional produces a correction in direct proportion to the error (Same as your OpAmp) and it will do the same thing and run out of puff a little way off the target.

Integral integrates the error over time, basically allowing a small error to build up a larger correction and drive the output harder.

Derivative produces a counter correction when the error is changing, basically limits the rate of change.

All three outputs are combined to produce a single correction figure.

rcheshire
26-10-2015, 09:14 PM
Thanks Paul. PID is an ideal alternative and warrants more investigation. Thanks for the explanation. I guess the opamp thing is intended to be a very cheap and easy 4 channel controller, as well as a bit of an electronics self-tutorial.

I have made a few changes to the Vcc section to accept 3 - 15v DC, without too much change in the reference voltage, reducing the number of potentiometers to 1, while keeping the supply voltage for the opamp and temp sensor in limits. 12v is probably the maximum anyone would want to use.

The_bluester
27-10-2015, 10:51 AM
PID's are used in fairly critical accuracy applications. I suppose for a temp controller on astro gear the only requirement is usually going to be heat, so a small offset between target and actual can be more or less dialled out by increasing the setpoint a little.

rcheshire
27-10-2015, 01:33 PM
I had both heating and cooling in mind, for DSLRs. It needs to be within 1C or so. The sensor output stays within 1 or 2mV. Not too bad.

EDIT: adding an extra stage appears to sum all the steps producing a square wave.

for heating swap the + and - pins; reference on - and input +

Camelopardalis
27-10-2015, 11:38 PM
This is gold Rowland, thanks for sharing this.

I'll need to revise my high school physics to decipher the wiring diagram but it looks small and neat. Would this get me around the PWM dependency?

rcheshire
28-10-2015, 06:38 AM
Dunk. The way to dispense with pwm altogether is to use a variable power supply, such as a buck convertor and monitor temperature by other means. A method of modifying ebay convertors to vary output in response to temperature would be very useful.

This is a low frequency on demand system, similar to pwm but without the constant chatter typical of mid range pwm values.

I am still playing around with the circuit and it worked on the breadboard. Time to solder it all up and see what differences are - breadboards can be unreliable - moreso with opamp circuits and may need tweaking.

Paul's input has generated a few ideas for improvement.

rcheshire
28-10-2015, 10:26 AM
When I am satisfied with the results, happy to build one on a proto board and have someone trial it. It must have a fuse - nominally 6A to protect the TEC. It also needs connectors and terminals to handle the low and high power sources.

Camelopardalis
28-10-2015, 11:48 PM
I'm keen to experiment and learn how to do this, once I've practiced my soldering a bit more :D

Hopefully my TMP36 will arrive in the next couple of days so I can start experimenting.

Steffen
29-10-2015, 01:52 AM
The use of a PID controller is unnecessary for (slow) temperature control, because in this application the plant already has integrating properties. A simple P controller will (eventually) lead to zero temperature error, since the controlled variable (temperature) is the integral of the controlling input (heat energy) over time.

rcheshire
29-10-2015, 04:53 AM
That is roughly the observed behaviour, somewhat modified by the circuit configuration.

All soldered, temperature dithers at an amplitude of 1.5C slightly above set point, over approximately 3 seconds. The mosfet gate pull down/up resistor value, presently 1M, resolved the large gap in setpoint vs actual temperature. No need to massage the reference voltage. I will experiment with different resistor values and see what gives.

Given that the test rig is not cooling a mass as it would be, connected to a cold finger, its very sensitive. The temperature oscillation will have little effect on temperature variation in practice because of the mass of the cold finger.

A bit more testing and I will post a complete schematic.

glend
29-10-2015, 07:23 AM
Have I missed something here Rowland? How are you displaying the setpoint and actual temperature of the sensor? I can't see a display circuit in the last schematic?
Secondly your response time/ over/under shoot time doesn't seem to be different from the 'big rig' PWM/Temperature Controller model. Is this going to improve in later versions or is it selectable in some way? Seems like you maybe doing exactly the same sor of circuit presently available in the ebay 12V temperature controllers. Not being critical, as it will be smaller for sure but I want to understand what the benefits might be of changing over from my 'big rig' setup.

rcheshire
29-10-2015, 11:27 AM
Glen. I should stick with what you have if you are happy. Absolutely no reason to adopt this at all, that I can think of.

It's just a DIY temperature controller. At this stage a single channel. Mirroring the existing circuit minus the power section and swapping inputs to the non-inverting and inverting pins, as required, it will eventually have 4 channels off 1 chip. Cooling, dew heaters etc, coffee warmer, glove and boot heaters if you want.

Temperature control is much better than previously indicated. The sensor was originally strapped directly to the back of the TEC. Since, I have added a piece of left over 1.2 mm copper to the test rig to emulate a CF - it maintains +/- 1 - 2mV (10 - 1/5th degree) easily. The fluctuations are helpful in that the dithering effect is averaged out by the thermal mass - the integral part of the plant, to use Steffen's words (correct me if I am wrong).

I have some mini voltmeters on order and these will be added to the schematic as a temperature reference. As mentioned in the first post, the TMP36 is a linear device and mV is easily converted to temperature.

500mV = 0C; 400mV = -10C and linearly between. Just need a voltmeter, which is a pain and only temporary - no idea when the voltmeters will arrive by ordinary mail from China?

Note: I have decided not to add temperature reference compensation as mentioned previously. Given the range of systems likely (if it ever gets used) the operator can easily set the temperature using the potentiometer and allow for individual system variation. Once set it is as far as I can tell based on testing, very accurate for astronomical purposes.

I recommend running it between 6 and 12 volts.

I will work on a 4 channel board if anyone is interested, otherwise the finished circuit is below in 4 separate sheets. Power section, temp sensor input, OPAMP section and then the TEC high current side. Sheets 3 and 4 tie it all together - note the AGND and DGND separation.

If anyone wants the kicad .sch file - you are probably using Linux - I will post it as well.

It's educational and a lot of fun.

mswhin63
29-10-2015, 10:09 PM
I run KICAD on Windows, so it doesn't really matter.

rcheshire
30-10-2015, 07:04 AM
Thanks Malcolm. Once I get the footprint thing sorted out I should be in business with a board.

rcheshire
01-11-2015, 05:09 PM
Here's a 3D mug shot of the board - single channel.

Power from the right and all other inputs and outputs on the left.

EDIT: there is an SMD version as well.

Update.

rcheshire
03-11-2015, 12:52 PM
There should be sufficient resources attached here to build the cooling controller.

Some pix - the board layout, another 3D image, a BOM (Bill of Materials) csv file and pcb layout to scale in the zip file (document viewer or pdf for the pcb)

Need the usual array of tools and chemicals to make a single sided PCB.

It really needs a visual indicating system of some sort. I will look at using an LED to illuminate at set point. As mentioned a voltmeter will do.

Set temperature in mV by turning POT1 with a voltmeter across R6. To measure actual temperature move the voltmeter positive probe (the Red one) to pin 2 of 750R. These points are connected to the - and + pins of the OPAMP and analog ground.

The supply voltage is much more stable with the use of a Zener diode as opposed to another potentiometer. It means that the voltage to the reference input varies slightly with different voltages but this is transparent to the operator. In any case the supply should not drop below that for the opamp and the temperature sensor - 3 and 2.7volts respectively.

The 0 resistor module is actually a wire jumper!!!

A word about the mosfet - this part is most likely not available at Jaycar. The very low rds(on) spec is essential otherwise a heatsink is required. These mosfets run cold in your hand and work at very low gate voltages. But keep in mind that resistance and therefore heat increases with lower gate voltage. Usually 10V is the spec - if running at 5V drain resistance will increase marginally - but still remain cool.

Through hole T220 packages that fit the bill - check prices (RS Components vs Digikey vs Mouser vs UTSource, etc etc)

NXP PSMN1R1-30PL
IRL40B209

I have tested this primarily at 8v - input will depend on the rating of the TEC. I said 3 - 15 previously - 5 - 6v minimum is more practical, as this will power the smaller TECs very efficiently.

rcheshire
04-11-2015, 10:53 AM
The SMD version - single sided.