2

I have some LEDs that are Bi-Color so if you make a circuit like this:

[+]-----[LED]-----[-]

you get one color, and if you do it the opposite:

[-]-----[LED]-----[+]

You get the other color.

I am wondering what is the appropriate way to wire this to the Rasberry pi? Thus far I've only powered "normal" LEDs and I've always done something like this:

[GPIO]---[RESISTOR]---[LED]----[GND]

The only way I can imagine wiring up one of these dual LEDs something like this:

[GPIO1]----[RESISTOR?]---[LED]----[GPIO2]

And then put GPIO1 to high, and GPIO2 to low, or vice versa to get the different colors.

My question is will that damage the board in some way to connect two of the GPIO pins together in a circuit through the LED. Additionally should I include resistor(s) in the circuit? and if so where? Does there need to be one on either side of the LED?

2 Answers 2

3

yes, your wiring looks pretty good

[GPIO1]----[RESISTOR with LED]----[GPIO2]

you need only one resistor, same value you use when connecting a single color LED, it may be on the either side, this does not matter. just keep in mind, the GPIO pins cannot source a lot of current, you'd better keep it within 10mA (or lower) to be safe. I'd start with a 2k2 resistor and then go lower if you need additional brightness, but don't go below 500ohm.

2

As long as you stay do not exceed the specified current of the GPIO pins, wiring it that way is correct, and it doesn't matter on which side you put the resistor: https://electronics.stackexchange.com/questions/13746/why-does-a-resistor-need-to-be-on-the-anode-of-an-led

You must include the one resistor, in order to not short the two GPIO pins, as the LED has very low resistance. You can use a LED resistor calculator to determine the resistor value: http://ledcalc.com/

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.