Frost sensor (thermistor) controlling a relay

Thread Starter

mjscott

Joined May 21, 2014
24
I'm looking for a circuit which can turn on a relay when the temperature goes below +1C. I've found a few on the Internet, and have inserted a simple one below. The issue I've read about is if the temperature hovers around the exact threshold/trigger temperature, causing the relay to cycle on/off repeatedly (flapping). I've come across the word 'hysteresis' but that concept is beyond my electronics experience. I'm thinking that if a circuit had 2 thermistors (T1 and T2) such that the relay would be enabled as soon as T1 went below +1C, and the relay would remain on until T2 went above+2C. At this point, the relay would go off and the circuit would wait for T1 to go below +1C again, and the whole cycle would repeat.
Thoughts or advice is welcome. Thank you.

p.s. I've already bought a device called a Thermocube. It is fairly crude with it's triggers (on at colder than +2C, and off at warmer than +10C), and is not adjustable. The unit is sealed, but I suspect it uses some sort of bi-metal mechanical relay/switch. While it does prevent my outdoor items from freezing, my average winter temperature here is around +5C, which means the device is on most of the time when it doesn't need to be.


temperature-sensor-relay-switch-circuit.gif
 

Reloadron

Joined Jan 15, 2015
7,501
You can roll your own using any number of discrete components like the old 555 Timer IC or you can invest a few bucks with Amazon (or similar) and just buy a unit like any of these for well below $20 USD. Rolling your own will involve mounting and soldering a handful of basic components. To avoid chatter of a relay when the temperature is hovering around a set point controllers use what we call "hysteresis". A good example is a typical home thermostat found on a home wall. I set mine for example at 70 degrees F. When the temperature drops below 70 the unit calls for heat and the furnace turns on at 69 and off at about 72. So we have some hysteresis. The link is merely an example of a simple and inexpensive temperature controller or also called a process controller setup for temperature control. If I were building something like you describe my choice of sensor would likely just be a common thermistor as a sensor and using a simple "comparator" rather than a 555. Likely a common LM339. A Google of LM339 temperature controller should give you some basic circuits which include hysteresis.

Unless you want this as a learning project it's likely a simpler solution to just buy an off the shelf solution.

Ron
 

Thread Starter

mjscott

Joined May 21, 2014
24
Thanks Reloadron, great information!
My hope was to build a circuit without using an IC or PCB, since I have no experience with either. The circuit I originally posted is within my ability, and I was hoping that it could be made more robust to avoid the relay chatter situation. Your example of a typical wall thermostat is a exactly what I have been searching for, but with a lower operating temperature range. Thermostats I've found in the "Low temp" category seems to have a lower range of +35F, which isn't low enough for my application. I did follow your Amazon link too, and there are some possibilities there, but all seem very elaborate for what my need is.
You are also right, I am trying to use this project as a learning project, and I appreciate your electronics expertise. Thanks
 

MrChips

Joined Oct 2, 2009
30,720
For temperature sensing you can use a thermistor or LM34/LM35 sensor.

What you have described with two temperature thresholds is a window comparator circuit. But that is not the only solution.

Hysteresis is the operative word here which does not originate solely from electronics.

The origin of the word comes from the Greek word "ὑστέρησις" to mean delay. In scientific and electronics usage it describes the behaviour of an object or system to fail to return to its original state when the stimulus is no longer applied.

One common occurrence of hysteresis is in your house heating/cooling system. Without hysteresis the furnace or AC would be cycling on/off too often which could shorten the life of the HVAC system.

Hysteresis is easily implemented in a single voltage comparator by applying a small amount of positive feedback from the output to the non-inverting input. When the set threshold voltage is attained, positive feedback pushes the input signal further away from the threshold so that chatter is reduced or eliminated.

In general, most comparator circuit applications require some degree of hysteresis otherwise the output will exhibit chatter.
 

Alec_t

Joined Sep 17, 2013
14,280
If you are aiming for a resolution (or hysteresis) of only 1°C, then an accurate voltage reference will be needed for any comparator-based circuit.
What is your power source? A little 9V battery won't have a long life if the relay coil draws significant current.
 

crutschow

Joined Mar 14, 2008
34,285
As Alec_t said, you will need a voltage reference and an IC comparator to achieve 1°C accuracy and stability.
If you don't want to deal with IC's as you stated, then I suggest buying a built unit such as Reloadron suggested.
The one he posted has a temperature readout, which is handy.
 

AnalogKid

Joined Aug 1, 2013
10,987
My hope was to build a circuit without using an IC or PCB,
My kinda guy. OK, I'm in.

Hysteresis is created with positive feedback. It is not difficult; it's just a little more Ohm's Law arithmetic. You can add it to your original schematic by changing one transistor to a PNP type and adding two resistors. An alternative is to stay with all NPN transistors and adding a third one.

AND BTW - the circuit in post #1 will not work for you. It is backwards. As the temperature decreases from above +1 C (or whatever the trip point is) to below, the thermistor resistance increases, the voltage at the transistor base decreases, and the transistors and relay turn off, not on. This can be fixed by changing to a SPDT relay and using the normally-open (NO) contacts, but where's the fun in that? You can fix this by swapping the positions of the thermistor and pot (please consider adding reference designators to your schematic), but you still have the relay chatter problem. The circuit change nentioned above also inverts the circuit "logic" and prevents relay contact chatter all in one.

The classic circuit for this is called a Schmitt Trigger. Here is a speech about the non-inverting version, which is what you want. Note: All of the examples in this article are more complex than what you need.

https://en.wikipedia.org/wiki/Schmitt_trigger#Non-inverting_Schmitt_trigger

If you are up for this, I can whip out a schematic later today. To start off, we need two pieces of information: Relay coil resistance / current / power, and thermistor part number / datasheet.

Also, 1 degree is not much separation between the two operating points. The datasheet for the thermistor shoule have a table of resistance values for various temperatures, or an equation for calculating them (or both). If the difference in resistance between your two trip points is very small, uou might have to adjust your requirements.

ak
 
Last edited:

Thread Starter

mjscott

Joined May 21, 2014
24
OK, this will be an iterative, learning process, thanks ak!! This is a blank sheet circuit, which I'm going to build around the active component - the thermistor(s). I spoke with the electronics supplier in town, and they stock a common 10K 1/4W NTC bead style (NTCLE100E3103JB0). I'm going to pick up 2 of them tomorrow, and start recording their ohms at different temps, particularly around +1C. Fortunately I have a digital outdoor thermometer with a precision of 0.1C so that is good! Within a few days I should have enough data to know if a 1C separation is too tight. I have not bought the necessary relay yet since the evolving circuit will determine the best specs. The only known at this point is that I will be switching a 110vac 1A circuit, which most common relays should handle. Power supply is also not decided - I have MANY wall wart power adapters collected over a few decades and have many choices, from 3vdc to 12vdc and others. Is there a 'preferred' voltage for small hobby circuits like this? On that note, even though I am reluctant to introduce an IC into my circuit, is there a thoughtful voltage to pick for my power supply so that I'm ready to power an IC should that need occur?

Thanks also for identifying the flaw in the sample circuit I originally posted. As you can see from the watermark, I "borrowed" this from another hobbyist site, which does not offer the ability to comment on posts (or even contact anybody at all). I hope not too many amateurs built that circuit and banged their heads against the wall. It is challenging on this side of the learning curve - I'm trying to wrap my head around the Schmitt Trigger!

Thanks again ak (and the rest of this community). I'm optimistic that the last post on this thread is an image of the final, elegant circuit! -mike
 

Thread Starter

mjscott

Joined May 21, 2014
24
As a follow-up to my own question about a 'preferred' voltage for a small circuit, my research shows many small similar circuits use either 5vdc or 9vdc. Frustratingly (for me), none explain why they made the choice they did. :)
 

Alec_t

Joined Sep 17, 2013
14,280
5V DC is one of the standard voltages for logic circuits and is also the standard USB voltage. 9V is the nominal voltage of a usefully compact PP3 battery.
 

crutschow

Joined Mar 14, 2008
34,285
As a follow-up to my own question about a 'preferred' voltage for a small circuit, my research shows many small similar circuits use either 5vdc or 9vdc. Frustratingly (for me), none explain why they made the choice they did. :)
They use 5V because that was the voltage used for the old TTL logic, and it just spilled over into other electronics, such as the USB port, since it's high enough to provide power for a lot of common circuits, and low enough to keep power dissipation low.

9v is used because that's the voltage of the common 9V rectangular battery which was used in the first transistor pocket radios.
 

neonstrobe

Joined May 15, 2009
190
I'm not sure whether the Schmitt trigger ref. shows a standard Schmitt or not, but I've used a circuit like the one attached for oscillations, modified here to provide hysteresis. it is difficult to adjust the classic Schmitt to give a certain hysteresis.
It is basically a differential amplifier with positive feedback.
Resistors R5 and R6 set the base of Tr2 to mid-rail. The input voltage from the potentiometer and thermistor is compared with it, so the pot needs to be adjusted to match the thermistor resistance at the temperature you want the unit to switch on, but won't be quite mid point because the hysteresis offsets the "on" and "off" resistances.
Resistor R7 provides the hysteresis. If this is the same value as R5 and R6 then when the output is high, it is in parallel with R5 and makes that an effective 5k, so the "on" voltage is about 2/3 the supply. If the output is low it parallels R6 instead and sets the "off" voltage to about 1/3 supply. Increasing the resistance to 47k reduces the spread - or hysteresis, which you should be able to calculate. You can therefore adjust the hysteresis by changing R7.
The relay is buffered by tr4 so that it does not load the controller circuit. You may find that a high load current affects the performance and if so, you may want to decouple the supply line to the controller, with a low value resistor and highish capacitor, perhaps 100 ohms and 100uF, so that Tr4 "glitches" on the supply don't false trigger the control.
The circuit is fairly immune to power supply changes by using the mid-rail reference so could run on 5 to9V.
I have not tested this circuit in reality but it simulates OK. You may have to use a higher current transistor for the relay driver depending on the current needed to operate or add a PNP medium power device like a BD140 (base to the collector of tr4, emitter to the +rail and collector to the realy+emitter of Tr4, and perhaps add a base leakage resistor of 1k between the base and emitter of the BD140 (not really necessary but may help with stability).

Diode across relay to suppress back-emf.hysteresis.png
 
Another way to provide hysteresis is to use a double pole relay & use the second pair of contacts to connect the positive or negative supply rail (depends if you're using a ptc or ntc thermistor) to the junction of the thermistor and variable resistor via a suitable resistor, or via a fixed resistor with a variable resistor in series to adjust the hysteresis. It's a bit basic but it does work. Also the variable resistor in your circuit should have a fixed resistor in series with it or at the limit of adjustment of the variable resistor the thermistor will be connected across the supply rail
 

Thread Starter

mjscott

Joined May 21, 2014
24
The journey continues. As a recap, my goal is a simple (few parts) circuit with no ICs. Continued research tells me I could be able to do this without dual thermistors. Below is my draft concept circuit. The things I know are:
- power supply is 5vdc
- 5vdc relay coil is rated at 167 ohms
- thermistor measures 29381 ohms at +2C, and 30919 ohms at +1C. My ideal trigger is anywhere in the middle of these points. The full operating range of the thermistor in my climate would be 18073 ohms (+15C) to 68527 ohms (-15C).
D1 is the flywheel diode (to protect Q1 when the relay coil is de-energized).

What I don't know how to do is calculate R1 so that Q1 closes when NTC rises above 31K ohms (and Q1 must close enough to energize my relay coil). Also, I don't know how to select the right R2 for hysteresis.

I'm now a user of CircuitLab, so that is helping me with experimentation!
Thanks again.

p.s. For the sharp-eyed pros out there, I had to use the diagram of a Photoresistor for NTC. CircuitLab does not have an image for a Thermistor, and the Photoresistor seemed close enough.


Screenshot 2021-01-10 134920.png
 

Attachments

crutschow

Joined Mar 14, 2008
34,285
I don't know how to select the right R2 for hysteresis.
R2 does not provide hysteresis, which cannot be generated from a single transistor circuit.
For that you need positive feedback, which can be provided from a second inverting transistor.

Also, since the voltage trigger reference for that circuit is the transistor base-emitter voltage, the trigger voltage will be sensitive to the ambient temperature (Vbe varies about 2mV/°C or about 0.3%/°C).

If you insist on using a very simple circuit for your task you will have to live with it likely being less stable/accurate than your requirements.
 

Thread Starter

mjscott

Joined May 21, 2014
24
You've made a great point, crutschow - thank you. My top goal is a stable and predictable circuit - otherwise, why go to the trouble. :) Secondary to that is my desire for a circuit as simple as necessary while still achieving the top goal. My reluctance to include ICs is only due to my complete lack of experience with them (and PCBs). It is hard for me when somebody helps by providing a circuit, but does not explain the choice of components in the circuit - probably because most users on this forum are experienced enough to follow it along and get what it does. As I mentioned before, I'm on the difficult side of the learning curve. I am doing a lot of reading outside of this thread to try and "get it" more quickly. I have read different articles about hysteresis, which is why I thought my single transistor circuit would work. My understanding was that as the transistor starts to close, redirecting some of the current from E back to B would further close the transistor and get me past the trigger point. I believe you when you say it won't work, I just don't know why.
 
Top