Author Topic: Fan controller circuit (originally with an Op Amp, now with a µcontroller)  (Read 6613 times)

0 Members and 1 Guest are viewing this topic.

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Hi all,
I'm new here. I have designed a fan controller circuit based on the MIC 502 fan management IC:


First let me explain what I want this to do:
- The potentiometer should be used to set a base duty cycle (aka minimum fan speed). The fan speed should then rise as the thermistor TH1 heats up. The transistor switches the fan's ground to on/off based on the duty cycle.
- The box on the bottom is meant to drive a LED. If the thermistor value drops down to 1.2K (temperature is above 80°C), I want the LED on. 

I have a couple of issues:
1/ I've been told the LM358 is not a great option as a voltage comparator. Should I use something else? For example a LM393? All I want is a voltage comparator circuit in a PDIP package capable of running a LED.
2/ Is my comparator setup correct? I'm having doubts. The trigger for this circuit should be the thermistor reaching 80°C (or 1.2kOhm). I created IN2- as an image of IN2+ except the thermistor is replaced by a resistor representing the state of the thermistor at 80°c. I also did away with the potentiometer because I don't want it to affect the comparator circuit.
But now that I look at it, my voltage at R8 IS going to be affected by the value of the potentiometer, no (it's basically a voltage divider isn't it)?

Thanks in advance for your help!!
« Last Edit: August 07, 2020, 07:04:38 am by BGE »
 

Online Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1461
  • Country: ua
Re: Fan controller circuit with an Op amp and a LED
« Reply #1 on: June 01, 2020, 06:58:03 pm »
1/ I've been told the LM358 is not a great option as a voltage comparator. Should I use something else? For example a LM393? All I want is a voltage comparator circuit in a PDIP package capable of running a LED.
If you need a comparator then LM393 (LM2903) is a better choice of cause. Its input common-mode voltage range includes the negative rail as it is in LM358.
 

Offline fragile

  • Contributor
  • Posts: 10
  • Country: us
  • My Mom wants me to excel in STEM subjects.
Re: Fan controller circuit with an Op amp and a LED
« Reply #2 on: June 01, 2020, 08:23:33 pm »
You know what would go great with this? If you used a 100k ntc and put a pot in parallel with it. Then you could control the amount of change in resistance in the ntc per degree, because by turning the pot down it would make the 100k ntc become less than 100k, and even less thqn 10k, if you turned it down far enough.

But you don't relly need a pot, you just need a variable resistor. I'm just thinking of if it (the system) oscillates. But the ic probwbly maybe prevents that somehow. I just don't want to sound stupid. Sorry if I'm wrong.
Everything else is wrong!
 

Online Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1461
  • Country: ua
Re: Fan controller circuit with an Op amp and a LED
« Reply #3 on: June 01, 2020, 10:37:33 pm »
2/ Is my comparator setup correct?
As for R5/R6 comparator divider - it is too high (11.1V ?). "Usual" opamps (I mean non-rail-to-rail input) don't like voltages close to V+ power supply.
Look at "Input Common Mode Voltage Range" for LM393. It is "V+ minus 1.5V". For 12 VDC power supply it means 10.5VDC max at the opamp input.
« Last Edit: June 01, 2020, 10:39:41 pm by Vovk_Z »
 

Offline Agalien

  • Newbie
  • Posts: 2
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #4 on: June 03, 2020, 04:57:33 pm »
Why not use the over temperature detection output (/OTF - pin 6) to control the led? This output is already monitored by a comparator.
Otherwise, do you have the R/T characteristics of the NTC thermistor and the different temperature levels that you need to manage such as (i.e. Temp = 25° PWM 0% - Temp = 60° PWM 100% - Temp > 80° OTF activated)
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: Fan controller circuit with an Op amp and a LED
« Reply #5 on: June 03, 2020, 05:36:19 pm »
Why have you selected a BUL58D as switching transistor? It's a high voltage type, usually used in old CRT TVs. BTW, it has a freewheeling diode integrated.
 

Offline ender4171

  • Contributor
  • Posts: 29
  • Country: us
Re: Fan controller circuit with an Op amp and a LED
« Reply #6 on: June 03, 2020, 05:36:28 pm »
No comments on your questions (though I built a similar project using just a 555, some passives, a variable resistor, and a bi-metal thermal switch.  Crude (and the duty cycle is static), but it works just fine), but your schematic just gave me a "Jesus, I've been doing this all wrong!" moment.  Never thought to just duplicate the positive rail in order to make a better schematic layout.  I've always just had one "rail" and tried to force everything to fit, lol.
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #7 on: June 07, 2020, 10:35:16 am »
Sorry for the lack of replies everyone, I just don't have time on week days for my hobbies...

@Vovk_Z (pt1): I'll go with the 393 then!

@fragile: "Then you could control the amount of change in resistance in the ntc per degree." I'm not interested in changing this characteristic... Ideally I'd like to get the exact voltage drop caused by the NTC (ie not influenced by the pot) in oder to get a temperature reading for the LED control part of this circuit.

@Vovk_Z (pt2): I don't have much experience with op Amps so I didn't know this. Thanks for letting me know! I've got 11.1V because the value of the NTC at 80°C is 1.2k and this is the temperature at which I'd like the LED to come on. So if I want to work with voltages above 10.5V, I need a rail to rail op amp? Do rail to rail 393s exist in PDIP packages?

@Agalien: As far as I know, this /OTF output can't be switch on/off at a specific temperature (in my case, I'd like the switch to occur at 80°C).
I don't have the R/T characteristics of the thermistor yet.I haven't chosen one yet and based my calculations on a random spec sheet (http://2avrmz2nom8p47cc28p2743e-wpengine.netdna-ssl.com/wp-content/uploads/2010/11/Thermistor_10K-2.pdf) I found on the internet.
I want the fan to run at whichever speed/PWM defined by the potentiometer. As the NTC's resistance goes lower, the PWM duty cycle shall increase (MIC502 should manage this). If the NTC reaches 80°C (1.2K), the LED should light up.

@madires: I found this BUL58D randomly while searching on Arrow.com. The original schematic had a TIP122. Would the latter be better?

@ender4171: That's what I wanted to do initially but I thought I might as well incorporate a temperature controlled circuit while I'm at it.
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #8 on: June 07, 2020, 10:56:54 am »
@Vovk_Z: If I change R8 and R5 to 6.8k (see below), now the voltage won't won't exceed 10.5V. Is this now better (as an "Input Voltage Range" perspective)? The rest of my circuit (VT1 of the MIC502) shouldn't be altered, right?


As is (now), I should have the following voltages at pin 5 of the op amp (if this is correct...):
10k NTC (cold): 4.8V
5k NTC: 6.9V
1.2k NTC (80°C): 10.2V
1k NTC (worst case scenario, >80°C should never happen): 10.4V.



My main concern at the moment is that I don't know if the voltage at pin 5 of the op amp (I haven't switched to a 393 yet) will vary if I turn the potentiometer RV1.
I know this is probably a stupid question... but I can't figure this one out by myself...


« Last Edit: June 07, 2020, 11:20:05 am by BGE »
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: Fan controller circuit with an Op amp and a LED
« Reply #9 on: June 07, 2020, 11:38:32 am »
@madires: I found this BUL58D randomly while searching on Arrow.com. The original schematic had a TIP122. Would the latter be better?

TIP122 is an NPN Darlington with a collector current of 5A.  How much current does the fan need? Have you though about using a MOSFET?
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #10 on: June 07, 2020, 12:31:22 pm »
Hi madires
I'm trying to design this so that any 120mm case fan will work. I have an old one (1992) that can draw up to 6W (12v @ 0.5A) so let's say 12W to be extra sure (I don't think there are many 120mm fans that draw more than 1A). The BUL58D and the TIP122 are both overkill for this application. Is it worth changing? The BUL58D is still manufactured and is still cheap ($0.55)...
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: Fan controller circuit with an Op amp and a LED
« Reply #11 on: June 07, 2020, 12:45:19 pm »
Are you aware that the BUL58D has a low hFE of around 40 (minimum is 5)? And what about the C-E voltage drop?
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #12 on: June 07, 2020, 12:56:37 pm »
I was not and I'm afraid I don't know what are the important criteria are when choosing transistors (that's one of the reasons I created this thread under Beginners...)
Based on what I want to do, which one would you use?
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3338
  • Country: gb
Re: Fan controller circuit with an Op amp and a LED
« Reply #13 on: June 07, 2020, 01:19:25 pm »
My main concern at the moment is that I don't know if the voltage at pin 5 of the op amp (I haven't switched to a 393 yet) will vary if I turn the potentiometer RV1.
I know this is probably a stupid question... but I can't figure this one out by myself...

Provided the current flowing into or out of the VT1 pin is negligible compared to your thermistor current then the position of RV1 will not change the voltage on pin 5 of your op-amp.  The datasheet says this current could range from -2.5uA to +1uA, so you can work this out.
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #14 on: June 07, 2020, 01:36:30 pm »
Thanks mikerj for clarifying this. I completely forgot that current was going to play a role here. And as you pointed out, since the current flowing through VT1 of the MIC502 is really negligible, the potentiometer (connected in series to VT1) won't affect my temperature readings/voltage on the other side.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19995
  • Country: gb
  • 0999
Re: Fan controller circuit with an Op amp and a LED
« Reply #15 on: June 07, 2020, 01:39:00 pm »
D2 is in the wrong place. It should be in parallel with the motor, not the transistor.
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #16 on: June 07, 2020, 01:44:06 pm »
Hi Zero999,
I basically copied the top schematic from this site: https://bit-tech.net/reviews/modding/pwm_fan_controller/1/

and here is why the author added a diode there (it's D1 in his schematic):
Quote
The diode, D1 is to protect the transistor from reverse voltage spikes when switching the fan off. Using modern DC axial fans should not be a problem and D1 may be considered optional. Since I cannot test every possible device people may connect to the circuit I have included D1 for completeness.

Does this make sense?
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: Fan controller circuit with an Op amp and a LED
« Reply #17 on: June 07, 2020, 01:52:22 pm »
I was not and I'm afraid I don't know what are the important criteria are when choosing transistors (that's one of the reasons I created this thread under Beginners...)

When you use a BJT as a switch it needs to be driven into saturation (turning it fully on). The maximum output current of the MIC502 is 25mA. That's not enough for the BUL58D with a hFE of 40.

Based on what I want to do, which one would you use?

I'd try a logic-level MOSFET. MIC502's V_OH is 3.2V for a Vcc around 12V, but a graph shows about 3.75V at I_OH of 10mA and 12V Vcc.
« Last Edit: June 07, 2020, 02:03:08 pm by madires »
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #18 on: June 07, 2020, 02:18:10 pm »
OK, let's recap everything that has been done:

Here's the current schematic


- BUL58D was replaced by a TIP122 (if there's a better one, I'll update the schematic)
- Voltage drop at pin 6 of comparator caused by potentiometer/MIC502 (used to be pin 5 before Schmitt trigger) has been deemed negligible. Voltage at R8/RV1 pin 1 represents the temperature of the NTC thermistor and isn't influenced by anything but it.
- LM358 was replaced by an LM393 comparator (rail to rail)
- Comparator input voltages tweaked so that they fall within spec (6.8k resistor).
- Added Schmitt trigger circuit. LED shall turn on when High Threshold is reached (when NTC behaves like a 1.1k resistor, ie when temperature is around 84°C -> 10.32V) and shall turn off when voltage falls below the Low Threshold (when NTC behaves like a 1.3k resistor, ie when temperature is around 79°C -> 10.07V). Resistor values calculated using this website (Low Threshold: 10.07V, High Threshold: 10.32V, V_Ref: 12V, Output Voltage High: 12V, Output Voltage Low: 0V). Here's the output.

Apart from the transistor, it should be pretty much ready to go?
What do you think?
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: Fan controller circuit with an Op amp and a LED
« Reply #19 on: June 07, 2020, 02:35:07 pm »
The LM393 has an open collector output. So you need to power the LED via Vcc.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19995
  • Country: gb
  • 0999
Re: Fan controller circuit with an Op amp and a LED
« Reply #20 on: June 07, 2020, 02:44:14 pm »
Hi Zero999,
I basically copied the top schematic from this site: https://bit-tech.net/reviews/modding/pwm_fan_controller/1/

and here is why the author added a diode there (it's D1 in his schematic):
Quote
The diode, D1 is to protect the transistor from reverse voltage spikes when switching the fan off. Using modern DC axial fans should not be a problem and D1 may be considered optional. Since I cannot test every possible device people may connect to the circuit I have included D1 for completeness.

Does this make sense?
No, it's nonsense. The transistor is not subjected to reverse voltages, when it turns off. It will be subjected to high positive voltages, in excess of the power supply voltage, when it turns off.

The correct place for the diode is across the motor.


https://learn.sparkfun.com/tutorials/diodes/
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #21 on: June 07, 2020, 03:21:49 pm »
Updated the schematic after reading madires and Zero999's comments.
@madires: Is the LED setup correct now or do I need a pull up resistor? (In the low state, the LED should be off).

Bildschirmfoto-2020-06-07-um-17-17-05" border="0

 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: Fan controller circuit with an Op amp and a LED
« Reply #22 on: June 07, 2020, 04:03:54 pm »
It's a little bit more complicated. IIRC, the output transistor switches the collector to ground if the voltage at the inverting input is higher than at the non-inverting one. Therefore one would add a pull-up resistor at the the output for positive logic, also because Out1 is fed back into In1-. To drive the LED there are two ways. One is to reverse the logic of the comparator and let the open collector output drive the LED (LED on when the voltage at the inverting input is higher). The other is to add a small transistor to switch the LED.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19995
  • Country: gb
  • 0999
Re: Fan controller circuit with an Op amp and a LED
« Reply #23 on: June 07, 2020, 04:15:15 pm »
The first comparator in the LM393 package is configured as a linear non-inverting amplifier, which will just oscillate.

Connect the LED directly between the output of the comparator and +V. 470R is also a bit lower value for the LED, which will give around 20mA and the LM393 can't sink that much current. Modern LEDs should be bright enough with 2k2, which will give 5mA.

R11 appears to be a bit on the high side for a hysteresis resistor.

 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #24 on: June 07, 2020, 04:35:01 pm »
Thank you both for your replies.
So, if I want to sink more current, I need an additional transistor (madires' second method)... The LED I had selected worked at 20mA... I'll try to find another LED.

About the Schmitt Trigger resistor values, I agree that R11 was probably a bit low (I re-ran the calculator and got 1.2M), but now that I think of it, this calculator doesn't take into account open collector outputs... I set the output voltage (High) to 12V when I did my calculations. That probably means my values are wrong aren't they?
Bildschirmfoto-2020-06-07-um-18-32-51" border="0
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf