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

0 Members and 1 Guest are viewing this topic.

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19790
  • Country: gb
  • 0999
Re: Fan controller circuit with an Op amp and a LED
« Reply #25 on: June 07, 2020, 05:21:10 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.
Why? The current listed on the data sheet is typically not far from the maximum rating, which is often too bright.

Quote
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?

You're using a potential divider, so there's no need to calculate the voltages. The ratios of the resistors are all that matter. I showed how to calculate the values in another thread.
https://www.eevblog.com/forum/beginners/how-should-a-beginner-balance-theory-and-practical-ldr-project/msg3047206/#msg3047206
« Last Edit: June 07, 2020, 05:23:06 pm by Zero999 »
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #26 on: June 07, 2020, 05:56:00 pm »
Here's the LED I planned on using: https://www.arrow.com/en/products/qbl8r15c/qt-brightek-corporation
But if I still want to go the transistor route (like in the thread you mentioned about the Schmitt Trigger...), this schematic should be ok, correct?
Bildschirmfoto-2020-06-07-um-19-28-42" border="0

I need to read more about the Schmitt Trigger in oder to understand how to determine the ratios for this application...
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8067
  • Country: de
  • A qualified hobbyist ;)
Re: Fan controller circuit with an Op amp and a LED
« Reply #27 on: June 07, 2020, 06:01:18 pm »
Poor little fellow! The BC557 won't be happy without a proper base resistor.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19790
  • Country: gb
  • 0999
Re: Fan controller circuit with an Op amp and a LED
« Reply #28 on: June 07, 2020, 06:02:53 pm »
Here's the LED I planned on using: https://www.arrow.com/en/products/qbl8r15c/qt-brightek-corporation
But if I still want to go the transistor route (like in the thread you mentioned about the Schmitt Trigger...), this schematic should be ok, correct?
Bildschirmfoto-2020-06-07-um-19-28-42" border="0

I need to read more about the Schmitt Trigger in oder to understand how to determine the ratios for this application...
There should be a pull-up resistor between the output and +12V: 10k should do.

I'll make another post, going into more detail about the ratios later. Meanwhile, please refer to the thread I linked to previously for more information.
Poor little fellow! The BC557 won't be happy without a proper base resistor.
Why not? It's an emitter follower, so the base current is self-limiting. No base resistor is required.
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Fan controller circuit with an Op amp and a LED
« Reply #29 on: June 09, 2020, 01:11:22 pm »
I'm late to the party, but how about just using  an ATTiny85 uP?
You only need the NTC, MOSFET, 2 resistors and a LED.
You can have the duty cycle curve fit however you like, have the overheat LED with hysterisis and well-defined points.

Hey! I just realized I've got some I2C temp sensors on hand, even easier, no calibration.
« Last Edit: June 09, 2020, 01:41:11 pm by Renate »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19790
  • Country: gb
  • 0999
Re: Fan controller circuit with an Op amp and a LED
« Reply #30 on: June 10, 2020, 10:19:10 pm »
I'm late to the party, but how about just using  an ATTiny85 uP?
You only need the NTC, MOSFET, 2 resistors and a LED.
You can have the duty cycle curve fit however you like, have the overheat LED with hysterisis and well-defined points.

Hey! I just realized I've got some I2C temp sensors on hand, even easier, no calibration.
A microcontroller is a reasonable enough suggestion. It will require a 5V power supply, but the LM78L05 will do the job.
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #31 on: June 11, 2020, 12:02:26 pm »
I'm late to the party, but how about just using  an ATTiny85 uP?

It's a microcontroller, so I'd have to flash it which (for me) makes it way more complex... Plus I'd have to start from scratch again (which I already did twice before posting here). This fan control circuit is not the main feature of this PCB (I'm doing an ATX mod to a Macintosh Quadra 950), and spending this much time just on the fan controller itself is already pretty inefficient, but at least I learned something along the way.

I initially created a dumb controller with just a potentiometer, then realized that this limited me to 2W fans, which led me to design a (flawed) comparator circuit to compare the original ATX PSU fan signal to an Analog-converted PWM lower threshold fan signal (set using that potentiometer). I then realized that it would be impossible to compare (and convert to analog for the comparison) the original ATX PSU fan signal (if it's PWM controlled, the frequency isn't standardized, unlike ATX "motherboard" fan signals which typically work at 20-25kHz). This led me to design a brand new temperature controlled fan PWM controller (the one we're talking about in this thread) which basically "doubles" the level of security (compared to my very first design, see above). The ATX PSU should still have a working overheating protection (I won't remove its thermistor) but because of this mod, it looses its fan control... so I needed to add it back in. And the LED circuit is only meant to warn the user of a problem... It should never light up...

