Author Topic: the simplest thermostat with programmable thresholds?  (Read 5983 times)

0 Members and 1 Guest are viewing this topic.

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
the simplest thermostat with programmable thresholds?
« on: February 19, 2018, 06:56:50 pm »
Hello everybody,

I'm trying to design a simple thermostat to control temperature of my power supply. The fan should start at, say 60C and stop at 40C. Ideally I'd like to have two trim pots to independently adjust upper and lower thresholds. I don't know how to better do this. May be someone has an idea? The focus is on ease of use and minimal BOM.

Parameters: 12V supply, output current up to 200mA. I tried many approaches and currently running out of ideas :(. What I believe I need is a Schmitt trigger with programmable hysteresis (resistor divider with thermistor is an input).

My best circuit (so far) is attached. It consists of two independent comparators (with resistor dividers to set thresholds), and a small latching (set/reset) switch (D2 is to lift base of Q2 a little bit as opamp cannot pull output low enough for switch to reset due to drop on D2, R1 and R2 add a bit oh hysteresis so opamp do not swing wildly when input near the threshold). Does anyone have a better idea how to do this?
 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: the simplest thermostat with programmable thresholds?
« Reply #1 on: February 19, 2018, 08:18:37 pm »
It depends on the sensors used and the range you need to control, but an option could be using a normal hysteresis comparator with two feedback paths, each one with a series of a diode, a resistor and a potentiometer.
In each path, the diode will be in a different direction.
The basic idea of the hyst comparator you are using is that the (-) input sets the trigger point of the comparator. The positive feedback path just makes this trigger point dependent on the output of the comparator itself. Hence the hysteresis.
 
The following users thanked this post: exe

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: the simplest thermostat with programmable thresholds?
« Reply #2 on: February 19, 2018, 08:40:09 pm »
Also , to add to my previous post, you can also use two potentiometers and select the one you use for the (-) input of the comparator based on the output of the comparator itself.
Just add analog switches to the circuit, for instance.
Note that this solution doesn't guaratee that Thigh > Tlow
 
The following users thanked this post: exe

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: the simplest thermostat with programmable thresholds?
« Reply #3 on: February 19, 2018, 09:29:30 pm »
Thanks, Vic20!

I tried that too, but without much luck. With diodes and potentiometers the behavior was highly non-linear. So I had troubles to have reasonably wide range and ability to precisely trim thresholds. May be I do it wrong.

With analog switches it's more interesting. I tried to use mosfet + jfet pair to do this. Seems to be working in sim, haven't tried yet on a breadboard. My biggest concern so far is both switches can become open simulteneusly with unpredictable consequences. May be you have a better circuit? May be there is a better switch than what I'm using? I'm not familiar with analog switches.


It depends on the sensors used and the range you need to control, but an option could be using a normal hysteresis comparator with two feedback paths, each one with a series of a diode, a resistor and a potentiometer.
In each path, the diode will be in a different direction.
The basic idea of the hyst comparator you are using is that the (-) input sets the trigger point of the comparator. The positive feedback path just makes this trigger point dependent on the output of the comparator itself. Hence the hysteresis.
 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: the simplest thermostat with programmable thresholds?
« Reply #4 on: February 19, 2018, 10:13:03 pm »
With analog switches it's more interesting. I tried to use mosfet + jfet pair to do this. Seems to be working in sim, haven't tried yet on a breadboard. My biggest concern so far is both switches can become open simulteneusly with unpredictable consequences. May be you have a better circuit? May be there is a better switch than what I'm using? I'm not familiar with analog switches.

Well, you can also use a J-K biestable and drive each input with a different comparator.

In fact this is quite similar to what the venerable 555 uses to generate square waves.
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1133
  • Country: us
Re: the simplest thermostat with programmable thresholds?
« Reply #5 on: February 19, 2018, 10:51:04 pm »
Quote
With analog switches it's more interesting. I tried to use mosfet + jfet pair to do this. Seems to be working in sim, haven't tried yet on a breadboard. My biggest concern so far is both switches can become open simulteneusly with unpredictable consequences. May be you have a better circuit? May be there is a better switch than what I'm using? I'm not familiar with analog switches.

Something like this using Nch mosfets.  Cross-coupled NOR gates insure that transistors are not on at the same time, while capacitor holds the charge while both transistors are off.  The non-overlap time is going to be the prop delay of the gate which may be too fast.  There are ways to extend that with additional circuitry.  At any rate, this may stimulate some thought.


 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • 0999
Re: the simplest thermostat with programmable thresholds?
« Reply #6 on: February 19, 2018, 11:16:24 pm »
A microcontroller?

There's an IC designed to do this, but I can't remember the part number! It contains two comparators and a flip-flop, on the same IC.
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1133
  • Country: us
Re: the simplest thermostat with programmable thresholds?
« Reply #7 on: February 19, 2018, 11:21:33 pm »

There's an IC designed to do this, but I can't remember the part number! It contains two comparators and a flip-flop, on the same IC.

Good idea...maybe this: TS12A12511
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • 0999
Re: the simplest thermostat with programmable thresholds?
« Reply #8 on: February 19, 2018, 11:24:42 pm »

There's an IC designed to do this, but I can't remember the part number! It contains two comparators and a flip-flop, on the same IC.

Good idea...maybe this: TS12A12511
I found the part. It's the MIC841, which has a built-in, fixed 1.24V reference.
http://ww1.microchip.com/downloads/en/DeviceDoc/20005758A.pdf
« Last Edit: February 20, 2018, 08:35:43 am by Hero999 »
 
The following users thanked this post: exe

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: the simplest thermostat with programmable thresholds?
« Reply #9 on: February 20, 2018, 08:48:39 am »
Thank you guys for help, now I think I understand what are my options.

I also found MIC833 (looks very similar to MIC841). Both ICs are  5V only, unfortunately and not easily available.

Now I'm thinking how much external circuitry is needed to make such a project from NE555. I already tried a few designs, but didn't succeed.

An ideal solution would contain just a few parts and had a high-impedance input :). I'm starting to suspect that a cheap MCU with three ADCs could be the most trivial solution (but needs FW). Although, most MCUs are 3.3V, so additional LDO is needed. I don't think I'll go this way as I wanted to thermostat to be as reliable as possible and do not contain any digital circuit. I could do thermal management in software (there is a beefy MCU on the same board), but for reliability I wanted it to be independent.



