Emulating the internal RGB LED for an enclosure

So I have a photon project that is in the latter stages of prototype development. And since my device has an enclosure I need external access to the setup button and the rgb led. (I have already figured out how to use the pad on the underside for the button, that was easy). But now I need to know how to wire the the three tiny pads on the bottom for an external led for my enclosure. So far I have built my entire device without a single resistor and I am hoping I can finish this last step without having to do so. So below is an image of the back of the photon and the three pads provided there for rgb output. My question is simple. How do I wire this? I already know that the three anode color leads from the LED attach to their equivalent pads on the back of the photon. But what about the common cathode pin? BTW, HERE is the led I am using. Does it just go to GND? Do I still need to use resistors when all I want to do is emulate the internal LED on the board? I hope it’s just as simple as three pins to color and common cathode to GND. Thanks for the help.

This tutorial is mostly about using the pins for serial, but it also explains how to attach an LED to the pads on the bottom. You will need 3 resistors, however.

There is also mirroring to GPIO pins if that’s useful: https://docs.particle.io/reference/firmware/photon/#mirrorto-

Thank you so much! this is exactly what I was looking for. I do have one question about your wiring. So far, everything on my project is 5v, but I noticed when you wired in the led, you wired it from the 3.3v output. Is that necessary or will it work at 5v?

Thank you so much for reply. Although I may want to do it in the future, I want to implement this in hardware so it works regardless of the firmware state on the photon.

5V will work as well, though you may need a larger resistor. You can use the formula or any of the handy LED resistor calculators on the Internet, like this one.

Depending on the LED you might not get it to shut off with 5V —>|— 3.3V - if you pick one with a forward voltage drop < 1.7V you might get unexpected results.

1 Like

I have a similar application and I use a “RUGGED METAL PUSHBUTTON - 16MM 6V RGB MOMENTARY” from Adafruit (https://www.adafruit.com/product/3350). No additional resistors needed and I drive it directly from my Photon. I use the button for RESET and not SETUP. The only issue I have is the “breathing cyan” does not render correctly and looks more like breathing green. I use the external LED change handler routine and use D0, D1 and D2 for R, G and B.

I cannot find the datasheet of the LEDs used in this button, but the fact that it works is no guarantee that it is safe.
You may well put some strain on the GPIOs which won’t blow them immediately but still shorten the life time of the GPIO or even the device.

The max current rating for each pin individually is given with 25mA and 120mA total with several pins simultaniously sourcing or sinking current.

The distorted colour may well come from the difference in current due to different forward voltages for different color LEDs.

1 Like

Thanks everyone for all your replies. I tried it with an RGB LED soldered to the pads, but didn’t really like the colors. I also didn’t like having to solder to those tiny pads. I ended up mounting the photon to the bottom of the enclosure and using a light pipe and am pretty happy with the results. But the button pad, pin 26 works just as I needed it to.

Thank you @rickkas7 Your linked post gave the exact answer I needed on how to use the pads, although I ultimately opted against that solution.

By the way, in system firmware 0.7.0 you can mirror the SETUP button onto another pin, as well. You can even enable it to work from the boot loader.

2 Likes

The problem may arise because the RGB switch uses a single resistor. As such they are not really suitable as an RGB display with accurate or even reasonable colours. While they are perfect if you only want to display one of three primary colours mixtures are highly compromised.

I have found a similar switch without internal resistors (supplier ONPOW on Aliexpress).

The red led has a voltage drop of 1.7v whereas the Blue and Green are specified as 2.8v.
The switches also come in Common Anode or Common Cathode form.

I am using RGB.mirrorTo to map the led signals to PWM output pins. I experimented with the resistor values and found that Red 680 ohm, Green 470 ohm and blue 220 ohm gave colours that are acceptable - in paricular white and yellows that are white and yellow not reddish white, blood orange etc.

The colours can, of course, be manipulated by changing the intensity of each colour when under user control but this method does not correct system mode.

The only issue I have now is that the mirror does not work during startup. This is not an issue for my application (a medical data logger) since I disable wifi to conserve battery power. The leds are mirrored when I subsequently enable wifi and connect. It would be nice however to be able to see the leds during software uploads without opening the case. Not sure whether this is being enhanced in 0.7 update.

Does 0.7.0 mirror the leds during startup?