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:
Will software PWM consume more power than native hardware PWM? If so, by how much?
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.
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.
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.