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
) 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