PIC16F628 Serial 8 RGB LED Controller

January 31, 2006

This code is for a simple RGB LED controller for 8 LEDs using a PIC16F628. It is controlled by sending 3 bytes to the internal USART for the red, green, and blue color channels. The operation is very simple and so is the wiring. The PIC selects each LED then turns on/off the respective colors then goes to the next LED. Because of persistence of vision, the eye sees the LEDs as all being on at the same time.

The microcontroller code can be downloaded here:
u8RGBm.jal (hex) (less optimized but higher refresh rate)
u8RGBm2.jal (hex) (better optimized but lower refresh rate)

Sample VB code and test application: 8RGBblinkenlightsDR1r1.zip

  1. Francesco
    November 16, 2006 at 2:40 PM | #1

    Hi Steve!

    I’m definitely going to build this little and easy project, my son will love it!
    Could you please link the schematic page with a bigger picture? The other led project has this link functioning.

    Keep on designing!

  2. djeli
    December 12, 2006 at 5:40 PM | #2


  3. ahmd
    December 16, 2006 at 1:51 PM | #3


  4. EVE
    May 4, 2007 at 12:53 PM | #4

    I just found something like this fromk

    Lunar Accents

    but it is better here!!!

  5. May 4, 2007 at 3:42 PM | #5

    #4 (EVE) – Thanks! I’ve looked at the Lunar Accents website and they have some interesting industrial LED applications. A number of other manufacturers are creating similar products due to the widespread interest in LED lighting. I enjoy creating hobbyist projects and applications and sharing them as much as possible.

  6. Jaxon
    July 10, 2007 at 7:47 AM | #6

    How about 10 LEDs each channel, using manual dial to control color?
    I don’t have the device to program PIC.

  7. rudi
    January 18, 2008 at 4:44 PM | #7


    Great idea, but where do you get RGB LEDS ?!


  8. Andre
    June 22, 2009 at 2:40 PM | #8

    I’m looking to get the library but I cant find them, help please :(

  9. Rafael
    September 11, 2009 at 10:14 AM | #9

    Hi Steve, great job, thank you very much for share it…!
    I´m almost a beginner in electronics and I´ve built the circuit successfully and It looks awesome…!
    So far my programming knowledge allow me to build 16f628 based sequencers (up to 15 channels as I don´t know much of multiplexing).
    I´d like to add other effects, like blinking three times red, three times green, three times blue, and others sequences. Is it possible to add three more led in paralell to make 4 x 8 channels? Can you help me with this…?
    Thx in advance


  10. ????? ???????
    October 16, 2009 at 2:46 PM | #10

    ? ? ???? ???????? :) ??? ???? ??? ??? ??? ????? ????????? :)

  11. Lawrence
    March 1, 2011 at 3:36 PM | #11

    Hi Steve,

    Just put together your project. Nothing happens. No LEDs light up. It could be many things but I think the RS232 connection to my very old is not working If I read the EPROM directly, it is full of FFs. Do you have somewhere a test program that just eluminates the LEDs with a default value. Many thanks in advance

  12. Lawrence
    March 5, 2011 at 7:05 AM | #12

    I must correct my last post. The problem is not with the RS232 interface. This is working ok. The problem is that I didn’t connect the RGB LEDs which are made by Kingbright correctly. There are 6 connections and not 4. Sorry for the misleading post.


  13. hubert
    June 5, 2011 at 6:20 PM | #13

    Cool Project…
    But it doesnt compile with actual JAL V2.4n compiler and actual Jallib.
    So I will use your Code for learning purposes and try to rewrite it for the new Jallibs.
    I used a PIC 18f2550 and USB instead of RS232. Since my version doesnt run smoothly I now changed to use a Pic18f14k50 and an TLC5940 PWM Chip. It doesnt work well, yet, but when it is working well I will tell you.

  1. March 2, 2008 at 7:09 AM | #1
  2. January 25, 2010 at 7:28 PM | #2

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>