Author Topic: MOSFET problem in PWM fan controller  (Read 8578 times)

0 Members and 1 Guest are viewing this topic.

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
MOSFET problem in PWM fan controller
« on: December 22, 2016, 12:44:40 am »
hello, I am new here

I am trying to make a fan controller for a 4 pin PWM computer fan

this is the best I could find regarding a proper specification: http://formfactors.org/developer%5Cspecs%5C4_Wire_PWM_Spec.pdf

the fan has an internal pullup resistor so needs to connect to an open drain / open collector style output

I have attached my circuit diagram including a simplified circuit for the fan to help show what is happening



now the problem I am having is this, if I measure at the gate of the MOSFET I get the expected 25kHz square wave:



......but if I measure at the drain I get this ugly sawtooth wave which does not control the fan properly:



I disconnected the fan and took readings from the signal pin, I get a constant 4.25 volts and current between it and ground is 58uA, this would suggest to me a pullup in the region of 80k, also if I ground the pin the fan shuts off, and if I leave it floating it spins up to full speed, all this is consistent with an internal pullup

so I disconnect the fan from drain and put a 100k resistor to 5v instead, I get the same ugly wave, if I swap the resistor for a 1k I get a nice square wave, if I connect the fan with this 1k pullup in place I also get the square wave and the fan responds correctly, this and the sawtooth on the oscilloscope leads me to believe that the MOSFET is being very slow to switch off when the drain to source current is low, am I correct? will a different MOSFET respond better?
« Last Edit: December 22, 2016, 12:47:30 am by tehtehteh »
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #1 on: December 22, 2016, 01:12:16 pm »
nobody? if I need to give more information I will, just say the word
 

Offline ZeroResistance

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #2 on: December 22, 2016, 03:31:17 pm »
nobody? if I need to give more information I will, just say the word

The gate resistor of 300ohm for the BS170 mosfet seems too high try with 22ohm.

Also have you checked the fan does it run full speed when you give steady 5V to the PWM input.

Have you measured the gate waveform directly at the gate or before the 300ohm resistor?
« Last Edit: December 22, 2016, 03:40:54 pm by ZeroResistance »
 

Offline leeatljs

  • Contributor
  • Posts: 23
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #3 on: December 22, 2016, 03:41:34 pm »
As you have correctly worked out, that 80k pullup is too high when you are running at 25khz.
Stick your own 1k pullup in and everything will be ok.
That 80k pullup has to charge the capacitance of that mosfet and any other capacitance that might be on that line.
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #4 on: December 22, 2016, 03:54:24 pm »
The gate resistor of 300ohm for the BS170 mosfet seems too high try with 22ohm.

Also have you checked the fan does it run full speed when you give steady 5V to the PWM input.

Have you measured the gate waveform directly at the gate or before the 300ohm resistor?
the gate resistor was a concern, I don't want to go too low because the picaxe will only support 20mA per pin, I started with 1k and took it down to 300ohms and the signal didn't change

the fan has its own pullup internally so if I disconnect it it runs full speed, if I put 5v into the pin it probably would run full speed also but I don't want to try this in case I damage it

I've measured it both at the gate and at the ic pin and it's the same, it looks ok at these points
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 13035
  • Country: gb
  • 0999
Re: MOSFET problem in PWM fan controller
« Reply #5 on: December 22, 2016, 03:57:30 pm »
It doubt the gate resistor is responsible for this.

As you have correctly worked out, that 80k pullup is too high when you are running at 25khz.
Stick your own 1k pullup in and everything will be ok.
That 80k pullup has to charge the capacitance of that mosfet and any other capacitance that might be on that line.

Yes. It's the same problem as discussed in the other thread. The drain-source capacitance is being charged, via the pull-up. 1k will probably be fine here, since the BS170 is much smaller and therefore has less capacitance, than a high power MOSFET does.

https://www.eevblog.com/forum/beginners/why-is-mosfet-turning-off-slowly/msg1096628/#msg1096628
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #6 on: December 22, 2016, 03:59:29 pm »
As you have correctly worked out, that 80k pullup is too high when you are running at 25khz.
Stick your own 1k pullup in and everything will be ok.
That 80k pullup has to charge the capacitance of that mosfet and any other capacitance that might be on that line.
the problem with using my own 1k pullup is some fans work internally on 3.3v logic, I am measuring this one at 4.25v, so I don't know if putting 5v into that pin would cause current to flow in the wrong direction in some part, also the pullup prevents the fan from turning off completely, if I ground the signal pin the fan will stop rotating, but with the pullup and 0% duty cycle the fan still spins at a low RPM, for reasons I can't really work out, but it's wrong anyway

