Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. PWM on PC Fan

PWM on PC Fan

Scheduled Pinned Locked Moved General Discussion
6 Posts 4 Posters 3.6k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cedru
    wrote on last edited by
    #1

    Hello,

    i'm sorry if my english isn't very good. I want to know if it is possible to control the speed of a PC fan with PWM function.

    Cedric

    1 Reply Last reply
    0
    • AWIA Offline
      AWIA Offline
      AWI
      Hero Member
      wrote on last edited by
      #2

      It will depend on the type of fan you use. Most of the fan's are 12v and some of these have a separate control/ pulse line.
      Should be easy with mosfet and pwm

      "Anything" can be controlled with MySensors

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cedru
        wrote on last edited by
        #3

        I'll use fans with 4-pin. I understand that I must use a PWM signal of 25kHz.

        YveauxY 1 Reply Last reply
        0
        • siklosiS Offline
          siklosiS Offline
          siklosi
          wrote on last edited by siklosi
          #4

          I have MySensors project that has PWM and fan 60mm 12V. Problem is with high frequency noise coming from the fan caused by PWM. I solved this by puting 2200uF electrolytic capacitor. Down side is that when you set pwm at about half in my case fan works at 100% but you can map value to 0-120 instead of 0-255 for pwm and it will work OK. I started with lower values of capacitor until noise disappeared and then tested where is 100% of speed vs PWM value.

          1 Reply Last reply
          0
          • C cedru

            I'll use fans with 4-pin. I understand that I must use a PWM signal of 25kHz.

            YveauxY Offline
            YveauxY Offline
            Yveaux
            Mod
            wrote on last edited by Yveaux
            #5

            @cedru 4pin PWM fans are easy to control.
            Only gotcha is setting the arduino PWM frequency to 25KHz.
            One solution is to install the TimerOne library by Paul Stoffregen. You can find it here.
            Include it in yout sketch and initialize the PWM in the setup() method:

            #define PWM_PIN (10)
            #define PWM_FREQ_HZ (25000) 
            #define PWM_CYCLE_US (1000000/PWM_FREQ_HZ)
            
            Timer1.initialize(PWM_CYCLE_US);
            Timer1.pwm(PWM_PIN, 1023); 
            

            Then change the duty cycle whenever you want:

            int16_t duty = 123;
            Timer1.setPwmDuty(PWM_PIN, duty);
            

            http://yveaux.blogspot.nl

            1 Reply Last reply
            1
            • C Offline
              C Offline
              cedru
              wrote on last edited by
              #6

              perfect !

              a big thank you from France

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              18

              Online

              11.7k

              Users

              11.2k

              Topics

              113.1k

              Posts


              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular