Craigs thermostat circuits
The circuits below are variations on basic thermostat designs that can be used to control either heating or cooling devices. I've tried to make them as simple, cheap, and thrifty with power as possible. I'm rather fond of them. Potential applications include such diverse jobs as opening flaps or controlling heat in greenhouses, powering automatic fans that only cut in when needed, homebrew cooling and warming, air conditioning, space heating, incubators, and just about anything electrical that needs a thermostat to control it between the temperatures of -20 and 125°C. They make use of small components called thermistors, which provide much more accurate response to temperature change than traditional mechanical thermostats.
Choose this circuit unless you:
- Need especially tight hysteresis (i.e. trigger interval—see explanation below)
- Need to drive a heavier relay or other load that will draw more than 50mA
- Are powering it with small batteries and want to minimise power consumption
The above circuit uses three fewer components than the one below, thanks to the handy and unusual ability of the LM311 integrated circuit to sink up to 50mA directly through its output. This means that no separate transistor is needed for activating many common relay coils, such as the SY4062 from Jaycar that I've used.
The 311 is a purpose-built comparator chip (these circuits work by comparing a set voltage with a changing one produced by the inversely temperature-sensitive thermistor). For this application, however, it's a bit like using a Ferrari to do the work of a wheelbarrow. The 311 is very sensitive and, unless significant feedback is provided, stray electrical noise will tend to make it oscillate (the relay will get jittery). In practice, this means adjusting the VR2 trimpot to achieve a minimum of about 1°C of hysteresis at 25°C (hysteresis is the interval between the points at which the circuit switches on and off, the 'acceptable' range). One degree is perfectly appropriate for most uses; but if you need a really tight hysteresis zone, use the circuit below.
Note that keeping all the left-hand-side resistors physically as close as possible to the IC chip helps reduce stray noise.
This circuit draws about 3.5 to 4mA of current in the resting state, which is peanuts in anyone's language, although the version below draws around 2mA (both measured using 16 volt supply—consumption will be even less at lower voltages).
Choose this circuit if you:
- Need especially tight hysteresis (i.e. trigger interval—see explanation above)
- Need to drive a heavier relay or other load that will draw more than 50mA
- Are powering it with small batteries and need minimal power consumption (see paragraph above)
The above version replaces the LM311 comparator with a 741 operational amplifier integrated circuit acting as a comparator. It is less sensitive to minute disturbances and will allow hysteresis down to 0.5°C or less (at 25°C) without becoming jittery. It can also drive much higher loads thanks to the use of a separate transistor (but see notes 2&3 below).
Instructions for both versions
Cooling or heating? Both circuits are displayed as cooling thermostats. But in both cases swapping the main inputs to pins 2 and 3 on the IC (integrated circuit, triangle symbol) converts these designs into heater control thermostats. If you do swap these two inputs for heater control, don't swap the hysteresis feedback to the IC [always leave it connected to the same pin as shown, i.e. pin 2 in the simple version and pin 3 in the versatile version]).
Optionally, a double-pole-double-throw (DPDT) switch can be employed if you want your thermostat to perform both heating and cooling control. Wire the switch so that it acts as an intermediary, swapping the inputs to IC pins 2 & 3, as described above.
A single circuit cannot control both heating and cooling devices simultaneously. If you need fully automated heating and cooling you'd presumably need to build two of these circuits and calibrate them carefully so that you don't have both functions working against each other.
Accessibility: Decide whether you want to use the thermostat as a readily-adjustable device (like a wall thermostat) or as a single-temperature, set-and-forget device. If the latter, a trimpot can be used at VR3, or a single trimpot (perhaps a 20k item) can be used in place of both VR1 and VR3—although a single high-resistance trimpot will be touchier to adjust.
Calibration: You will need a thermometer whose accuracy you trust. Start by setting VR2 to roughly the middle of its adjustment arc. Then, assuming you are using two trimpots in series as per the diagrams above, you will need to set the minimum temperature of your desired adjustment-range with the VR1 trimpot. Do this by setting VR3 to its maximum resistance, bringing the thermistor to the temperature you want to use as the minimum (in liquid or air of that temperature, as appropriate), then adjusting VR1 so that the circuit trips at that point. Next you can either set-and-forget (if using a trimpot) or temperature-calibrate (if using a potentiometer and panel-mounted dial) VR3. If calibrating a scale with your thermometer, use a pencil or something that you can erase until you really get it right (I wished I had). The scale will not be perfectly linear because of the thermistor's natural response curve, so you'll need to mark off several points verified by the thermometer. In other words, the space between your 19-degree and 20-degree marks might be noticeably greater than that between your 25- and 26-degree marks, for example, with intervals between showing a gradual change. Before firmly committing to either a scale or set-point, adjust the hysteresis trimpot, VR2, to provide an effect that suits your application. This change might throw off your scale or set-point slightly, so be sure to double-check.
My unit, which matches the above diagram, is adjusted for a minimum temperature of about 18° Celsius. The main 5k panel-mounted pot extends the range up to about 28°C, marked in increments of one degree. If you want a wider range, use a 10k pot at VR3. If you wish to use the circuit for much lower or higher temperatures (the thermistor is rated for -20 to 125°C), you can subject the thermistor to the target temperature range extremes, measure its resistances with a multimeter, and plan out your pot values accordingly. The thermistor has lower resistance at higher temperatures. Its rated resistance of 10k occurs at 25°C. At 30°C it is more like 7k and at 17°C it's something like 14k. See note 6 below if you want to work with much colder or hotter temperatures.
Warning: If you intend to use high voltage / household mains electricity in conjunction with these circuits, make sure you comply with local laws. Do not attempt to work with mains power unless you are suitably competent or qualified. I take no responsibility for damage or injury you might cause by electing to build, modify, or add to these circuits.
Shopping: All parts used in these circuits should be readily available around the world. Radio Shack in the US carries an equivalent thermistor, for example, and possibly all the other parts too (or try Digikey—see Postscript 3 below). Here in Australia, Jaycar and Altronics, stock everything. Dick Smith only carry a 100k thermistor, which would suit a modified circuit for higher temps (note 6), but last I heard they were getting out of the components side of their business. Jaycar and Dick Smith are in NZ too. Parts in yellow are used in the second 'versatile version' circuit only.
|Jaycar Cat No.
||PN200 or similar
||IN4148 or IN914
||0.32 / 5pk
||0.38?? / 8
||10k NTC thermistor
||500k or 1meg trimpot
||5k linear potentiometer (or trimpot for set-&-forget)
||$4-6 total !!
Extra components you might want
- A power supply such as a plug pack or battery. 12 volts will provide easy compatibility with common relays, computer fans, bulbs, etc.
- A relay of some kind if you intend to switch high currents and/or voltages (I chose Jaycar's SY4062)
- A piece of punched fibreglass board on which to build the circuit, available in electronics supply shops. Alternatively, and if you have the expertise, you can make a printed circuit board using the files provided in the postscripts below.
- An 8-pin socket to suit the integrated circuit. For a few extra cents, this protects the IC from soldering heat.
- A housing of some kind. Jaycar and Altronics have great project boxes if you're in Oz/NZ, otherwise electrical wholesalers carry big plastic junction-box thingos that can be used.
- A front panel knob for the temperature-set pot.
- Optionally, a double pole-double throw (DPDT) switch will allow the unit to control both heating and cooling apparatus. See above, under Heating or Cooling?.
- The thermistor can be used as a remote probe. It can be encased in silicone, epoxy, or something similar for applications where it will be immersed in liquid.
- In theory, this circuit should work with anything between 5 and 36 volts DC. If you deviate too far from the middle ground of this voltage range, however, you might need to tweak some of the right-hand-side resistor values. I'm not sure. My circuits run at 16v, employing a 150 ohm / 0.5w resistor in series with the relay coil to drop the voltage to around the 12v it requires.
- Likewise, if using higher currents through the transistor to power, say, a heavy-duty relay, solenoid, fan, or lamp, you might need to reduce the value of R4 down to 5k, 1k, or lower to ensure that the transistor remains saturated. The 10k item as depicted is known to work with a relay coil drawing 50mA, so any coil requiring less would be covered too, provided your circuit voltage is not too much lower than mine. In fact, the above also worked with R4 at 20k, so there's some leeway built in. If your circuit doesn't work for you, either consult some appropriate literature on configuring transistors, or maybe try a 500ohm resistor at R4, and work your way up. When the transistor is adequately saturated, the voltage at its collector (the 'C' pin) should be near Vcc (the circuit's full positive voltage).
- The maximum current available to power the relay, solenoid, etc, is dictated by the "Ic" rating of the PNP transistor chosen. Consult the data sheets for your intended load device and transistor. The PN200 used here will handle up to 500mA.
- The diode protects the IC from damaging voltage spikes caused by the collapse of the relay coil's field when it shuts off. Omit this component only if you're powering something without a coil. If powering a fan in equipment sensitive to radio noise, place an electrolytic capacitor across the fan junction (say, 1000 microfarad).
- If you intend to control much higher or lower temperatures, you might want to consider using a thermistor better matched to your target temperatures. The NTC (negative thermal coefficient) thermistor will have a much higher resistance in sub-zero temperatures and much lower in, say, boiling water. A 4.7k or 1k thermistor would probably be more appropriate for cold conditions; a 47k item, at least, would better suit the hotter end of things (remembering that these thermistors are physically rated for -20 to 125°C, so cryogenics and furnace work is out!). The point is to balance the comparator's voltage seesaw (so that the resistance feeding the "-" pin on the IC is similar to that feeding the "+" pin). You might notice that these circuits, operating around the 25°C point, use two resistors at the top-left that coincide with the thermistor's resistance around that temperature (10k @ 25°C). Similarly, the temperature-control pots attempt to anticipate and match the thermistor's resistance swing through the operational temperature range. So if you know you will be working with more extreme temperatures, buy a thermistor at least one step removed in the series and you might be pleasantly surprised to find that the above circuits need minimal or no modification. See the thermistor data sheet for options.
[Update] Ilija has kindly tipped me off to this formula for calculating NTC resistance at a targeted temperature (where T is in degrees Kelvin). He provides the following example for 35°C: R(35) = 10000*e^4100(1/273.15+25 – 1/273.15+35) = 6350 ohm.
- Optionally, you might like to calculate and modify your circuit's expected hysteresis, and learn more about the Schmitt Trigger concept that these circuits employ at this site. There you will find a useful online calculator for key circuit values. Or you can refer to the following Schmitt Trigger formulae (again, thanks to Ilija).
- Powering the circuits with a battery: To calculate how long a battery would last, you need to know how many 'milliamp-hours' it is rated at. This information should be provided by the manufacturer, or you could look up ratings for a similar battery online. It is a number expressed as mAhr, mAh, ma/hr, or something similar. A large battery like a lead-acid car battery will be rated in amp-hours. One amp-hour is a thousand milliamp-hours. Say you're building the 'versatile version' circuit above, which draws 2mA, then a 2000 mA/h battery would last 1000 hours, or about 41 days. The 'simple version' circuit would draw up to twice as much, so the same battery would last maybe half as long. These currents were measured with my 16 volt supply. Using a lower voltage will also reduce the current draw significantly, so choose a 9v or 12v battery and you will do yourself a favour. An ordinary 9v alkaline battery of the type found in smoke alarms will be rated at something like 500 mA/h. A rechargeable NiMH equivalent will only be 200 mA/h or less. So neither will last for very many days, but the latter can be recharged at least. A stack of six AA NiMH rechargeable camera batteries in series, each typically rated at 2000 or 2500 mA/h, might be a useful solution, although NiMH cells are only 1.2 volts each, totaling 7.2v so see note (2) above. You can buy small 12v lead-acid batteries from electronics or hobby suppliers for reasonable prices. These come in all sizes. Here's one from Jaycar, that gives you 6000 mA/h for 28 bucks Australian. In theory it'd last something like four months on the 'versatile version' circuit between charges (although lead-acid batteries, like the one in your car, gradually go flat over time even when they're doing nothing, so you'd probably need to charge it a bit more frequently). A very small solar panel hooked up to the battery would be perfect. If you have mains power available, a 12v DC plugpack won't cost much and will provide an easy solution. There's no reason to use a power supply with a higher voltage unless you have an old plugpack or transformer lying around already (which is why I used 16v for mine).
- By the way, your power supply's negative is connected to the ground or earth symbol (lower) side of the circuit...
Please don't be fooled by the above into thinking that I know heaps about electronics. This has been a collaborative effort with the people listed below. If you have really serious technical questions, there's probably no point contacting me; but I'd be very pleased to hear any stories of success and obscure / creative uses.
Ilija has very kindly provided a few files detailing his reportedly successful prototype adaptation of the LM741 circuit above. He has incorporated a simple mains / 10 volt power supply into the circuit which drives a TIC226 triac load. Many thanks Ilija!
Note that the power supply portion of Ilija's circuit contains an error. The BZV10 is actually rated at 6.2V, not 10V. Ilija's intention was to use any 10V zener diode. Alternatively, he suggests a 7810 voltage regulator instead of the zener, which will provide for more stable voltage.
Note also that I have not tested these variations myself and cannot vouch for their effectiveness. I presume that the PCB design would have to be slightly modified for a 7810, for example, and I see that the layout in the top picture does not quite match the photograph.
Eagle format printed circuit board (5kb)
Eagle format schematic (29kb)
Browser image schematic (40kb)
Postscript 2 [October 2009]
A huge thank-you to Andrew, who has shared his PCB design files and notes for a caravan refrigerator controller. He found that the fridge's existing temperature regulation wasn't up to scratch, and my circuit brought things under control nicely. He has included an onboard filtered power supply for 12 volts and a LED indicator. Andrew has had his board produced by a commercial manufacturer, and it definitely works. Click these images for enlargements or see the Eagle files below:
Eagle format printed circuit board (24kb)
Eagle format schematic (277kb)
Explanatory notes in PDF format (33kb)
Explanatory notes in Word format (54kb)
Postscript 3 [October 2010]
Paul writes: 'I found the same or VERY similar Thermistors in the US at Digikey. See the MF11 thermistor series by Cantherm on digikey.com. # 317-1298 is a 2K thermistor that they stock for $.32 USD. Also. I want to switch a 5 amp load and so an OMRON relay G2R-1-E or DIGIKEY # Z848-ND is a real small and fairly cheap relay with high 16 amps contacts; $4.30 USD. The coil is 275 ohm and that calc's to 44 ma at 12 VDC. I used these relays in a satillite dish's jack positioner at high current at 12VDC for over 10 years without any failures. They ran a 12VDC motor. HTH you or someone else.'
Postscript 4 [May 2014]
Tyler's home-brew cooling set-up: 'The concept is rather simple. I built a cool-box out of Styrofoam insulation and plywood and attached it with pvc to a cooler. I put the fermenting beer in the cool box and a frozen jug of water in the cooler and move the air from the cooler into the cool-box with a computer fan. The fan is the load on the temp controller circuit and I simply attach the thermistor to the side of the fermentation vessel and insulate it a bit from the air in the cool-box. I tweaked the circuit a bit as well with an on/off switch and an indicator LED to tell me when the fan is running so I don't have to open the cooler. Thanks again for the design! -Tyler'.