PIC16F628 8 RGB LED Controller

January 31, 2006

This code is for a simple RGB LED controller for 8 LEDs using a PIC16F628. The pattern is determined by the data in the EEPROM. Upon startup, the controller loads the data into RAM and starts up the sequence. 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. Currently the max number of display patterns is 20 (because the bank array is 80 bytes and each pattern is 4 bytes).

The microcontroller code can be downloaded here:
8RGBRAM.jal (hex)

  1. helio
    December 23, 2006 at 5:37 PM | #1

    ola amigo estou a procura de controle de leds rbg com pic 12f629
    grato a todos
    helio atibaia são paulo brasil
    que tenham um feliz natal a todos

  2. January 3, 2007 at 5:11 PM | #2

    helio – It is very easy to control an RGB LED with a PIC12F629. Please see (for example): http://www.semifluid.com/?p=8

  3. Mateus
    February 10, 2007 at 11:03 AM | #3

    Do you know if this is the model used in Led Lights for pools?

  4. Solar
    April 28, 2007 at 11:16 AM | #4

    What do you think about using PIC16F628 to control individule circuit board? It seems impossible for me but people from Lunar Accents said they can do it with their program!!!

  5. April 29, 2007 at 3:34 PM | #5

    #4 (Solar) – What do you mean by using a PIC16F628 to control individual circuit boards? If you mean a master and multiple slaves, then yes it would not be a problem. As long as you use a multidrop bus then it would not be difficult to create a system that controls multiple lights. You could even do long-distance control using RS485 converters and wiring.

  6. alain
    May 10, 2007 at 1:45 PM | #6

    hi, nice circuit, im building a pov and using one color led, hopefully, your schematic gave me an idea to make a tri color pov toy. do you have the source code in .asm format. thanks


  7. Don
    June 22, 2007 at 3:05 AM | #7

    Can someone post a video to this? It seems like the red LEDs stay on and the green and blue chase each other in the .hex example. Is this correct?

  8. RadU
    November 8, 2007 at 6:10 PM | #8

    What i can do with that Code? The circuit it`s does work self? Were i need That code???Please tell me !!!!!

  9. Jerry
    February 16, 2008 at 8:34 PM | #9

    Just curious what is the voltage required for each LED? Or What is the voltage on each of the pins?

  10. john linabury
    September 19, 2008 at 1:31 AM | #10

    I built a backlight for a wall hung LCD clock and used 8 RGB’s. Then i stumbled on this wonderfull circuit, Thank you very much…. It just so happened that I hadf an extra 16f628 and the project works wonderfully. I was wondering if you had any other HEX codes for the non serial version? what I have is 4 RGB’s down each side of the display, i would like to make them all change color at the same time or change in patterns of 4(so 2 RGB’s are the same color at the same time) I’m new to PIC programming so I would appreciate any help. Thank you for your time

  11. Davidp0
    April 6, 2009 at 9:27 AM | #11


    Where can I find the Bank_arrays_ins.jal librairy, for this very cool project?



  12. Rafa
    May 9, 2009 at 10:34 AM | #12

    Hi..! Can you post the source code with some comments or explanations..I´d like to make others effects. Thx in advance

  13. Galiza
    November 5, 2010 at 4:03 PM | #13


    I’m trying to build a rgb led POV, but I don’t know in what frequency the engine has to spin
    to produce an image by POV, and don’t know how to control what word will appear…can you help me? I mean, with the schematic and the code shown, can I make one of this things?
    (I’m a rookie in eletronics/PIC programming)

    Filipe Galiza

  14. pavan
    November 12, 2010 at 12:34 AM | #14

    @Galiza: @Galiza:
    i too working on POV clock ….. can u give me some information abt ur project…. plz help me … i am in initial stage of my project

  15. Expert Noob
    April 24, 2011 at 8:33 PM | #15

    I have common Anode RGB Leds. How can I modify the circuit or .jal file to make it work?

  16. Vertilka
    October 9, 2011 at 4:40 PM | #16

    Hi LEDs
    I need to control 100 RGB LEDs, each with different color (let say that the color values are taken from data in memory).
    the color should change every 50 milliseconds.
    what is the best way to do that ?


  17. Vertilka
    October 9, 2011 at 4:41 PM | #17

    I need to control 100 RGB LEDs, each with different color (let say that the color values are taken from data in memory).
    the color should change every 50 milliseconds.
    what is the best way to do that ?


  18. rhoderik
    December 10, 2013 at 2:07 PM | #18

    Hello, I’m interested in this project, I want to learn how to do PWM in software using this, but it give me errors at compiling your (unmodified) source code.
    Theese are the errors:
    1RGBLED.jal:1: cannot open ‘f675_4i.jal’
    1RGBLED.jal:3: cannot open ‘nibsbps.jal’
    1RGBLED.jal:16: “osc_calibrate” not defined
    1RGBLED.jal:16: unexpected token: osc_calibrate

    I don’t know how to fix the errors, can you help me?

    • rhoderik
      December 11, 2013 at 9:10 PM | #19

      Ooops, I posted it in the wrong place. It is related to the Pic12f629 1 RGB Led controller!

  19. Tejas
    December 6, 2014 at 10:10 AM | #20

    I’m building a pov with single color led. I’ve used a shift register 74hc595. I’ve built complete circuit. The only thing remaining is the pic program. I have pickit 2 and i use mplab for programming. I’ve tried a lot but i didn’t get the pov text. I’m using 16 led’s with 2 shift registers. Can anyone please help me with the program in mplab? I need it for my college project.
    My email id- tejabhang92@gmail.com

    Thanks in advance…!

  1. No trackbacks yet.

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>