your last sentence is interesting, as this is all currently on a breadboard, so I wonder how much of an effect this has on the capacitance
« Last Edit: December 22, 2016, 04:10:28 pm by tehtehteh »
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #7 on: December 22, 2016, 04:02:04 pm »
Yes. It's the same problem as discussed in the other thread. The drain-source capacitance is being charged, via the pull-up. 1k will probably be fine here, since the BS170 is much smaller and therefore has less capacitance, than a high power MOSFET does.

https://www.eevblog.com/forum/beginners/why-is-mosfet-turning-off-slowly/msg1096628/#msg1096628
I'm only using the BS170 because it was the only one I had in my box of things, would a different MOSFET or BJT work at these frequencies without the need for the pullup?
 

Offline ZeroResistance

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #8 on: December 22, 2016, 04:04:55 pm »
the problem with using my own 1k pullup is some fans work internally on 3.3v logic, I am measuring this one at 4.25v, so I don't know if putting 5v into that pin would cause current to flow in the wrong direction in some part, also the pullup prevents the fan from turning off completely, if I ground the signal pin the fan will stop rotating, but with the pullup and 0% duty cycle the fan still spins at a low RPM, for reasons I can't really work out, but it's wrong anyway

Why don't you try with our ol' friend the BJT... ;)
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #9 on: December 22, 2016, 04:09:41 pm »
the problem with using my own 1k pullup is some fans work internally on 3.3v logic, I am measuring this one at 4.25v, so I don't know if putting 5v into that pin would cause current to flow in the wrong direction in some part, also the pullup prevents the fan from turning off completely, if I ground the signal pin the fan will stop rotating, but with the pullup and 0% duty cycle the fan still spins at a low RPM, for reasons I can't really work out, but it's wrong anyway

Why don't you try with our ol' friend the BJT... ;)
didn't have one, but I'll get one, did you have anything specific in mind? I only got the BS170 because I thought it would be good for many situations, I didn't really have PWM in mind at the time
« Last Edit: December 22, 2016, 04:11:39 pm by tehtehteh »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 13035
  • Country: gb
  • 0999
Re: MOSFET problem in PWM fan controller
« Reply #10 on: December 22, 2016, 04:14:24 pm »
Yes. It's the same problem as discussed in the other thread. The drain-source capacitance is being charged, via the pull-up. 1k will probably be fine here, since the BS170 is much smaller and therefore has less capacitance, than a high power MOSFET does.

https://www.eevblog.com/forum/beginners/why-is-mosfet-turning-off-slowly/msg1096628/#msg1096628
I'm only using the BS170 because it was the only one I had in my box of things, would a different MOSFET or BJT work at these frequencies without the need for the pullup?
The BS170 is one of the lowest capacitance MOSFETs out there.

the problem with using my own 1k pullup is some fans work internally on 3.3v logic, I am measuring this one at 4.25v, so I don't know if putting 5v into that pin would cause current to flow in the wrong direction in some part, also the pullup prevents the fan from turning off completely, if I ground the signal pin the fan will stop rotating, but with the pullup and 0% duty cycle the fan still spins at a low RPM, for reasons I can't really work out, but it's wrong anyway

Why don't you try with our ol' friend the BJT... ;)
BJTs still have a collector-emitter capacitance to charge. They also can be difficult to turn off quickly: due to the storage time and a emitter-base capacitance discharging.
 

Offline ZeroResistance

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #11 on: December 22, 2016, 04:15:11 pm »
didn't have one, but I'll get one, did you have anything specific in mind?

not really I'm just going in for "don't think but change and check" method .. ;)
I thought you might have a  few lying around in your kit box,  the evergreen 2N2222 .. or something or those lines... but if its going to take some time ordering it .. then persist with the mosfet .. I'm sure the experts here will have something to say about that and get your circuit up and running ...

 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 13035
  • Country: gb
  • 0999
Re: MOSFET problem in PWM fan controller
« Reply #12 on: December 22, 2016, 04:23:20 pm »
didn't have one, but I'll get one, did you have anything specific in mind?

