I just got a batch of 5mm RGB leds, but I didn't notice whether they were Common Cathode or Common Anode. Now I'm a bit confused about the wiring. After looking up information, I'm still not quite sure about the differences in actual usage.
Does the common pin of the common cathode need to be grounded (GND), and the three colored pins need to be connected to the Arduino to output a high level in order to light up?
And the common pin of the common anode needs to be connected to VCC (for example, 5V), and the color pin outputs a low level (0V) for it to light up?
If I use analogWrite() for PWM dimming, do the two types of code also need to be written in reverse? For example, should the luminance value of co-solar be 255 - value?
Also, how can one quickly determine whether the RGB LED in hand is co-negative or co-positive? (Except for looking at the data sheet
Attached are my test codes and wiring methods. Please point them out if there are any errors! Thank you!
I moved your topic to an appropriate forum category @emmamama.
In the future, when creating a topic please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Yes; do not forget a series resistors for for each pin that determines the colour, not for the common pin.
Yes.
No idea. You can measure diodes with a multimeter that has a diode "option"; not sure if it works for LEDs (battery of my multimeter is flat so can't test).
With ordinary single-colour LEDs, the cathode pin is slightly longer than the anode pin, plus there is a flat on the plastic body of the led next to the cathode.
With RGB LEDs, the longest of the 4 pins is the common pin, but it is in the middle of the other pins, not on the far left or right. There is also a flat on the plastic body that seems to indicate the red pin. However, none of these features make it obvious to the eye whether it is a common anode or common cathode led.
If they had designed them a little better, the longest pin could have been on the far left or far right, and the flat could have been on the same side as the longer pin for common cathode and the opposite side for common anode. But, alas, no.
Your DMM should have a "diode" setting. Place the black lead on the "common" pin and the red lead on one of the "color" pins. If the color illuminates, it is "common cathode" because you have forward-biased the color diode with the DMM. If the LED does not illuminate, reverse the leads. If the reversed leads illuminate the LED, you have a common anode. Mark the container for these LEDs... they can be mixed up with WS2812 and APA106 which are not the same architecture.
?
This must be done or you will soon lose that color diode to an over current resulting in an open circuit.
We used to get a lot of questions about this in the early days of this forum.
People would attempt to use a single resistor in the common line, and were surprised when they could only get the red light to come on.
This, of course, was because the red LED having the lowest turn on voltage stopped the other LEDs from turning on as they had not enough voltage across them to turn them on.