Picture of Quick & Easy RGB-LED Tester

Have you ever built a project with a lot of LEDs, and found out that one of the LEDs was defective? Although it's somewhat rare, there are some defective LEDs when you go through hundreds of them. I found that RGB-LED have high defect rate, most likely due to the fact that each of them has three LEDs (R,G,B) in them.

I have had a few situations where one of the RGB LEDs was not working fully, and having to desolder to remove it. Here because RGB LEDs have four leads instead of two, desoldering is difficult.

So here's the quick & easy RGB-LED test that I build on a breadboard. You can build this in less than 15 minutes and save a big hassle later!

Step 1: Putting it together

Picture of Putting it together
Here's the part list:

1x Breadboard (small one is fine)
1x PIC16F627, 628A or 648A
1x 0.1 uF capacitor
1x 20 k ohm resistor
3x 220 ohm resistors
3x 470 ohm resistors
3x 120 ohm resistors
some jumper wires
1x 5V regulated power supply or 4x NiMH batteries in a holder

You'll also need a programmer capable of programming PIC microcontrollers, such as MPLAB ICD or PICKit.

As you can see, the circuit & construction is very simple. Once you have the parts, just put them on a breadboard in 5 minutes! Use the picture as the reference.

Then fire up your programmer and you are ready to go.

This unit is made to test common cathode type RGB LEDs, however, it's very easy to change the firmware to test common anode types. (No hardware change needed.) (See the update below)

Schematic and source code (assembly) are provided for those who are interested, but no need to look if you just want to get going with your LED testing...

Update: Source code has been updated to be able to switch between common Cathode and common Anode type LEDs. Change the following line in the source:

COM_ANODE    equ    0


COM_ANODE    equ    1

to make it common Anode tester.

ruguberto1 year ago
Hello i will be glad if i can have your code i drive a PIC 16 F 886 that only has one module but i am really courious how you change the colors thanks in advice
Can we use pic16f690 for the job ???
and how is going to affect to the project ???
ledartist (author)  honey buster3 years ago
I'm sure you can. THe change to the code should be very minor - like changing the header file, and possibly changing the pin assignments.
How would you make them fade in and out?
ledartist (author)  blinkyblinky3 years ago

The PIC has a PWM module, so you can use it. But to fade many LEDs can be hard, and that lead me to develop Aurora 9x18...

I only need two to fade.
Will this circuit work with a 16c711 chip?
duggerpato3 years ago
Thanks! Your instructable just helped me to understand a great deal about how to write a simple program and actually programming a PIC. I had to look up and research the datasheets and other guides to learn how to program. I had to learn about the MCLR function. I had to learn to navigate the PIC software I was using and the process involved there.

This simple project inspired me to learn way more than you would have guessed. I hope I learn enough to be half as good as your skill level. Thanks again. If I wore a hat I'd tip it to you. You'll be seeing my LED projects with a little more flair from now on.

ledartist (author)  duggerpato3 years ago
Great! I'm glad that it worked. Thank you for showing me the result.

Working with actual projects is the best way to learn. Looking forward to seeing your future instructables.


duggerpato3 years ago
Okay, the LEDs were my problem. I just got them from radioshack, and they did not say, but a comment for them says that they are common anode, not common cathode. I wouldn't be able to ask you how to change the firmware to common anode, could I? That would be awesome, because I admit very little knowledge of software writing.
ledartist (author)  duggerpato3 years ago
The change is pretty straightforward. Just reverse the polarity of the LED pins.
I will change the code and upload it here when I have the time...

Awesome. You are a gentleman and a scholar. I look forward to see the code changes so I know how it's done. btw, I'm reading an output off the pic16 of about .5 V on each pin the LED would plug into. Hopefully this is what it is supposed to be :)

Sorry to pester you. As I have mentioned before, this is a big hurdle for me to jump, so I appreciate your time very much. Thanks.

ledartist (author)  duggerpato3 years ago
I suspect that the device configurations are not correct. The new source has the config bits in, so should fix the problem.

ledartist (author)  duggerpato3 years ago
Ok. I uploaded the revised source file. Download and edit the source.
Change the following line in the source:

    COM_ANODE equ 0
    COM_ANODE equ 1

Then make/rebuild and program the PIC.

duggerpato4 years ago
Hey bud I just built this circuit, but have never programmed before. I have a PICkit 2, and imported your hex file into MPLAB software. It appears it took, the hex file shows and everything. BUT, nothing happens otherwise. I have 5 volts at pin 14. I am using a PIC16F628a. Would that mean some small changes for the asm file and hex file?

If I get this working it will be a huge hurdle for me in my attempts to learn to program
duggerpato4 years ago
I may be asking a common knowledge question, but what's the .1 uF capacitor for?

The RGBs I have say typical forward voltage is 3.2 for the green and blue and only 2 V for the red. Does it just depend?

I have a 12V power supply handy, so obviously I will have to change the resistor values and it made me worry what the cap is for and if the PIC chip has a voltage drop I need to worry about.
ledartist (author)  duggerpato4 years ago
0.1uF capacitor is for decoupling for the microcontroller. Most digital ICs need decoupling capacitor to stabilize the oparation.

The voltages are correct as you say - I designed this circuit using LEDs with 3.2V for blue/green, and 2V for red. I adjusted the resistors to make R,G, and B to have visually the same brightness. (within the safe limit)

The microcontroller can only take up to 5V of supply voltage. You will need to use regulator or something to reduce the voltage to 5V. (Over 5.5V can damage the microcontroller)

great this is very helpful. I noticed the brightness of the three were very different on the datasheet so now I understand the differing resistor values. Thanks again!
duggerpato4 years ago
20k ohm throws me off too...
ledartist (author)  duggerpato4 years ago

That's a pull-up for MCLR (reset) pin. This pin needs to be "high" for the microcontroller to run.

awesome, thanks a bunch
duggerpato4 years ago
I was just on microchip.com, which type are you using here? I don't know which package type is which (PDIP, SSOP, etc.) I'm guessing I want the PDIP for this purpose....
ledartist (author)  duggerpato4 years ago
Yes PDIP (Plastic Dual Inline Package) is what you want for this.

May i recomend some bread bord jumpers i broujt two for this project (and others) and good thing about these it dosent matter if you bend one