After this small interlude/explanation, let's go back to the matter at hand:
I found this website which IMO explains really well how to design Schmitt trigger circuits (it's in German. I live there so I understand it no problem, YMMV)
http://www.krucker.ch/DiverseDok/Schmitt%20Trigger.pdf

Example/Beispiel 3 is exactly what I've been trying to design. Using Excel, I was able to create a basic yet effective calculator.
NB: Usatp/tn are the high/low output voltages, Utp/tn are the upper/lower thresholds.
Bildschirmfoto-2020-06-11-um-12-34-52" border="0

In my case, I'll just change R2 to 1M (instead of 100k), Utp= 10.32V and Utn= 10.07V (I still need to recheck those values with the NTC of my choosing.) I left the value of the pull up resistor at 10k as it just needs to be of a high enough value...
Bildschirmfoto-2020-06-11-um-13-54-52" border="0

Here is the new schematic (I also changed the position of the LED, from what I've read, it should be after the PNP transistor, right?):
Bildschirmfoto-2020-06-11-um-12-34-16" border="0
NB: The blue Resistor text corresponds to the resistor ID on the tutorial schematic (first picture).

What do you think? Will this work now?
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Fan controller circuit with an Op amp and a LED
« Reply #32 on: June 12, 2020, 01:41:06 pm »
Well, here's a handful of comments:

1) If you're not using the other half of the op amp, I'd ground +in, connect output to -in.
Note that this is an easy PCB trace change.
This is pretty trivial, but you may sleep better knowing that the op amp isn't driven to the rails (even though the op amp could care less).

2) There's no reason to have the op amp input so near the rails.
Get rid of R8 (or keep it), take your overheat sense from R7/RV1.
This will drop your operating point to about the middle and you can change R3 & R4.

3) The overheat LED is going to be on all the time and it's clamping the op amp output.
You need a resistor between the op amp and the base.
« Last Edit: June 12, 2020, 01:44:27 pm by Renate »
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #33 on: June 12, 2020, 04:31:52 pm »
Thank you Renate for your comments

1) I followed Zero999's recommendations in his earlier post here: https://www.eevblog.com/forum/beginners/fan-controller-circuit-with-an-op-amp-and-a-led/msg3090461/#msg3090461
I can't tell which one is better. Can't I simply ground everything?

2) If I place In2- between RV1 (pin 3) and R7, this would equate to having one variable resistor (thermistor value + fixed 10k from pot) and one fixed resistor R7. If the thermistor is cold, that'll translate to 20k (TH1+RV1) and 15k from R7 and the voltage at pin 3 of pot/R7 should be 5.1V. When the thermistor is hot (84°C), that'll translate to a 11.1K resistor (1.1K thermistor + 10k pot) and the 15k from R7 which means the voltage at pin 3 of pot/R7 should be 6.9V.
Are my calculations correct? If so I'll go ahead and do that as well as update R3/4.

3) I thought the PNP transistor would be enough to invert the logic... but I was apparently wrong (see last post of this thread)
Should I be using a MOSFET + a resistor between gate and the LM393's output instead? In the thread linked above, Bimpelrekkie said that this would also reverse the output. But this is exactly what I want here.
If so, which MOSFET would you recommend using?

Edit: MOSFETs don't have bases, they have gates.
« Last Edit: June 12, 2020, 04:55:48 pm by BGE »
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8067
  • Country: de
  • A qualified hobbyist ;)
Re: Fan controller circuit with an Op amp and a LED
« Reply #34 on: June 12, 2020, 04:32:59 pm »
LM393 is a comparator, not a OPamp. ;)
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Fan controller circuit with an Op amp and a LED
« Reply #35 on: June 12, 2020, 06:13:30 pm »
LM393 is a comparator, not a OPamp. ;)
Oops, quilty as charged. |O
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Re: Fan controller circuit with an Op amp and a LED
« Reply #36 on: June 13, 2020, 10:26:50 am »
Now that I think of it, why don't I simply use an LM358 in a non-inverting Schmitt trigger configuration?
Would it be THAT bad to use an op amp for this purpose compared to a "proper" comparator like the LM393? I've seen quite a few people use them to control LEDs etc... and this would make the circuit a lot easier since I don't need to invert what I didn't need to invert in the first place...
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8067
  • Country: de
  • A qualified hobbyist ;)
Re: Fan controller circuit with an Op amp and a LED
« Reply #37 on: June 13, 2020, 12:14:18 pm »
No, an OPamp is fine for a simple LED indicator. And most electronic enthusiasts have more likely a jelly bean OPamp in their parts box than a comparator.
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Sorry for the lack of replies. I have completely changed my circuit and am now using a microcontroller (ATtiny85) as Renate suggested earlier. The circuit now works as intended (I built it on a breadboard) so that's at least something.



But now I have another (albeit small) problem regarding interferences/noise.

