PIC PWM Fan Control Project

Discussion in 'The Projects Forum' started by Chardi, Apr 22, 2016.

  1. Chardi

    Thread Starter New Member

    Oct 3, 2015
    Hey all,

    I am trying to build a physical display for an audio spectrum analyzer.

    Here's a youtube video of what I'm trying to achieve (or search "Physical Display Audio Spectrum Analyzer" and you should find a similar one):

    I found out that I need to use PWM fans to have the varying speed of the fans working. I am using an optoisolator 4N26 (isolate the frequency from the audio signal/filters from interfering with the frequency of the fans) and a MOSFET 2N7000 to drive the fan.

    Heads up, it is not a MOSFET symbol in the pictures, but my connections are as such : Collector = Drain ; Base = Gate ; Emitter = Source

    This is what I have working:
    • LED lighting up/dimming with this circuit (PIN1 of the optoisolator is the PWM output of the PIC)

    I bought this PWM fan to try things out: FFC0912DE-TP04/Digikey part#: 603-1207-ND

    Based on the datasheet, the yellow line is the PWM wire.

    My problem is that either the fan stays at max. speed, no speed or it seems to run like how it should be, but it never reaches its max. speed nor its min. speed (this problem only occurs when I connect the PWM line to PIN6 of the optoisolator)(I know it doesn't reach the min/max as it is rated to be 1.5A, but it only reaches 0.5A).

    Here are the various connections I've tried so far:
    2.PNG 3.PNG 4.PNG

    Actually, I would be lying if I said that I didn't connect the yellow line to pretty much every pin out of frustration.
    If there is indeed a PWM signal coming out of the MOSFET (I have visualized the waveform on an oscilloscope, but I don't have pictures), why isn't the fan responding to the signal at all?

    I'm assuming that I don't have the basic principle of how a PWM fan works. Any help would be great!

    Thank you in advance!
    • 1.PNG
      File size:
      11.3 KB
  2. Picbuster


    Dec 2, 2013
    The 2n7000 is, in the drawings without led, in full conductance connecting + 12 to gnd.
    look for FFC0912DE-TP04.pdf on internet and follow the spec's
    Chardi likes this.
  3. Sensacell

    Well-Known Member

    Jun 19, 2012
    I cannot make sense of your schematics- looks like you have the FET connected across the supply- shorting it when its on?

    You should drive the FAN PWM input from an open collector output.

    The opto-coupler seems unnecessary?

    Measure the voltage from PWM input to fan GND, it will probably be around 5V with power applied.
    if you connect the PWM to GND the fan should stop running, leave it open and it should go full speed.

    Do this first, if it's not behaving as predicted- you may have damaged the fan.
    Chardi likes this.
  4. Chardi

    Thread Starter New Member

    Oct 3, 2015
    Thank you for pointing this out. I did not realize that I was pretty much shorting the supply. Although the datasheet isn't too helpful, I figured out my problem!
  5. Chardi

    Thread Starter New Member

    Oct 3, 2015
    Yes! I realized that I was indeed shorting it. My mentor for this project really seems keen on using optoisolators for this project, so I'll leave them in the circuit.

    Thank you for pointing out that I should use an open collector output circuit! I've connected a 1k resistor from power to the drain pin as well as the Yellow wire from the fan to it. Also, the Gate is now connected to PIN5 of the optoisolator (also with a 1k resistor between +5VDC and PIN5).
  6. dannyf

    Well-Known Member

    Sep 13, 2015
    It is a miracle that your mosfet survived, :)

    I would do a few things:

    1) confirm that your PIC can generate pwm signal - you cannot take it as a given right now;
    2) look up the datasheet to see how the fan works. Specifically, how the pwm control portion of it works.

    After that, you can start to put the two together.