2

I'm looking at the WS2812B LEDs and I've noticed that it is possible to control the LEDs by an external library (https://learn.adafruit.com/neopixels-on-raspberry-pi/software). But, this only drives a single one meter strip. But, is it even possible generate multiple PWM signals using an IO Expander and address the PWM to certain ports of the IO Expander? If not, why?

1
  • 1
    The WS2812 is not controlled with a PWM signal. The Raspberry Pi library is using (or perhaps abusing) the PWM module to send 800kHz serial data to the LEDs
    – Craig
    Dec 15, 2014 at 22:38

2 Answers 2

2

That depends on the model of Pi you have.

The Pi's PWM peripheral is used to generate the proprietary signals needed by the WS2812 (which are NOT PWM). The peripheral has two channels so if your Pi has gpios which can be connected to the two channels you could drive more than one strip.

The gpios you need are 12, 13, 18, or 19. Gpios 12/18 are channel 0, 13/19 are channel 1.

Actually the strips may be chainable (some are, you need to check) in which case you could control several strips from the same gpio.

1

You cannot convert any IO pin to a PWM pin.

You can definitely use another Integrated Circuit to get 16 PWM channels.

Take a look at NXP PCA9685 16-channel, 12-bit PWM Fm+ I2C-bus LED controller.

From the description: "The PCA9685 is an I²C-bus controlled 16-channel LED controller optimized for LCD Red/Green/Blue/Amber (RGBA) color backlighting applications. Each LED output has its own 12-bit resolution (4096 steps) fixed frequency individual PWM controller that operates at a programmable frequency from a typical of 40 Hz to 1000 Hz with a duty cycle that is adjustable from 0 % to 100 % to allow the LED to be set to a specific brightness value. All outputs are set to the same PWM frequency."

Block Diagram

If you are not interested in designing your own, you can look at this product from adafruit.

enter image description here

Hope that this fits your needs.

1
  • 1
    The PCA9685 may be OK for general PWM (although the PI can generate more flexible PWM on all the gpios, not just the 16 outputs supported by that board), but they are no use in driving a WS2812.
    – joan
    Dec 15, 2014 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.