Hardware vs software PWM power consumption?

Hi all,

I'm working on a project where low current consumption is critical. I want my device to last as long as possible on battery power. That said, I have two RGB LEDs and an I2C LCD. The RGB LEDs will be connected to non-PWM pins for various reasons, so I have to resort to software PWM.

For reference, I'm using a SAMD21G17 microcontroller and building this all on a custom PCB. The RGB LEDs will be used for simple indication and some effects like flashing or slowly swirling through colors. Nothing crazy.

Now, I'm only a novice hobbyist so I don't know the difference between hardware and software PWM. So my questions are:

  1. Will software PWM consume more power than native hardware PWM? If so, by how much?
  2. Will I be able to scroll text on the LCD while using software PWM on the RGB LEDs? I heard software PWM throttles the CPU quite heavily. I think something as simple as scrolling text while swirling through colors should be fine since it's such a simple task but I want to make sure.

Thank you all.

I really cannot properly answer your question without your code. What you can do and how fast it will respond is entirely dependent on your code. The current consumption would be about the same unless you put it to sleep. The cpu will keep running and executing your instructions regardless if the PWM is hardware of software.

Probably not, your load that you are PWMing will consume more current.

If you use hardwarePWM, probably not.

  1. What is your project?
  2. How long do you want it to work on one charge?
  3. Will the LEDs be operating ALL the time?
  4. What is the power consumption of the LEDs?
  5. Will the LCD display be operating ALL the time?
  6. Can your project go to sleep and turn all peripherals OFF at times?
  7. What other devices are you using that you cannot use PWM pins?

Thanks... Tom... :smiley: :+1: :coffee: :australia:

Will software PWM consume more power than native hardware PWM? If so, by how much?

I would guess that the difference between HW PWM and SW PWM is much less than the power consumed by the LEDs themselves.
The really low-power modes for most CPUs turn off the clock to most or all of the peripherals, as well as the CPU, so using HW PWM would probably prevent you from being able to use the best low-power modes.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.