I'm not sure if that title explains it well enough, but I have a 12V PWM PC fan which I want to drive using a 5V PIC.
The fan has 4 pins, GND, +12V, PWM and TACH. The TACH is a speed sense pulse from a Hall effect sensor, and I won't be using that.
The PWM is pulled up internally in the fan so that it will run at full speed if that pin is not connected (e.g. for motherboards that only support 3-pin fans). Therefore, to control the speed, I need to drive the fan's PWM pin from the PWM output of the PIC.
When testing with a couple of spare fans, I just applied +12V to get the fan running at full speed and then measured the voltage between the fan's PWM pin and GND. On some fans, it seems to be pulled up internally to 3.3V but on the fan I want to use, it's pulled up to 12V. (So I'm glad I measured it rather than assuming they were all the same).
According to the specifications I've found, the fan's PWM should not source more than 5mA (I measured it at only 0.68mA) but having said that the spec also says that the PWM should be pulled up to a maximum of 5.25V within the fan and I measured 12V. The fan manufacturer gives minimal information.
Can I just drive the gate of a MOSFET directly from the PIC's PWM output and connect the drain to the fan's PWM and source to common ground? Is that the "right" way to do it? Is it appropriate to use a MOSFET rather than a BJT? (I'm thinking of 2N7000, just because I have some handy).