This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is there a way to send one PWM output to more than one pin?

I am using the nRF51822 with the s130 softdevice, and I would like to control three RGB LED modules with three PWMs (R, G, and B). For various conditions, either one, two or all three of the LED modules would need to be on, but with the same PWM values. Therefore, I need only three PWMs, but I would need to be able to direct the PWMs to multiple pins simultaneously. Is there any way to achieve this? Thanks!

  • Hi,

    Depending on how your question is angled there are a few different answers.

    First off the answer to your title is yes, you can send one PWM output to more than one pin, by using fork and GPIOTE channels. For the nRF51 you are limited to 4 GPIOTE channels, this means that you will not be able to control all your PWM LEDs this way. If you are using the nRF52 you have access to the PWM module, this will allow use of 12 channels of independent PWM.

    The next option is to connect all the pwm channels through a transistor that you control on/off by using GPIO, however this means that you will use 3 pins per LED for control. Something like shown in this picture:

    image description

    You could also do this where you just switch off the LED entirely, that means 1 control pin per LED.

    You could also use single wire integrated LED circuits like the WS2812B or similar.

    Best regards,

    Øyvind

  • Are there any code examples "using fork and GPIOTE channels"? That sounds useful for my application where 4 LEDs that do the same thing are hooked up to 4 GPIOs.

Related