not really I'm just going in for "don't think but change and check" method .. ;)
I thought you might have a  few lying around in your kit box,  the evergreen 2N2222 .. or something or those lines... but if its going to take some time ordering it .. then persist with the mosfet .. I'm sure the experts here will have something to say about that and get your circuit up and running ...
Looking at it again, the 2N2222 might be better than the BS170. Its maximum output capacitance is 8pF vs the 30pF of the MOSFET. You will probably need to add a Baker clamp (base-collector Schottky diode which prevents it saturating) and a base resistor bypass capacitor, to provide a negative pulse to the base, to discharge the base-emitter capacitance.

http://www.logosfoundation.org/instrum_gwr/display/BS170.pdf
http://www.farnell.com/datasheets/296640.pdf
 

Offline ZeroResistance

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #13 on: December 22, 2016, 04:26:13 pm »
Looking at it again, the 2N2222 might be better than the BS170. Its maximum output capacitance is 8pF vs the 30pF of the MOSFET. You will probably need to add a Baker clamp (base-collector Schottky diode which prevents it saturating) and a base resistor bypass capacitor, to provide a negative pulse to the base, to discharge the base-emitter capacitance.

Speaking about output capacitance the datasheet talks about it as the Collector to Base capacitance and that's mentioned as 8pF ... haven't read anything about Collector to Emitter capacitance ... or isn't there one like that?
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #14 on: December 22, 2016, 04:33:00 pm »
The BS170 is one of the lowest capacitance MOSFETs out there.
doh!

there must be a way as these things seem to work on computer motherboards just fine, would a gate driver help do you think? without the current limit of the picaxe maybe it would switch better?
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 13035
  • Country: gb
  • 0999
Re: MOSFET problem in PWM fan controller
« Reply #15 on: December 22, 2016, 04:41:09 pm »
Looking at it again, the 2N2222 might be better than the BS170. Its maximum output capacitance is 8pF vs the 30pF of the MOSFET. You will probably need to add a Baker clamp (base-collector Schottky diode which prevents it saturating) and a base resistor bypass capacitor, to provide a negative pulse to the base, to discharge the base-emitter capacitance.

Speaking about output capacitance the datasheet talks about it as the Collector to Base capacitance and that's mentioned as 8pF ... haven't read anything about Collector to Emitter capacitance ... or isn't there one like that?
The output capacitance is the sum of the base or gate to collector capacitance and source or emitter to drain or collector capacitances.

http://www.infineon.com/dgdl/mosfet.pdf?fileId=5546d462533600a4015357444e913f4f

The BS170 is one of the lowest capacitance MOSFETs out there.
doh!

there must be a way as these things seem to work on computer motherboards just fine, would a gate driver help do you think? without the current limit of the picaxe maybe it would switch better?
I doubt a gate driver would make any difference because the waveform on the gate is fine.

I haven't seen the schematic for the fan control circuit in a computer mother board but would presume it has a pull-up resistor or a push-pull output.

 

Offline ZeroResistance

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #16 on: December 22, 2016, 04:48:16 pm »
The BS170 is one of the lowest capacitance MOSFETs out there.
doh!

there must be a way as these things seem to work on computer motherboards just fine, would a gate driver help do you think? without the current limit of the picaxe maybe it would switch better?

Why don't you first take the fan out of the equation and just get a clean signal on the drain of the mosfet, as Hero999 says connect a 1k load to the drain and tie the other end to +12 or whatever your supply is and disconnect the fan you should now see a clean square wave when you scope the drain.
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #17 on: December 22, 2016, 04:50:04 pm »
I haven't seen the schematic for the fan control circuit in a computer mother board but would presume it has a pull-up resistor or a push-pull output.
all I have to go on is this

http://formfactors.org/developer%5Cspecs%5C4_Wire_PWM_Spec.pdf

which says no pullup on the motherboard, only the pullup internal to the fan

the pullup is sorting out the signal but it is having some undesirable effects with the fan not being able to turn off even at 0% duty cycle
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #18 on: December 22, 2016, 04:52:14 pm »
Why don't you first take the fan out of the equation and just get a clean signal on the drain of the mosfet, as Hero999 says connect a 1k load to the drain and tie the other end to +12 or whatever your supply is and disconnect the fan you should now see a clean square wave when you scope the drain.
already done, 1k to 5v gave me a square wave, 100k to 5v gave me a similar sawtooth wave like having the fan connected
 

Offline ZeroResistance

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #19 on: December 22, 2016, 05:02:10 pm »
Why don't you first take the fan out of the equation and just get a clean signal on the drain of the mosfet, as Hero999 says connect a 1k load to the drain and tie the other end to +12 or whatever your supply is and disconnect the fan you should now see a clean square wave when you scope the drain.
already done, 1k to 5v gave me a square wave, 100k to 5v gave me a similar sawtooth wave like having the fan connected

Can you post a pic of your fan, do you have any brand name or model no. written on it ? It's a 4 wire fan right? Any more clues would help us getting more data on the fan...
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #20 on: December 22, 2016, 05:07:14 pm »
Can you post a pic of your fan, do you have any brand name or model no. written on it ? It's a 4 wire fan right? Any more clues would help us getting more data on the fan...
this is the fan

http://noctua.at/en/products/product-line-industrial/nf-a14-industrialppc-3000-pwm
 

Offline ZeroResistance

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #21 on: December 22, 2016, 05:11:33 pm »
Can you post a pic of your fan, do you have any brand name or model no. written on it ? It's a 4 wire fan right? Any more clues would help us getting more data on the fan...
this is the fan

http://noctua.at/en/products/product-line-industrial/nf-a14-industrialppc-3000-pwm
OK, that's good, another quick idea do you have a LM339 comparator lying around its a open collector output and may just do the job...
 

Offline tehtehteh

  • Contributor
  • Posts: 25
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #22 on: December 22, 2016, 05:21:14 pm »
OK, that's good, another quick idea do you have a LM339 comparator lying around its a open collector output and may just do the job...
alas no, my component box is rather basic
 

Offline ZeroResistance

  • Frequent Contributor
  • **
  • Posts: 566
  • Country: gb
Re: MOSFET problem in PWM fan controller
« Reply #23 on: December 22, 2016, 05:32:08 pm »
OK, that's good, another quick idea do you have a LM339 comparator lying around its a open collector output and may just do the job...
alas no, my component box is rather basic

The fan link you provided doesn't mention anything about how to drive the fan.

This guy seems to have made the same thing that you are looking for



He is driving the PWM to the fan directly no mosfets not BJT's etc.. he just connects the MCU pin to the fan. Take a look at the bottom 2 4pin connectors.

The link to the article is here http://geoffg.net/fancontroller.html


Not sure if those PWM pin outputs of the PIC18F are open drain though!
« Last Edit: December 22, 2016, 05:41:38 pm by ZeroResistance »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 13035
  • Country: gb
  • 0999
Re: MOSFET problem in PWM fan controller
« Reply #24 on: December 22, 2016, 06:11:20 pm »
OK, that's good, another quick idea do you have a LM339 comparator lying around its a open collector output and may just do the job...
alas no, my component box is rather basic

The fan link you provided doesn't mention anything about how to drive the fan.

This guy seems to have made the same thing that you are looking for



He is driving the PWM to the fan directly no mosfets not BJT's etc.. he just connects the MCU pin to the fan. Take a look at the bottom 2 4pin connectors.

The link to the article is here http://geoffg.net/fancontroller.html


Not sure if those PWM pin outputs of the PIC18F are open drain though!
That circuit doesn't use the fan's PWM pin. It's a buck converter which varies the fan's supply voltage, which may not work well with four wire fans.

I haven't seen the schematic for the fan control circuit in a computer mother board but would presume it has a pull-up resistor or a push-pull output.
all I have to go on is this

http://formfactors.org/developer%5Cspecs%5C4_Wire_PWM_Spec.pdf

which says no pullup on the motherboard, only the pullup internal to the fan

the pullup is sorting out the signal but it is having some undesirable effects with the fan not being able to turn off even at 0% duty cycle
It seems like you're overcomplicating things.

You don't need a MOSFET or any other switching transistor because MCU is more than capable of driving the current/voltage on the fan's PWM input. All you need is a small signal diode (1N4148 (silicon) or BAT54 (Schottky whcih should be even better)), connected positive side to the fan's PWM input and negative side to the MCU output. This will convert the MCU output to an open drain output. There may be some tiny spikes when switching but the fan should be able to cope with them.
« Last Edit: December 22, 2016, 06:17:26 pm by Hero999 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf