I have wired up a common anode rgb led to my raspberry Pi. I dont understand why its not lighting up. My setup is this:

  1. 5v to rgb anode
  2. rgb to pi pins ( 5,6,26)

My code is

const Gpio = require('pigpio').Gpio;
const ledR = new Gpio(6, {mode: Gpio.OUTPUT});
const ledG = new Gpio(5, {mode: Gpio.OUTPUT});
const ledB = new Gpio(26, {mode: Gpio.OUTPUT});
var dutyCycle = 200;

I even tried setting dutyCycle to 0. What am I doing wrong and how should I fix it?

enter image description here enter image description here

Kind of hard to take photos because of the raspberry pi explore hat.There is red and green wire coming from gpio 5,6 and the blue wire coming from gpio 26(far right). The power is coming from the red wire(far left). If one of the gpio pins were loose (gpio 6 for red) would that stop the whole led from working?

  • I also have resisters (200ohm) going between the gpio pins to the rgb pins.
    – sirshakir
    Feb 21, 2019 at 20:05
  • I am using nodejs pigpio library
    – sirshakir
    Feb 21, 2019 at 20:06
  • Add a photo of your wiring. Edit your question rather than commenting.
    – CoderMike
    Feb 21, 2019 at 20:18
  • 1
    Don't use 5V for the anode. That will feed too many volts back to the Pi GPIO. Try using 3V3. Could you just use the pigpio pigs command from the command line to check the LED? E.g. pigs w 5 0 w 6 0 w 26 0 should switch the LED full on.
    – joan
    Feb 21, 2019 at 20:54
  • No luck. I turned the pi off and removed the hat. I set my multimeter to diode node and attached one cable to anode and other wire to each of the rgb pins. The led lit up red,green or blue depending on what wire I touched. So I know my led works. Im starting to think it's a coding problem now
    – sirshakir
    Feb 21, 2019 at 21:44

1 Answer 1


Fixed, the led was a cathode. It was labeled as anode.

  • Troubleshooting tip would be to pull the lead off the GPIO and connect it to ground pin. Still no light? Then it's not the Raspberry Pi. One more tip for experience.
    – gbarry
    Feb 22, 2019 at 1:26

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.