In this article, I’ll show you how to set up a cheap and robust electronic thermostat with a handful of inexpensive and readily available electronics components. These can be used to switch/control external devices like electric heaters, soldering irons, etc. In principle, thermostat is a mere regulator for automatically regulating temperature by starting or stopping the supply of heat. With an ‘electronic’ thermostat, you can more effectively control the temperature of an electric heater as desired.
Did you ever need to automatically control a device to prevent it from overheating, but don’t want to spend too much for it? Good! Let us build the thermostat to see how it works, so later you can use it in other projects as well. The following diagram is for you!
As you can see in this ‘analog’ schematic, the temperature sensor is neither a standard thermistor nor a dedicated sensor chip – it’s nothing but a common metal case bipolar junction transistor BC107 (T1). Although I used this NPN transistor, do not worry if you can’t find one in your junk box. You can easily substitute it with a BD139 transistor which is available everywhere. You will learn that any silicon diode, and broadly any silicon junction has an almost-linear temperature coefficient of about -2mV/°C when a forward voltage (VF) is supplied across the junction. So, all you must do, is use a BJT to monitor temperature as indicated in the above schematic. Note that a bipolar junction transistor works more slowly than a silicon diode because of its metal case/heatsink.
Personally, I used a couple of BC107B transistors to test the idea because I found that sufficient for my purpose, and they’re to hand. However, the BD139 transistor comes with a mounting hole on its TO-126 package which makes it much easier to attach than a BC107 transistor.
Next part of the schematic also has normal components. The LM393 (IC1) is a pretty cheap dual-comparator chip. At the LM393 comparator output one BD140 transistor (T2) is wired as a solid-state switch to control a small dc heating coil (or to drive an electromagnetic relay for safe switching of mighty ac/dc heaters). The temperature sensor T1 is wired to the inverting input (Pin 2) of IC1 while a fixed reference voltage, close to 1.4V, is applied to its non-inverting input (Pin 3).
The “temperature set” multiturn trimpot (RP1) defines the voltage at the inverting input of the comparator. If the trimpot’s wiper is the midway of its travel, then the comparator’s inverting input can see a voltage fairly close to 1V. So, you should adjust the trimpot first to raise this voltage level to 1.5V or so. And then set your hot soldering iron in the close vicinity of T1, keep it there for a while, and patiently test your prototype.
Note that after the bright green indicator (LED1) wired to the output (Pin 1) of the comparator remains lit in normal condition. At the same time, T2 conducts and extends the 5VDC to the connected load (heater/relay) through its emitter-collector leads. If the temperature level exceeds the set point, IC1 cuts out T2 and hence the heater/relay coil.
Being a medium-power low-voltage transistor with an absolute maximum collector current (IC max) rating of -1.5A, the BD140 transistor (in theory) can be used to drive loads that consume less than 1.5A. My test load was a cheap USB blower fan, and the test was performed without mounting the BD140 transistor on a TO-126 aluminum heat sink.
If stable 5VDC is available then supply is easy, but in practice it has been necessary to use a well-regulated 5VDC power supply. Remember, the maximum current consumption depends on what load is connected at the output (and the way the comparator drives the transistor, for sure).
Construction of the electronic thermostat is quite non-critical, and a small perforated prototyping circuit board (not a breadboard) is sufficient for the purpose. The temperature sensor transistor (BC107/BD139), however, should be soldered on flying leads and suitably insulate the joints with heat-shrink tubes. An important point is that the transistor must be able to sense the temperature changes well when it is mounted in place.
And, a side note about something we usually gloss over!
The LM393 IC consists of two precision voltage comparators, and the output of each comparator is the open collector of a grounded-emitter NPN output transistor which can typically draw up to 16mA. A basic comparator circuit is used for converting analog signals to a digital output. The output is HIGH when the voltage on the non-inverting (+IN) input is greater than the inverting (-IN) input. The output is LOW when the voltage on the non-inverting (+IN) input is less than the inverting (-IN) input.
The thermostat circuit presented here is designed to run the connected load if the temperature level measured by the temperature sensor is well below a set value. However, if the temperature level raises above the set point, the load is disconnected right away.
Since the output of the comparator IC1 is wired to the base of transistor T2 through a resistor, the base of the transistor is held low in normal state. Under this condition T2 could be described as “on,” since it does conduct current. This is because a small amount of current flows through the T2 through the base resistor R7, and through the internal NPN transistor of IC1 to ground. That small current switches a larger current (~400mA) that can flow through the load. The two currents (small through the two transistors and larger through the load) are illustrated below.
The base resistor R7 limits the overall current through T2 and the transistor inside IC1 to a relatively safe value. You can lower the R7 value to a certain extent to get higher load currents, but it’s better to not bump up against the limits of the components.
This base resistor is very crucial, but I couldn’t see it in most web circuits revolving around LM393 ICs!
Next, let’s go over to the “hysteresis” in brief. Comparators are used to differentiate between two different signal levels. In this project, the comparator differentiates between an over temperature and a normal temperature condition. Naturally, noise at the comparison threshold will cause multiple transitions. Hysteresis sets an upper and lower threshold to eliminate the multiple transitions caused by noise.
In this scheme, resistor R4 sets the hysteresis level. Note that hysteresis creates two thresholds. That means, when the output is at a logic high, R4 is in parallel with R2. This drives more current into R3, raising the threshold voltage. On the other hand, when the output is at logic low, R4 is in parallel with R3. This reduces the current into R3, reducing the threshold voltage. At this point, it is worth noting the open-collector output stage calls for a pull-up resistor (R5). Since the pull-up resistor will create a voltage divider at the comparator output that introduces an error, a comparatively high value hysteresis resistor is needed to minimize the error.
Although not as precise as its digital relatives, this analog electronic thermostat is a useful little circuit for low-end applications and can be built from surplus components laying around your workbench. Effectively, this is a crude thermostat, and yes, you should build it right now!
BC107 Datasheet https://www.st.com/resource/en/datasheet/cd00003228.pdf
BD139-BD140 Datasheet https://www.st.com/resource/en/datasheet/cd00001225.pdf
LM393 Datasheet https://www.ti.com/lit/ds/symlink/lm393-n.pdf
Texas Instruments Incorporated
ROHM Co., Ltd.