I need to control several (5 to 10) analog RGB strips which have a separate power supply at 12V or 24V. Just like this one for example. I need to control the intensity of each colour channel for each strip. The producer says to use any NPN or N-channel MOSFET; I think that a PWM signal per each color per each strip will be necessary to drive the mosfets.

I have tried to find a system that will allow me the least load on the raspberrypi processor (so it can process inputs with no delay) and an easy implementation, and found that I could:

  • Build my own extension board using PWM output with mosfets, and using a software library (pi-blaster) to generate extra PWM; apparently too heavy on the processor and not enough GPIO pins;
  • Use the leading standard DMX (expensive parts and unnecessary complication?)
  • Use an I2C i/o expander (MCP23017 ?);

The latter seems most appealing, which solution would be best and easiest? I welcome pre-soldered kits / external controllers but I just want to know which way to go, I just want to dive into the software part of this project .... but I want to start with the right technology.

I'm a noob in electronics, if some of this doesn't make sense please comment to help me get the question straight.


Here is the hardware I ended up choosing, for reference.

  • @Gerben's suggested shield [Raspberry Pi - I2C 32 Channel PWM / Servo Board] based on PCA96852
  • Transistor MOSFET STP16NF06 (1 per pin i.e. 3 per strip)
  • 5m 12VDC 5050 SMD RGB 300-LED Strip Waterproof IP65
  • a breadboard, wires, 12V - 5A power supply
  • a box of Lego bricks to build a case for the prototype
  • If you want any help you need to tell us what the various analog RGB strips require as input.
    – Milliways
    Commented Feb 6, 2014 at 10:01
  • 1
    It sounds like two TLC5940 would do the trick, or read the related questions on the right. I was recommended to use shift registers but they don't do the PWM for you.
    – francis
    Commented Feb 6, 2014 at 16:00
  • 2
    PCA9685 is an I2C equivalent of the TLC5940. At first glance it seems the TLC5940 needs an external signal as a clock. So the Pi would still need to do something, even if the values don't change. But I could be wrong here.
    – Gerben
    Commented Feb 6, 2014 at 20:25
  • 1
    – Gerben
    Commented Feb 6, 2014 at 20:29
  • 2
    Just note that you'd still need the mosfets as the PCA9685 can only sink about 25mA, and because the led strip is 12V instead of 3.3V/5V. The adafruit board already has the needed pull-up resistors on the board, which is handy. But you can't re-use the power line. The MCP23017 doesn't do PWM, so I don't see the similarities.
    – Gerben
    Commented Feb 7, 2014 at 13:02

1 Answer 1


If you prefer a ready-made solution, Gerben's suggestion in a comment to use a PCA9685 is an excellent. Apparently, Adafruit offers an affordable PCA9685 breakout board.

Alternatively, an Arduino (or just an ATMega8), which you could control from the Raspberry via SPI or I2C, might be used to generate the PWM signals and drive the MOSFETs.

EDIT: Gerben made a good point that 1 Arduino alone is not able to generate the number (5-10 or more) of independent PWM signals in hardware and that it's therefore necessary to implement that in software.

I realize that this is not arduino.stackexchange.com, but it might be worth mentioning that ShiftPWM, using an Arduino and a bunch of 74HC595 shift registers might do the job once the MOSFETs are added.


Your Answer

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

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