[Resolved]- How do I disable the internal RGB LED?

@BDub, do you know if its possible to disable the on-board RGB but allow a mirrored/on-change off board RGB. This would be for battery powered applications. This would save battery by not having 2 RGB’s on.

Thanks

There is not specifically an API for disabling the on-board RGB, but I was going to suggest the same thing Scruffr has, except I was going to initially recommend OUTPUT since it should consume less current than leaving a pin floating… albeit probably not too much to be concerned with. Just a habit of mine to declare unused pins as OUTPUT (LOW) when there is nothing connected to them and I know they are on a PCB with nothing that’s going to connect to them in the future. However in this case, if it’s a Photon, the RGB LED is common Anode and connected to 3V3 so you’d have to define the OUTPUT (HIGH) which doesn’t seem like a great idea. With the P1 my default strategy might make more sense, and unused pins in general. During reset though, those pins will float again, so it’s best to tie off unused pins with an external weak pull up resistor so they have a defined state during reset. Maybe your design can’t tolerate external pullup/down resistors sprinkled in various places if it’s really small or you are conserving every penny on the design.

The RGB LED (and series 1k ohm resistors) on the Photon kind of acts like an external pullup resistor all by itself, so just INPUT mode should be fine! Another way would be to define the RGB pins with INPUT_PULLUP to be redundant (but don’t forget that when using internal pullup or pulldown resistors the pins cannot be 5V tolerant anymore).

It’s good to understand WHY you are setting the pins to a particular mode, because when you design a product you need to think about each pin differently and how it will be used over the life of the product.

// disable on-board RGB LED on Photon/Electron
pinMode(RGBR, INPUT_PULLUP);
pinMode(RGBG, INPUT_PULLUP);
pinMode(RGBB, INPUT_PULLUP);

// disable on-board RGB LED on P1
// also add external 10k ohm pullup resistors on these pins
pinMode(RGBR, INPUT);
pinMode(RGBG, INPUT);
pinMode(RGBB, INPUT);
4 Likes

@BDub @ScruffR thanks for the help and great explanation!

2 Likes

Hello all,
My question is about onboard RGB on Photon, but not quite the same as what is on the post.
Can I parallel another RGB to the onboard RGB? I will draw few milliamps.
I only have A4, A5, and A6 pins available to mirror, I could not figure out if these pins are five volts tolerant. I would appreciate any advice.

Yes, you can use A4 and A5 to mirror the onboard RGB LED as these are PWM enabled.
For A6 the story is slightly different as this is an ADC pin providing analog voltage, which isn’t playing well with driving an LED

BTW, in order to drive an LED it’s of little interest whether they can tolerate 5V being fed into them, you want to drive the LED from the pin and hence you rather want to know what voltage and amperage these pins can supply and for that the answer would be ~20mA@3.3V.

However, there is another option to “mirror” the onboard RGB with only one pin, if you use a NeoPixel or DotStar “smart LED” and RGB.onChange() instead of RGB.mirrorTo().

Thank you for your advice sir. Can I parallel an external RGB LED with the onboard LED? What is the max current these pins can supply?

I will continue working on your idea. DotStar led’s are SMD not as easy as standard 5 mm LED for panel mounting.

I’m not sure whether there are any through hole APA102 (DotStar) LEDs but I know WS2812 (NeoPixel) are also available in a 5mm through hole package.

The onboard RGB LED has a 1k current limiting resistor for each colour attached. The current limit for the GPIOs (including the RGB LED ones) is ~20mA per pin and ~125mA in total.

Sir, am I correct to say NeoPixel LEDs require a data pin as well as an I2C bus total of 3 pins? Unfortunately, my I2C bus is not free.
Your help clarified many things for me thanks

Nope, NeoPixels only need a single data pin - no I2C required.

Thanks, Sir I need to work on the NeoPixels