PWM leading and trailing edge sloping

I read an article (https://www.ekwb.com/blog/what-is-pwm-and-how-does-it-work/) about controlling fan speed using pwm. They recommend leading and trailing sloped edges to drive fans to avoid a clicking noise from too-low duty cycles.

I am driving 12v/18W LED strip through a 3A FET and will monitor its temp with and without the fan.

It seems reasonable that leading and trailing sloped edges might be an advantage (for the fan), but I'm not knowledgeable enough to judge it.

FOR loops are easy enough to write, but should I?

I could run the fan and LED strip off the same FET, with sloped edges.
Are sloping edges contraindicated for LEDs?

Zip_Ferndale:
It seems reasonable that leading and trailing sloped edges might be an advantage (for the fan),

The purpose of sharp leading and trailing edges is to ensure that the transistor is either fully on or fully off so that the amount of energy it must dissipate is minimised. If it spends any appreciable time in the transition phase the transistor will heat up and might be destroyed.

Of course not all electric motors are suitable for being driven by a PWM controlled power supply.

An analog power control circuit would generally be bigger and more expensive as it would have to be designed to dissipate a lot of energy. And the details are well beyond my pay grade.

However a digital device like an Arduino can only produce HIGH or LOW outputs and if you did have a suitable analog power control circuit you would need some sort of digital-to-analog converter between the Arduino and the power control circuit.

...R

There are ways that you can emulate a ramp up. Say for example you want to switch pin9 to 70% with a ramp of 10 (the number of intermediate phases). Develop a little function similar to this:

ramp_pwm(9, 70, 10);

void ramp_pwm(byte pwm_pin, byte duty_cycle , uint16_t ramp)
{
    if(duty_cycle > 100) duty_cycle = 100;    // sanity checks
    if(ramp > 255) ramp = 255;

    byte pwm_final = ((((int)duty_cycle * 255) + 50) /100);  // the +50 is for rounding

    for (byte step = 1; step < ramp; step++)
    {
        byte pwm_ramp = (int)((step * pwm_final) / ramp);
        analogWrite(pwm_pin, pwm_ramp);
        delay(2);  // PWM @ 490Hz, allows 1 full cycle, otherwise loop is too fast
    }
    analogWrite(pwm_pin, pwm_final);
}

You need to be careful here though, while the RMS value of a square wave is Vcc * duty_cycle, you are no longer dealing with a pure square wave. The RMS calculation would need to include the sawtooth portion (the slopey bit) at the front and the value of the remainder of the duty cycle. We can get into that in more detail if it interests you. In reality, unless you choose a long ramp it won't amount to a whole bunch, and a few test runs while tweaking is probably easier than the math.

DKWatson:
There are ways that you can emulate a ramp up.

Have I completely misunderstood the OP?

I thought his concern was that an individual PWM "pulse" would put an excessive stress on his motor?

...R

I realized after writing Reply #1 that I had not mentioned the PWM frequency. The standard Arduino PWM frequency is about 490Hz. It is possible to change that but it is not a regular Arduino feature. I can't recall what is the practical upper limit for an Arduino.

Some motors work better with higher PWM frequencies - maybe even as high as 30kHz.

...R

Robin2:
Have I completely misunderstood the OP?

I thought his concern was that an individual PWM "pulse" would put an excessive stress on his motor?

...R

My assumption was that the issue was the sudden 'ON' of the duty cycle, similar to the pull-in torque for a stepper motor.