PB0 is pulsing at 31kHz (for acoustic reasons) and controls an FQP30N06L MOSFET (it switches the fan's ground on and off to modulate its speed). The main ground will be shared with the computer's motherboard. A friend of mine told me to add a snubber network, but of which type? RC, RCD, RC with inductor? Also, can I find the component values without experimentation (I don't have an oscilloscope)?

Thanks in advance for your input on this.

NB: There is a diode (although not shown here) between the fan+ and the fan- terminals.
« Last Edit: August 07, 2020, 07:12:13 am by BGE »
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
It may not be what you want, but if you use a PC 4 wire PWM fan then you don't need to have that power MOSFET.
Just feed your 5V PWM signal to the fan.

The advantage of 4 wire is that you don't have 2 MOSFETs in series (the pass one and the driver one).
I would think that the interference would be less also.
The disadvantage is that you are using a more specific fan.
 
The following users thanked this post: Dabbot

Offline Dabbot

  • Regular Contributor
  • *
  • Posts: 192
  • Country: au
It may not be what you want, but if you use a PC 4 wire PWM fan then you don't need to have that power MOSFET.
Just feed your 5V PWM signal to the fan.

The advantage of 4 wire is that you don't have 2 MOSFETs in series (the pass one and the driver one).
I would think that the interference would be less also.
+1 for this advice.
I programmed a PIC10F322 to run a Noctua fan for some quiet breeze. It's great in the summertime.
https://noctua.at/pub/media/wysiwyg/Noctua_PWM_specifications_white_paper.pdf


The disadvantage is that you are using a more specific fan.
These things are all over the place and come in all sorts of sizes / power / speed etc. Barely a disadvantage.
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Thanks Renate for your message.
Unfortunately I really need to make this compatible with 2 pin fans... Would it be possible to re-create the setup used on 4 pin fans on my PCB?

Also, do you think that interference is really going to be a problem in this application? In other words, can a switching 500mA current draw from a PC fan disturb the other electronics (given that 20 year old hard drives will also be running at the same time etc...)?
 

Offline DrG

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
It may not be what you want, but if you use a PC 4 wire PWM fan then you don't need to have that power MOSFET.
Just feed your 5V PWM signal to the fan.

The advantage of 4 wire is that you don't have 2 MOSFETs in series (the pass one and the driver one).
I would think that the interference would be less also.
+1 for this advice.
I programmed a PIC10F322 to run a Noctua fan for some quiet breeze. It's great in the summertime.
https://noctua.at/pub/media/wysiwyg/Noctua_PWM_specifications_white_paper.pdf


The disadvantage is that you are using a more specific fan.
These things are all over the place and come in all sorts of sizes / power / speed etc. Barely a disadvantage.

FWIW I happened to be using one for a food dehydrator project that I slopped together recently (it is running as I type).
I used this one: bGears90 https://www.bgears.com/b-pwm/[/url]

Works like a charm using a GPIO from a 5V uc (all on or PWM). But, I found that I can't get the fan completely off using the PWM pin. Even attaching it to GND, the fan will still rotate, but only at a very low RPM. I know I could have put it on a MOSFET or relay to turn it off completely, but in my case, it was no problem since I always want the fan on at some level. Still, it surprised me to see this. I don't know if it is specific to my unit or more general with 4-pin fans meant for PC cooling.
« Last Edit: August 07, 2020, 02:02:40 pm by DrG »
- Invest in science - it pays big dividends. -
 

Offline Dabbot

  • Regular Contributor
  • *
  • Posts: 192
  • Country: au
FWIW I happened to be using one for a food dehydrator project that I slopped together recently (it is running as I type).
I used this one: bGears90 https://www.bgears.com/b-pwm/[/url]

Works like a charm using a GPIO from a 5V uc (all on or PWM). But, I found that I can't get the fan completely off using the PWM pin. Even attaching it to GND, the fan will still rotate, but only at a very low RPM. I know I could have put it on a MOSFET or relay to turn it off completely, but in my case, it was no problem since I always want the fan on at some level. Still, it surprised me to see this. I don't know if it is specific to my unit or more general with 4-pin fans meant for PC cooling.

The specifications for 4-wire fans are more like guidelines. Different brands / models behave differently, but I would have thought grounding the PWM pin would stop the fan. Not that it really matters at a very low speed.  :-//

Edit: This behavior is described in the specification under "Operation below Minimum RPM": Type A Operation

For my implementation, the chip reads a value from a pot and outputs a PWM signal from 20% to 100%, or outputs 0% if the pot is in the 'off' position.
« Last Edit: August 07, 2020, 02:52:00 pm by Dabbot »
 

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
 
The following users thanked this post: Dabbot

Offline DrG

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
The Intel 4 wire PWM fan spec (1.3)
https://www.glkinst.com/cables/cable_pics/4_Wire_PWM_Spec.pdf

I don't want to cause any thread drift, but thank you for that. If I am reading section 3.4 correctly, my fan is, by intention, operating the way it is supposed to operate.
- Invest in science - it pays big dividends. -
 

Offline BGETopic starter

  • Contributor
  • Posts: 17
  • Country: fr
Hi all,

sorry for the lack of posts... been kinda busy at work. I have added an RC snubber to the MOSFET. That should negate the interferences if there are any. The plan is to use the board without one, and check if everything is all right and only take further action if needed.

I am pretty happy with my boards, would it be too much to ask for a quick review before I place my order?
Bildschirmfoto-2020-08-24-um-10-43-39" border="0
Bildschirmfoto-2020-08-24-um-10-45-03" border="0
NOT TO SCALE!

Attached the schematics and the Gerbers. Any feedback appreciated! I have to order 15 of each so I really don't want to make a mistake!
Thanks again for your support!
« Last Edit: August 24, 2020, 09:08:01 am by BGE »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf