Author Topic: Weekend Project - op-amp based thermostat / fan controller  (Read 213 times)

0 Members and 1 Guest are viewing this topic.

Offline wobblyTopic starter

  • Regular Contributor
  • *
  • Posts: 112
  • Country: gb
Weekend Project - op-amp based thermostat / fan controller
« on: September 08, 2024, 04:09:28 pm »
My garden shed gets stinking hot in summer.  So I bought a fan to provide some forced ventilation and it works pretty well, except that I have to flip a switch to turn it on or off.  Obviously this needed to be automated!

My normal reflex action in cases like this is to lunge for the nearest microcontroller and do it the easy way.  Not this time.  I'm not so hot at analog electronics (as will soon become apparent when you see the naïve schematic below :o) so I thought I'd try my hand at using some op-amps to solve this problem.

I'm using two ST "uA741" op amps, one to detect the turn-on temperature and another to detect the turn-off temp.  A single NTC thermistor serves both op-amps.  Turn-on and turn-off temperatures can be independently selected by a pair of 10-turn potentiometers.

These two 741's are set up to act as open-loop comparators.  So they output low voltage when the temperature is too low, and high when it's too warm.  These signals drive a pair of optocouplers which provide a latching mechanism for the relay which drives the 12V fan.

I need to work out the best temperature thresholds for the hysteresis band.  I'm thinking perhaps 38°C for fan turn-on and 28°C for turn-off.

One hack I did need to put in was to add two series diodes after the 741s' outputs because it's not a rail-to-rail op-amp, so when it goes low it still outputs about 2 volts.  This causes the two LEDs to light up dimly (which isn't a problem) but it does mean that the optocouplers don't turn off fully, which is a problem.  The 2 diodes drop the voltage output just enough that the optocouplers don't turn on prematurely.

It works quite nicely... sometimes.  I was surprised that it worked at all given my irrational fear of op-amps!
Sometimes it just fires up the fan at power on.  I'm not sure why, it looks like the 741s are glitching at both power on and power off.

This is just a prototype though, I'll be making a PCB for the final design which will have a few tweaks and more safety features such as fuses etc.  I'll need to find a suitable power supply for running this from UK mains.

Just thought I'd share this so you can all have a good laugh at my ineptitude at anything that doesn't rely on microcontrollers  :-DD
« Last Edit: September 08, 2024, 04:44:48 pm by wobbly »
 

Offline wobblyTopic starter

  • Regular Contributor
  • *
  • Posts: 112
  • Country: gb
Re: Weekend Project - op-amp based thermostat / fan controller
« Reply #1 on: September 08, 2024, 04:27:02 pm »
Another thing that would improve this design is to add a Schmitt trigger after each op-amp output.  I could use a couple more 741s for this.  I have noticed that the relay can buzz for a moment before the latch takes effect.  Op-amps are awesome things!
 

Offline temperance

  • Frequent Contributor
  • **
  • Posts: 582
  • Country: 00
Re: Weekend Project - op-amp based thermostat / fan controller
« Reply #2 on: September 08, 2024, 06:48:33 pm »
You could replace those LM741 with an LM339 dual comparator. Those have open collector outputs. As such you can remove the two opto couplers and drive the relays from a single.

Quote
Another thing that would improve this design is to add a Schmitt trigger after each op-amp output.  I could use a couple more 741s for this.  I have noticed that the relay can buzz for a moment before the latch takes effect.   

You will need to add hysteresis around the two comparators. Additional Schmitt trigger won't help if the comparators are oscillating.
 
The following users thanked this post: wobbly

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9199
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Weekend Project - op-amp based thermostat / fan controller
« Reply #3 on: September 08, 2024, 07:09:26 pm »
A single comparator and a MOSFET will work to make a differential temperature controller checking two NTC thermistors (each with its own 10k or so pullup resistor) and a single potentiometer in series with the indoor thermistor sets the differential.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf