1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

15 Channel RGB (45 LED) Color Wave Using PIC16F628A

Discussion in 'Microcontrollers' started by Chipwizard, Jun 15, 2011.

  1. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    In the finished product I have placed resistors on all bases of transistors. I added these resistors to limit the current drawn from PIC to allow more juice to supply to LEDs.
    However based on Transistors datasheet, they can handle VBE=6v. PIC output is only 5v max at limited 25mA current. So supply resistors to the bases is not crucial but rather optimum. Thank you for the great suggestion.
     
  2. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,161
    Likes:
    340
    Location:
    Brisbane Australia
    Use a serial eeprom like the 24LC1025. It uses I²C to communicate so you would have to switch to a pic with hardware I²C like the 16F88. It is 128k bytes in size.

    Mike.
     
  3. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    Pommie:
    Thank you for your chip suggestion. I read the datasheet for 24LC1025. Although it requires a very complex addressing from PIC, it is rather straight forward protocol. I am thinking of having two systems in place. One that writes only to EEPROM data pattern and the other reads only into PIC and drives the latches. Challenging but very much doable.

    The main thing I am struggling with is still memory space for the data. I need much much more than just this chip or combination of 4 of them to have a meaningful multi-functional system of color generating.
    You guys help me out confirming my calculations and let me know if I am missing something.

    Let's say we are driving 16 RGB LED's using 6, 8-bit latches.
    We need 6x8 bits = 48 bits (6 data bytes) to put a single color set on 16 RGB
    Let's assume we are working with 16 colors, 4-bit resolution.
    To create one frame of image (color) across 16 RGB, we need 6 x 4 data bytes resolutions = 24.
    To create 16 frames (moving 16 colors across the screen) we need 24 x 16 bytes = 384 of data bytes to just do one color pattern motion across 16 RGB.
    It takes 3, 24LC1025 to just create this one task (function). If I was to create multi-function system I would need a lot more than just 128k of memory. I need a massive amount.
    Suggestions?
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US

    Micro SD cards, they're very inexpensive and you can access them using an SPI mode that's very easy to implement on micro controllers.
     
  6. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    Scead:
    Thanks! Now we are talking! I assume you are referring to memory cards similar to digital cameras with GigaBytes of memory. Me likey! Now I have to find out how to communicate with it. I'll be back.
    Regards,
    Rom
     
  7. birdman0_o

    birdman0_o Active Member

    Joined:
    Feb 23, 2009
    Messages:
    1,370
    Likes:
    18
    Location:
    Montreal, Quebec
    Which LED's did you use? (do you have a link handy)
     
  8. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,161
    Likes:
    340
    Location:
    Brisbane Australia
    I didn't quite understand the jump from 384 to 3*128k!! To display a frame requires 24 bytes of ram. To double buffer your frame requires 48 bytes of ram. The 128k ROM can hold over 5,000 frames.

    Are you saying 5,000 frames isn't enough?

    I'm assuming that to animate you would display 1 RAM buffer whilst loading the other from ROM and then switch buffers. Reading a frame from ROM will take less than 1mS at 400k. In fact, unless you switch to a 18 series chip you will not have enough RAM to do it any other way.

    Mike.
     
  9. edeca

    edeca Active Member

    Joined:
    Apr 8, 2008
    Messages:
    589
    Likes:
    38
    Location:
    England
    Note that the PIC output is not "limited" to 25mA, that is the absolute maximum for the pin. Therefore you should always current limit any outputs to avoid damage to the device.

    You do want the transistor to be in saturation but this shouldn't be at the expense of potentially exceeding the per-pin or per-port ratings.
     
  10. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    Hi Bird:
    I used RGB superflux (Pirahna) common cathod. (RGB-).
    I am working on a YouTube video. I post the link once finished.
     
  11. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    Mike:
    I need 384 bytes for one function (movie of 16 frames). I was under the impression 24LC1025 chip can only hold 128 bytes (128 of 8bit lines)?
    If I can get 5000 frames I am a happy camper. I can produce 312 functions (movies) with that.

    In regards to your other comment: I was planning to read 1 BYTE from EEPROM, HOLD in a variable on PIC, do this enough until I have all the lines for one frame. Have PIC push the data out from varaibles one at a time with a roll into data bus of the latches and clock them in to the end. Latch it. Go to EEPROM to get more data. I would like to hold the latch until I have the next set of data from ROM in the variables. At least that is the idea...
     
  12. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    Edeca:
    Your point is valid and as I mentioned I added the resistor to the system which I posted recently. It is already in the PCB layout posted as well.
    Regards,
    Rom
     
  13. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    After I posted a response I realized you wanted the company for the LED. I bought 500 pack about 1 year ago.
    It was from JELED Electronic Co. LTD, direct order from China. If I recall they have a website.
    Model: JLSF5-W120-140-MRGB8000, Superflux 05RGB
    140 degree, 8,000 mcd, Vf: 2.2-2.4, 3.4-3.8, 3.4-3.8, Common Ground (RGB-)
    Caution: Green LED chip is very sensitive to static electricity and solder temporature. If you are buying some make sure you take precautions not to damage them during handling and install. I recommend using solder posts and then insert LEDs.
    Cheers.
     
  14. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    16 RGB System Using Latches, PIC, and External Memory:
    After careful evaluation of layout implementation, I noticed that the role of PIC in such a system is limited to fetching data from memory bank and synchronizing the data, clock, and latch to feed the latches.

    There are already hardwares designed specifically to interface with a computer to communicate with latches. Such devices allow for a more rapid streamlining of the data and control bits (clock, latch) taking advantage of massive computer memory and fast I/O's.
     
  15. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    Video of Aurora 15 will be posted on YouTube shortly.
    Coming soon... Aurura 18 (18 Channel RGB Using all pins of PIC16F628A)
     
  16. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    Major Breakthru:
    I have been studying the code for color wave in details and discovered additional patterns and shortcuts.
    Taking advantage of these patterns, one should be able to produce a system of 36 RGB (36 colors) using all pins of PIC16F628A (15 I/O).
    Advantages: Expansion of the system to 36 RGB, Increasing duty cycle to 33.3% (Full Brightness), and cut the number of line codes in half.
    Disadvantages: System is only capable of producing one functions (Color Wave) rotating 36 colors, Additional components such as driving transistors or LED driver chips are required, and PCB wiring is a lot more complex.
    How does it work:
    3 I/O of PIC are used along with 3 transistors to sink all cathodes of LEDs. (Multiplex 3)
    Each additional 3 I/O will drive 9 RGB (3Reds of first set is tied to 3Greens of next set and tied to 3Blues of the next set).
    Using 12 I/O (4 sets of 3 bits) and 12 transistors, one can drive 12 x 3 = 36 color bits
    Color data bits only address 12 bits while the hardware distributes the colors over 36 RGB. Moving R-> G will change G-> B and B-> R. Transitions in between 12 bits will translate to 36 transitions across all 36 RGB.
     
  17. colin55

    colin55 Well-Known Member

    Joined:
    Feb 14, 2009
    Messages:
    3,534
    Likes:
    82
    Location:
    Melbourne Australia
    Everyone gets this wrong. . . .
    PIC chips are not internally limited to 25mA per line.
    The max safe level is 25mA per output and without proper current liming resistors on each output, the chip will deliver over 100mA per output. This is obviously too much for the FETs and eventually something will be damaged.
     
  18. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
  19. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,161
    Likes:
    340
    Location:
    Brisbane Australia
    You are correct, most people do get this wrong:D. In the case of the 16F628A the output clamp current is listed as ±20mA. See section 17.0 of the data sheet.

    However, it varies from pic to pic but there is a max current for all ports combined. This tends to be 200mA for the older chips but the newer chips can supply much less. In the case of the new 16F887 the total current for all 5 ports is 90mA or an avarage of <3mA per I/O. So, check the data sheet.

    Mike.
     
    Last edited: Jul 12, 2011
  20. ghostman11

    ghostman11 Well-Known Member

    Joined:
    Nov 22, 2009
    Messages:
    1,192
    Likes:
    99
    Location:
    Scotland
    great project i watched the vid a couple of times and found it somewhat hypnotic! nicely donr board by the way
     
  21. Chipwizard

    Chipwizard New Member

    Joined:
    Dec 14, 2009
    Messages:
    146
    Likes:
    0
    Location:
    Florida, US
    Thank you sir.
    I have done board design and schematics for 18 RGB and will post sometimes next week.
     

Share This Page