Independent 25kHz PWM controller for Arduino
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Independent 25kHz PWM controller for Arduino

by Rampage on Wed Feb 13, 2019 10:40 am

For the purpose of clarity, I want to define the following terms I will use in this post (and replies) as:
  • Arduino - In addition to obviously referring to the Arduino it also refers to anything else that is not a separate unit, i.e. a real-time clock. (that will make more sense further down -- this distinction may not be needed but I wanted to include it in the original post in case it becomes relevant later).
  • controller - The solution I'm asking for (a chip or a combination of chips, etc).
  • module - Any device or chip not part of the Arduino (as defined above, this refers is more than a basic Arduino). Examples are the controller (as defined above) or a temperature sensor.
  • project - Everything, including the Arduino, the controller, and all modules.
  • fan - A PC-case-fan-style fan or a PWM channel, depending on context.

I'm planning a project. The project will be modular and allow the user to connect from none to many modules. One of these modules should be able to control fans. I only am concerned about a 5V PWM signal (see data sheet below), the power supply will be external (it will be supplied passively by the finished controller board). Because the Arduino will be doing other non-fan-related things I want to offload this task to another chip.

Note: I'm still fairly new (as in experience) to electronics but am a programmer by trade. I'm not too concerned with the code side of this except for making sure that a library exists and that there's an example of the basics of using the library (talking to it, handling multiple units, etc).

Fan's PWM Specs: https://noctua.at/media/wysiwyg/Noctua_ ... _paper.pdf (Note specifically that it needs a 25kHz PWM signal)

Other than being able to meet the specs in the above white paper I have listed the requirements below. I apologize that the list is quite long, but it's what I need. I realize a second Arduino could be used but I'm trying to avoid it due to cost and complexity concerns.

  • The controller should not require a constant signal from the Arduino to send a signal to the fans.
  • Multiple chips may be used, i.e. one to send PWM signals and one to send a constant signal telling it what PWM signals are needed.
  • The fans may not be physically near the Arduino though they would be in the same room. This makes I2C unreasonable.
  • The controller can either be placed near the fans or near the Arduino.
    • Having both options be up to the user with no changes is preferable but not required.
    • If having to choose, near the fans is better because I don't think fans like being far from their power source (and the controller is passively supplying the power as well via the 4 pin fan header). Fan cables are also usually pretty short.
  • The controller will have to be able to communicate wired with the Arduino over a reasonable distance (max ~30ft).
  • The controller needs to use as few pins on the Arduino as possible.
  • The chip(s) should be fairly inexpensive.
    • Maximum cost should work out to $2/fan or $10, whichever is greater.
    • I prefer a controller that can control fewer fans because it's unlikely to have more than 4 fans close enough to use the same controller reasonably. Max reasonable in one place is probably 6. That, in my opinion, makes 4 ideal. If cost is reasonable (<=$10) I could simply ignore/not use the extra channels.
    • Using more than 1 chip per controller is acceptable, but cost cap still applies (so using 2 chips that can control 2 fans each is fine, but the max remains ~$10).
    • As italics on the word "chips" may have implied, the above costs refer specifically to the chips. So if an $8 chip on a breakout board is $12 it's still considered under $10.
    • Prices are not set in stone, I'd rather pay a little more and get something that fits than pay less and fall short. It's just to provide a general idea of what I expect to pay.
  • The controller should be expandable/chainable.
    • This could be done by chaining more controllers in series or via some other means, so long as more pins on the Arduino are not consumed.
    • Using a second chip to make more pins available is acceptable but only one such chip should be needed, it would then be its own module separate from the controller and should/would be located near the Arduino.
    • Via expansion the controller should support at least a total of 20 fans, more is a bonus. Realistically it should never be more than 50.
  • Should default to 100% duty or last setting (see below).
  • Able to remember the last settings used even if power is cut.
    • Technically optional but highly desired.
    • This serves the following purposes.
      • The primary purpose is so that if there is a minor power outage the fans resume what they should be doing as quickly as possible.
      • The fans could be doing anything, even things unrelated to cooling. While an on condition is probably a good fail safe a large portion of the time, it's very possible that an on condition is highly undesirable.
      • The secondary purpose is just a convenience for moving the controller, etc.
    • Permanent (i.e. flash) memory is preferred but not required (that would be for convenience).
    • Battery-backed (button cell) volatile memory (like an RTC uses) is fine (still in the realm of convenience).
    • A hold-up capacitor is perfectly acceptable as long as it can keep the settings alive for hours (hours is a necessity, days would be better but that's just convenience).
    • A solution to do this if the chip cannot do it natively is fine. The solution should not add significant (more than double) cost.
    • If excluded (due to cost/complexity) there should be a way for the user to select a default on/off state, either via programming (that is non-volatile) or hardware (jumper, resistor, etc).
    • If using a power-based back up it can and should stop sending a PWM signal upon power loss (I don't know what the fans will do if they stop getting power but continue to get a PWM signal).

Optional Controller Features (nice to have, but not absolutely needed)
  • Configurable frequency per chip, so I can use one solution for more than just fans (I have other PWM needs, but they are far more basic/typical - so this is only useful if the solution is comparable in price to other basic PWM chip solutions).
  • Configurable frequency per channel (or group of channels), so it can do more than just fans, but can still run fans too (useful regardless of price). Should default off in this case, unless it can (natively or via alternative solution) remember the last settings used after a loss of power (measured in days).
  • Able to be natively (no pull-up) powered by 12V (just nice to have). (Extra Bonus: Also accept 5V [5V-12V] to make prototyping easier)

Posts: 1
Joined: Wed Feb 13, 2019 8:59 am

Re: Independent 25kHz PWM controller for Arduino

by adafruit_support_mike on Fri Feb 15, 2019 6:39 am

For that list of features, it would probably be easiest to use a small microcontroller.

Even one as simple as the ATtiny10 (SOT-23-6, 27c in lots of 100) has a 16-bit clock that can generate PWM. It has a 12MHz clock, which is enough for 450 PWM values at 25kHz.

You could also step up to a 32-bit microcontroller board like the Trinket M0:


Its clock speed is 48MHz, which will easily give you 10-bit PWM at 25kHz. It has a Serial interface, six remaining GPIO pins, and an external Flash chip for additional nonvolatile storage.

As-is, the Trinket M0 is overspec'd for some of your requirements and underspec'd for others. You can use the general hardware design for a board of your own with 5V level shifting, a voltage regulator suitable for the input range you want, and no external storage. The internal Flash array should be more than enough for the data you want to store.

Posts: 57106
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.