If found the part. It's the MIC841, which has a built-in, fixed 1.24V reference.
http://ww1.microchip.com/downloads/en/DeviceDoc/20005758A.pdf
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: the simplest thermostat with programmable thresholds?
« Reply #10 on: February 20, 2018, 12:12:32 pm »
A PSOC 4 has reference, A/D, mux, die temperature, OpAmps, and
lots of other stuff.

The wall of text -

For me what stands out is (PSOC in general) -

1) Routability
2) Fast 12 bit SAR A/D and slow 20 bit DelSig
3) DFB (Digital Filter Block) that is dual channel, handle FIR or IIR filters, or DFB
can be used as a GP fast processor block, similar to RISC block
4) MSI logic elements GUI based and/or the UDB Verilog capability. Eg. the FPGA
like capability
5) Onboard Vref
6) IDAC, VDAC, OpAmps (up to 4), comparator, mixer, switch cap, analog mux....
7) LCD,  COM, UART, I2C, I2S, One Wire, SPI, Parallel, LIN, CAN, BLE, USB
9) Custom components capability, create with schematic capture or Verilog
10) DMA to offload processes like filters, COM, Display
11) ARM M0 (PSOC 4) or M3 (PSOC  5LP) or 8051 core(PSOC 3) or M0+/M4 dual core PSOC 6
12) Extensive clock generation capabilities
13) All components supported by extensive prewritten APIs

https://www.element14.com/community/thread/23736/l/100-projects-in-100-days?displayFullThread=true

http://www.cypress.com/documentation/code-examples/psoc-345-code-examples

Great video library

Attached component list.  A component is an on chip HW resource. Note part dependent.

Free GUI design tool with schematic capture, "Creator". Components have rich API library attached
to each component. Compilers free as well.

PSOC 4 is low end of family, consider 5LP parts as well. PSOC 4 also has arduino footprint boards (pioneer) as well. PSOC 6 dual core M0+/M4.

https://www.elektormagazine.com/labs/robot-build-with-cypress-psoc

http://www.cypress.com/products/32-bit-arm-cortex-m-psoc



https://brightcove.hs.llnwd.net/e1/uds/pd/1362235890001/1362235890001_5241352463001_2606504288001.mp4?pubId=1362235890001&videoId=2606504288001


$ 5 dev board CY8CKIT-049




Regards, Dana.
« Last Edit: February 20, 2018, 12:14:08 pm by danadak »
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 
The following users thanked this post: exe

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • 0999
Re: the simplest thermostat with programmable thresholds?
« Reply #11 on: February 20, 2018, 12:30:10 pm »
I think a PSOC is a little overkill.

Thank you guys for help, now I think I understand what are my options.

I also found MIC833 (looks very similar to MIC841). Both ICs are  5V only, unfortunately and not easily available.

Now I'm thinking how much external circuitry is needed to make such a project from NE555. I already tried a few designs, but didn't succeed.

An ideal solution would contain just a few parts and had a high-impedance input :). I'm starting to suspect that a cheap MCU with three ADCs could be the most trivial solution (but needs FW). Although, most MCUs are 3.3V, so additional LDO is needed. I don't think I'll go this way as I wanted to thermostat to be as reliable as possible and do not contain any digital circuit. I could do thermal management in software (there is a beefy MCU on the same board), but for reliability I wanted it to be independent.



If found the part. It's the MIC841, which has a built-in, fixed 1.24V reference.
http://ww1.microchip.com/downloads/en/DeviceDoc/20005758A.pdf
On second thoughts, the solution is simple. Use a quad comparator IC, such as the LM339, with two of the comparators for the high and low threshold detectors and one as a flip-flop.

See the link below for how to use a comparator as an RS flip-flop. Note that it's negative edge triggered, whilst the flop-flop inside the MIC841/833 is positive edge triggered, so the +/-inputs to the threshold detectors need to be reversed.
http://www.circuitous.ca/Comparators.html

Attached is an example of how it's done. Of course the output can be inverted, if needs be.
« Last Edit: February 20, 2018, 12:32:12 pm by Hero999 »
 
The following users thanked this post: exe, Wimberleytech

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11631
  • Country: my
  • reassessing directives...
Re: the simplest thermostat with programmable thresholds?
« Reply #12 on: February 20, 2018, 03:34:12 pm »
i tried on my type of thermistor (lower resistance when hotter, about 10Kohm at room temperature) using LM393... fwiw...
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 
The following users thanked this post: exe

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: the simplest thermostat with programmable thresholds?
« Reply #13 on: February 20, 2018, 03:48:17 pm »
I think, I'll use LM339 circuit, thanks!

Other suggestions also neat :)
 

Offline Teledog

  • Regular Contributor
  • *
  • Posts: 202
  • Country: ca
Re: the simplest thermostat with programmable thresholds?
« Reply #14 on: February 20, 2018, 03:51:24 pm »
« Last Edit: February 20, 2018, 03:56:24 pm by Teledog »
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1133
  • Country: us
Re: the simplest thermostat with programmable thresholds?
« Reply #15 on: February 20, 2018, 04:52:50 pm »
Perhaps one of these for 2 or 3 bucks?..they can be set to heat or cool;

Also, there's .stl printer files for the W1209 on Thingiverse

I ordered a couple of these on ebay last month.  Have not arrived and not sure what I will do with it.

Thanks for the Thingiverse tip...I will be printing out a box for mine!!
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • 0999
Re: the simplest thermostat with programmable thresholds?
« Reply #16 on: February 20, 2018, 07:08:55 pm »
I think, I'll use LM339 circuit, thanks!

Other suggestions also neat :)
Here's another variation of the LM339 circuit. This time, what was the reference, in the previous circuit, is now the input and the other potential divider taps references: Off_th for the turn off voltage and On_th for the turn on voltage. Obviously Off_th needs to be highr than On_th, otherwise it will be in an indeterminate state. I've simulated it, using the LM393 model which is the same as the LM339, except only dual. Interestingly trying make the circuit non-inverting, by swapping the set and reset flop-flop connections, caused convergence errors in LTSpice, but it should work on the bench.
« Last Edit: February 20, 2018, 08:23:15 pm by Hero999 »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • 0999
Re: the simplest thermostat with programmable thresholds?
« Reply #17 on: February 20, 2018, 08:17:43 pm »
I've solved the issue of the convergence errors. U1a's input voltage range was being exceeded. I feel a bit silly for blindly copying the bistable part off that website. :-[ I've added R6 and changed the value of R1. If the supply voltage is reduced, the component values may need to be changed again.

Here's the non-inverting version. If you need the inverting circuit, include R6 and use 4k7 for R1.

If you use a comparator, with rail-to-rail inputs, then R6 is not needed.
« Last Edit: February 21, 2018, 09:01:58 am by Hero999 »
 
The following users thanked this post: exe

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: the simplest thermostat with programmable thresholds?
« Reply #18 on: February 21, 2018, 08:49:53 pm »
Thanks, Hero999!

I also tried the approach suggested by Mechatrommer, it seems it has the lowest part count. I replaced bjt with a fet (bs170) because I'm not sure how bjts may drift with temperature. (Also wasn't sure if emitter-base voltage is within the limits) . It works like a charm! Downside of this approach: threshold adjustments are not independent. Also small fets are very sensisitve to ESD...
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: the simplest thermostat with programmable thresholds?
« Reply #19 on: February 22, 2018, 02:39:36 am »
A PSOC may seem overkill, but its got -

1) A/D to sense low batt
2) Die T sensor
3) OnChip V ref
4) Pins for buttons to raise/lower settings, or capsense pins, eliminate mechanical buttons
5) LCD interface in case you want to display
6) Pins to drive LED to indicate on/off

Lost of other stuff.

~ $1.00 at 1KU, PSOC 41XX

In this case maybe 20 lines of code for display-less simple solution.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11631
  • Country: my
  • reassessing directives...
Re: the simplest thermostat with programmable thresholds?
« Reply #20 on: February 22, 2018, 03:01:46 am »
Quote
It works like a charm! Downside of this approach: threshold adjustments are not independent
And not linear on potentiometer rotation. But i tried to avoid user mistake of setting lower temp threshold higher than high threshold,and assume the setting will be done seldomly with presence of dmm and thermistor data. once calibrated the circuit should work. The circuit certainly can be refined,but with increasing comp count i suspect as hero's cicuit.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 


Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: the simplest thermostat with programmable thresholds?
« Reply #22 on: February 22, 2018, 08:16:22 am »
Why not simply use one of these
https://www.ebay.com/itm/40-160-C-Thermostat-Temperature-Thermal-Switch-Normally-Open-Closed-NO-NC-KSD30/292139062263?hash=item4404d853f7:m:mTEsBn21CpkOaNAKyRqBh3w

It's not adjustable, cannot be switched on from MCU (not sure why I want this) and I'm not sure how to mount it. But, I think I'll mount something similar, but normally closed with open temperature at ~80C as a protection measure.

A PSOC may seem overkill, but its got -
[...]
Lost of other stuff.

~ $1.00 at 1KU, PSOC 41XX

Thanks, I'll consider them. I even have two PSoC4 kits (CY8CKIT-049). The problems are: no Linux support, not easy to buy in region, one more thing to learn :(
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: the simplest thermostat with programmable thresholds?
« Reply #23 on: February 22, 2018, 11:29:20 am »
Have you tried Virtualbox to run PSOC Creator ?


https://community.cypress.com/thread/14665


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • 0999
Re: the simplest thermostat with programmable thresholds?
« Reply #24 on: February 22, 2018, 01:37:38 pm »
A PSOC may seem overkill, but its got -

1) A/D to sense low batt
2) Die T sensor
3) OnChip V ref
4) Pins for buttons to raise/lower settings, or capsense pins, eliminate mechanical buttons
5) LCD interface in case you want to display
6) Pins to drive LED to indicate on/off

Lost of other stuff.

~ $1.00 at 1KU, PSOC 41XX

In this case maybe 20 lines of code for display-less simple solution.


Regards, Dana.
The application is for 12V. I haven't read the data sheet, but generally programmable devices are limited to 5V, so a regulator  (assuming it doesn't have an on chip regulator) and potential dividers are still required to scale the voltage down to something the device can handle.

Thanks, Hero999!

I also tried the approach suggested by Mechatrommer, it seems it has the lowest part count. I replaced bjt with a fet (bs170) because I'm not sure how bjts may drift with temperature. (Also wasn't sure if emitter-base voltage is within the limits) . It works like a charm! Downside of this approach: threshold adjustments are not independent. Also small fets are very sensisitve to ESD...

A MOSFET is probably better, than a BJT here, since it will have a lower on loss, at these low currents.

If you just want a minimum part solution, then why not use the traditional comparator Schmitt trigger circuit? The thresholds are notlonger independent, but it's much simpler than that circuit. If you really need minimal parts, use a comparator with a push-pull output and the pull-up resistor can be eliminated.



http://www.analog.com/en/analog-dialogue/articles/curing-comparator-instability-with-hysteresis.html
« Last Edit: February 22, 2018, 06:47:15 pm by Hero999 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf