Colorduino Library for Arduino

I wrote a Colorduino library for Arduino.  It handles initialization and double-buffered drawing on ITead Studio’s Colorduino.  It is also compatible with Itead’s Arduino RGB Matrix driver shield. Included with the library is a sample sketch to show how to use it, ColorduinoPlasma, which draws a pretty plasma on an 8×8 RGB matrix.

To install the library, download the zip file (see below), and copy libraries/Colorduino to your arduino sketchbook/libraries/Colorduino. If you are already running the Arduino IDE, you must restart it before you can use the library. You can then run load ColorduinoPlasma.pde demo.

To include the Colorduino library in your own sketch, just

#include <Colorduino.h>

Then your setup() function needs to just call two functions for initialization:

void setup()
{
Colorduino.Init();
// compensate for relative intensity differences in R/G/B brightness
// array of 6-bit base values for RGB (0~63)
// whiteBalVal[0]=red
// whiteBalVal[1]=green
// whiteBalVal[2]=blue
unsigned char whiteBalVal[3] = {36,63,63}; // for LEDSEE 6x6cm round matrix
Colorduino.SetWhiteBal(whiteBalVal);
}

Colorduino.SetWhiteBal() is used to adjust the white balance. You can put

ColorFill(255,255,255);

in your sketch to test the white balance by drawing a white screen.  Then adjust whiteBalVal until your screen approximates white.

The origin of the screen, (0,0) is at the bottom left corner. The off screen buffer can be accessed either pixel by pixel:

Colorduino.SetPixel(x,y,r,g,b);

or by direct manipulation.  The screen buffer is arranged by row. For instance to set all of the pixels in the second row to the same color:

PixelRGB *p = GetPixel(0,1);
for (int x=0;x < ColorduinoScreenWidth;x++) {
p->r = red;
p->g = green;
p->b = blue;
p++;
}

After you finish updating your screen, make it live by swapping it with the currently display buffer:

Colorduino.FlipPage();

The latest version of the Colorduino library can always be downloaded from github: https://github.com/lincomatic/Colorduino/archive/master.zip

158 thoughts on “Colorduino Library for Arduino”

  1. Hey,

    Great blog – I also have a Colorduino to test with and have been adding (probably badly) to your code for it to receive data over I2C from a master Arduino.

    One thing I have found is if I write to a pixel at:

    PixelRGB *p = &(*Colorduino.curWriteFrame)[0][0];

    It actually appears at 1,0 – i.e. x is one above. When x=7 it appears at 0.

    Do you see the same issue?

    Cheers
    Nick

    1. Nick, Funny how you mention that … I notice it this morning, and am in the middle of fixing it. I probably shouldn’t have tested it w/ the Plasma, because it’s hard to notice subtle bugs like this! I will be uploading the fix shortly… I just want to test a bit more first.

      1. Hmm.. it looks like I messed up the coordinate system, too. I want it to work like normal cartesian coordinate system… (0,0) in the bottom left corner. I’ll have to defer the update until this evening.
        Sorry for the premature release of V1.0 .. I will make sure it works properly this time before I upload the new one.

  2. Hey no problem, I can send you my I2C stuff if you are interested in adding that as an option.
    It’s based on the blinkM version.

    I like the plasma stuff BTW, it’s one of the cooler looking demos for the 8×8 matrix.

    1. OK, the update is live now. I changed the organization of the screen buffer while I was at it to make the memory access faster, since the board updates a row at a time, rather than a column at a time.
      Sure, send me your updates, if you like. I2C would be a nice addition.

      1. Hey Guys, I searched the web how it works the function”sei()”, but I didn’t find anything.. Has someone a tutorial about “sei()” function and “cli()” ??

          1. no it has nothing to do with digital pins. when you clear interrupts it keeps your code atomic. normally, your code flow can be interrupted, say, when a timer overflows. for time or context sensitive code, enclosing the code in cli()/sei() keeps it atomic. sorry, i can’t give you a tutorial on interrupts. it’s a basic function of CPU’s. you can just google “arduino sei cli” if you want to learn more.

  3. I don’t get it. Maybe I’m just too stupid for the English language…

    Colorduino.SetPixel(1,1,255,0,0); –> nothing changes

    ColorFill(255,255,255); –> start:40: error: ‘ColorFill’ was not declared in this scope

    I did exactly what was mentioned above:
    ———–
    #include
    void setup()
    {
    Colorduino.Init();
    // compensate for relative intensity differences in R/G/B brightness
    // array of 6-bit base values for RGB (0~63)
    // whiteBalVal[0]=red
    // whiteBalVal[1]=green
    // whiteBalVal[2]=blue
    unsigned char whiteBalVal[3] = {36,63,63}; // for LEDSEE 6x6cm round matrix
    Colorduino.SetWhiteBal(whiteBalVal);
    }

    void loop()
    {
    Colorduino.SetPixel(1,1,255,0,0);
    }

    ————

    I started about October 2010 with the Arduino Uno, I found it quite interesting and now I was tired of getting some single LED on my breadboard and connecting it to the Arduino… But how is this supposed to work?

    Regards

    1. ColorFill() isn’t included in the library, sorry, I should have made that clear. You need to copy it from ColorduinoPlasma.pde to your new sketch. Does the ColorduinoPlasma sketch work correctly? And what do you see when you run your own sketch… you say nothing changes… you mean all the LED’s are off?

  4. Hello, thanks for creating the library and the plasma demo, both are very cool. I might have found an issue in the plasma demo. Although it does not appear to be used the function RGBtoINT might have a bug. It looks like you are trying to convert the 3 8 bit RGB colors to a single 24 bit unsigned int by shifting. I believe ints are 16 bits in avr-gcc so the red bits get shifted off the end.


    unsigned int RGBtoINT(void *vRGB)
    {
    ColorRGB *colorRGB=(ColorRGB *)vRGB;

    return (((unsigned int)colorRGB->r)<g)<b;
    }

    1. hmm, looks like the html renderer processed out significant parts of the code in the snippet above, you’ll have to look at the code directly to see the problem. There is a shift of r by 16 bits, g by 8 bits, and b by 0 bits and then stored into an unsigned int which is 16 bits. The 16 bit shift of r should shift it off the end.

      1. Thanks. I’ll just delete that function, since it isn’t being used. I adapted the code from someone else’s sketch. It had a lot of extraneous unused functions in it. I guess I missed one.
        But yes, you’re right, for that function to work properly, it should return an unsigned long.

        1. HEy LInco, Got everthing working finally, Was having a bit of a trouble getting comunication between my boards ( arduino as serial/colorduino)but turned out i was using the wrong version of the IDE…on Arduino IDE 022 everything worked fine,plasma,meteor,snow and etc…
          The Issue now is, and I think it might concern others is, specially regarding to those tha want to play a inumerous numbers of animations on the Matrix all along, RGBMtx is freezing upon long animations, it usually freezes around frame 345…is that any limite regarding number of frames per run on the RGBMtx settings?
          Im´putting all togheter on photoshop, cutting,croping and arrangin the frames of individual arraysof animations made on RGBMtx and saved as BMP. Just like the old dudes working on a moviola…pretty worky stuff and a t the end the hell freezes over frame 344 or 349 depending on the file…well
          Any tipo on how to put togheter sets of animations made on the RGBMtx app like some sort of timeline bmp editor?
          And have any code you could share for making the matrix read vídeos per say in .AVI or SWF??
          ThanX

          1. Glad you got it working. I documented in my Lampduino Instructable that I discovered a serial buffer was dimensioned too small in 1.x+ versions of Arduino, which is why it broke. If you want to go back to using one of the newer IDE’s you can modify it, but personally, I still like 0022 better because it builds smaller sketches.

            As for RGBmtx.. sorry, I have no idea what’s causing your problem. It could be that it’s running out of memory or something. I am not a Java programmer, and I barely understood what I was doing when I hacked RGBmtx from someone else’s program written for the Rainbowduino. I have documented my serial protocol in the Instructable, so if you want to write a new interface you can do that. Unfortunately, my Lampduino isn’t even working anymore, and I’m too busy w/ other projects now do to any further development. Good luck.

  5. Hi, first thanks for the wonderful job you did!

    I am having problems with getting different frames made through the set pixel function and put them after each other in a switch case to generate animations. It seems that the screenbuffer doesnt get refreshed or something like that.
    After the first loop the two pixels both stay lit. Any ideas?

    Thanks in advance.

    void loop() {
    unsigned long currentMillis = millis();
    if(currentMillis – previousMillis > interval) {
    previousMillis = currentMillis;

    switch (LatestFrame) {
    case 0:

    Colorduino.SetPixel(0,0,255,255,0);
    LatestFrame++;
    break;
    case 1:
    Colorduino.SetPixel(0,1,255,255,0);
    LatestFrame++;
    break;

    default:
    LatestFrame = 0;

    }
    Serial.println(LatestFrame);
    Colorduino.FlipPage();
    }

    }

    1. They stay lit because that’s what your code does You’re just setting (0,0) and (0,1) to (255,255,0). There’s no code to change them to any other value.

      1. Oh okay well im just starting with coding but I think it would be useful for me to make a function which clears all the leds, u have any suggestions? Otherwise I would need to set all the 64 pixels per frame manually which is madness.

        Oh and btw when I add a third pixel the animation goes through one loop smoothly and after that combines the first and last pixel and swaps with the second pixel so actually it is does happen that leds turn of….

        1. Have a look at my Plasma demo.. there’s a function in there called ColorFill() which you can use to clear the screen by filling it in with black.

  6. Colorplasma demo runs and lights up the matrix but it looks different from the youtube videos. There is more quadranting going on than in the videos. Also, I cannot get Colorfil to fill the entire matrix. Colorfil(255,255,255) turns one quadrant of the LEDs (4×4) red. Colorfil (0,255,255) turns the same 4×4 LEDs red. Colorfill(0,0,255) turns a differnt 4×4 quadrant green. See video at http://www.youtube.com/watch?v=t13bgXZT_rQ and http://www.youtube.com/watch?v=5tGBpfx17g8

    1. Five minutes after the last post I figured out my problem. I wish there was a delete button. Your library seems to be working just fine. Thanks.

    1. Thanks, I just got back from an overseas trip. I’ll check it out when I get the time.
      Can you tell me what you changed?

  7. Thanks for the library and the lampduino instructable, I was able to use it for a project for university and it helped a great deal. We have however run into a small problem, the LED’s aren’t as bright as we would want them to. If we manually set the Arduino ports to high the LED’s are a lot brighter compared to setting them at full brightness using your library. I’m wondering if there’s a setting somewhere in the library to get the LED’s to burn brighter. Again thanks and hopefully you’ll be able to help out with this problem!

    1. Yes, it’s not as bright with the library, because it’s actually sequencing the LED’s so the duty cycle isn’t 100%.
      The only way to get the LED’s to burn brighter is to use transistors to drive them.

      1. Thanks for the fast reply, saves me a lot of headaches trying to figure it out. Fortunately the LED’s are only used for our prototype and will do a fine job at demonstrating the principle! Thanks again!

      2. I’ve been struggling with the dimness also.
        I noticed that the Plasma Demo was not as bright as pre-installed demo, so I knew the matrix could get brighter.

        My end project was using diffused 5mm RGB LEDs, and the dimness was a real problem.

        My boards are ‘FUNDUINO 1.A’ clones of the Colorduino, running Atmega328p.

        Given the nature of the DM163, the only way to increase the brightness is to increase the duty cycle of the PWM, so I started hacking through the library.

        I found that a tiny improvement in brightness could be made by reducing TCNT2, to slow down the refresh rate (and increase the duty cycle) until that starts to introduce flickering….

        However I found a real gain (~20-30%) by swapping the order of two lines of code in ISR(TIMER2_OVF_vect) :

        Instead of:
        close_all_lines;
        Colorduino.run();

        I put:
        Colorduino.run();
        close_all_lines;

        I’m unsure if it’s a problem for the ‘run’ function to run whilst the lines are active, however this effectively acts as a bit of a delay, and by leaving the lines active for longer, it increases the duty cycle, and increases the brightness….. (I didn’t think putting a straight delay in an ISR made sense).

        Anyway, that’s my take on it, this is my first Arduino project.

  8. Hi Lincomatic,

    if i want to compile the Colorduino Demo code i get the following error

    In file included from /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Arduino.h:212,
    from ColorshieldDemo.cpp:69:
    /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard/pins_arduino.h:45: error: expected unqualified-id before 'volatile'
    /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard/pins_arduino.h:45: error: expected `)' before 'volatile'
    /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard/pins_arduino.h:45: error: expected `)' before 'volatile'
    /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard/pins_arduino.h:46: error: expected unqualified-id before 'volatile'
    /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard/pins_arduino.h:46: error: expected `)' before 'volatile'
    /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard/pins_arduino.h:46: error: expected `)' before 'volatile'

    i replaced the Wprogram.h with Arduino.h

    do you have an idea to solve the prob?

    thanks in advance

    Norbert

    1. I assume you’re using Arduino 1.0+? For older versions, you don’t need to keep Wprogram.h.
      I am not sure why you are getting the errors It works fine for me.
      Which board do you have selected?

  9. In the schematic pin 9, 26 and 32 were unused, is it possible to use them for my own application?

    greets

  10. i´cant use the “colors shield 1.1” with an arduino mega 2560. Has anyone an idea why? I had a look at the sketch and also at the libraray, but i didn´t found anything that maybe helps me.

      1. Strange.. my last message is went away. So again: When i upload the sketch to my mega 2560 r3, only the 2nd or 3rd vertical line of my 8×8 Matrix shield will blink 3times in violet. After that i see a black matrix shield. Only on my arduino uno is the plasma demo running very well. I have no idea what can be different to the uno board.

        1. Hmm. Sorry, I have no idea. I don’t have a Mega so I can’t test. Maybe you can ask ITead if it’s compatible with the Mega.

          1. I’ve made the same observations:
            mega 2560 r3: only 2 rows are flashing two times in violet
            uni r3: perfect running.
            environment is arduino v1.0.1 and colorshield v1.2
            somebody assumed that there might be different registers and interrupts in these chips….

          2. Hmm. OK, it’s possible my code isn’t compatible with a MEGA .. I based it on some sample code I got from ITead.
            If you look in Colorduino.h, it programs via direct port access instead of using Arduino calls (this is for speed … it would be too
            slow to use digitalWrite). I don’t have a Mega, but might be able to try some changes if you’re willing to test

  11. Testing – That’s what the Community is made for
    If you publish New Code i’ll try it!
    Thanks anyway for the excellent library !!!
    Matt

    1. Hmm. Email bounced. I pushed a new Colorduino.h to github for testing with the Mega. Please try it out and let me know if it works. Also, please test with Uno as well to make sure I didn’t break it.

  12. I’m pretty busy this weekend, but I’ll try it on Monday.
    Have a nice weekend
    Matt (corrected my e-mail)

  13. Hey first of all great library! Cool stuff you did there. But I tried the command ColorFill(255,255,255); and it just gives me an error (not defined). I searched for it in the library files, but yeah I couldn’t find it… So I just wanted to ask you if you removed it… (and if yes, why?). But anyways this isn’t a big problem at all because I wrote my own ColorFill (feel free to use this):

    void ColorFill(int r, int g, int b){
    for (int height=0; height < ColorduinoScreenHeight; height++){
    PixelRGB *p = Colorduino.GetPixel(0,height);
    for (int x=0;x r = r;
    p->g = g;
    p->b = b;
    p++;
    }
    }
    Colorduino.FlipPage();
    }

    It works perfectly with my Arduino UNO + Colorshield + 8×8 RGB Matrix.

  14. I tested your new library yesterday evening, but I could not see any difference. Uno is working, Mega not.

  15. Nice work your library, works great with the Arduino Uno in the IDE1.0.1 but not on the Arduino Leonardo ASSR and AS2 are not declared. Did you have some idea’s about it?

      1. Yes, right I have take a look inside the files, but I think thats not all you set the ports of the Atmel328 really “global” and the Atmel32U4 has differents. maybe this must be more specific so it can work for all Arduinos. Something like D6 to PIN and PORT I know it’s written down in the pins_arduino.h. Btw. did I see it right you use the Timer to drive the clock pulse for the Serial in?

  16. the ISR in Colorduino.cpp uses Timer 2 :

    ISR(TIMER2_OVF_vect) //Timer2 Service

    All that needs to be done is for an alternate timer to be set up to call it. Hopefully, the other pins being used don’t need to also be remapped.

    1. You got it working with Leonardo? Please submit a pull request on github, or e-mail to me. My e-mail address is in the comments at the top of Colorduino.h. Thanks!

  17. Hi there,
    I would like to use a Colorduino to drive 192 white 5mm LEDs in a 12×16 matrix. In other words, I guess I need some serious rearranging of pins and connections, compared to the typical 8x8x3 layout, and to adapt the library accordingly.
    Is anyone aware of comparable efforts in this direction? My googling has not been successful so far.
    Thanks in advance!

    Giuseppe

  18. I get this error when trying to upload the code to the colorduino from an arduino.

    avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x9c
    avrdude: failed to write flash memory, rc=-4

    The compilation is OK, just the upload is the problem.

    When i unplug the RX and TX connectors, is now able to upload the code to the arduino board. I suppose that’s it’s a problem with de commucation between the boards. There’s something i’m missing? like a driver? the other thing is that the code that it came preloaded from fabric (R G B colors, rotating), now is not working, not even on the stand alone colorduino mode.

    I’ve done the 5 connections between boards, (Reset-DTR. GND-GND, 5V-VDD, TX-TXD, RX-RXD).

    Both boards are ON

    Hope someone can help, thanks

      1. wow, thanks for the fast answer… and the good thing is that now is working, and the plasma animation is running beautiful…
        is not very smooth, i can clearly see the “steps” of the changing color.. anyway is very nice, but can it be better?
        i tried to use the RGBmtx animator, standalone and from processing, it runs fine, but when the animator main screen opens, my matrix, after a fast reset, continue doing the plasma animation, unlinked from what i do in realtime, and in the top it says ” No output device found, runing in standalone mode ”
        hope someone can help and share more ideas about what to do and play with the matrix

        thanks

          1. hi again… i modified the 64 to 128 but it seems to be a problem of ports.
            I’m using softwares processing 2.0b7 and arduino 1.0.3
            I think there’s no communication, my arduino is in port COM 3, maybe i’ve to especify in some code?
            For using the RGBmtx should i put the arduino microcontroller back to the board?

  19. when i run the processing skecth “RGBmtx” , it says that a colorduino is found on the COM 3 port, and the message no device found on the top of the display, is gone.
    But… the plasma animation is still there, and the matrix is not affected by the RGBmtx realtime modifications.
    What else is missing?

    THANKS

    1. Hmm. That’s interesting. I wonder why it works OK for me. Can you tell me in which forum you saw this? Thanks. Glad you got it working

  20. Hello! I have a couple of questions:

    1) I’m trying to multiplex with an 8×8 RBG LED and code it so that I can turn any pixel on and off whenever I want. Is there such a command built into the Colorduino code? In other words, is there a simple blink program on top of Colorduino.Setpixel?

    2) I notice everytime I plug in my colorduino with my USB, I see a sudden flash. Is there a way to get rid of this? Like attaching a mini surge protector or something?

    Thank you!

  21. Hi there

    ive wired up my colorduino and Leonardo board. But the plasma demo code wont run.
    My matrix just switches from R to G to B every second. What do I do ?
    any help would be greatly apprecieated
    Vahakn

    1. It just go all R, all G, all B? That’s very strange. I have no idea what’s going on. Check your wiring. That is the only thing that could go wrong if you successfully loaded the sketch. Are you using a common anode matrix? Common cathode wiring will not work properly.

  22. I think that you didn’t upload the code into the colorduino… the R G B every one second is the factory code that comes by default. When you uploaded the code in the arduino software, did you saw the message “Upload Complete” ?
    Remember to take out the ATmega microchip from the Arduino before you upload a new code into the colorduino.
    Hope it helps

    1. Jean Paul, thanks very much for jumping in with a reply! I think you’re right, that he didn’t upload the sketch properly.. I forgot that the factory code is R/G/B flash.

  23. Thanks so much for the library and support… Im getting somewhere slowly.
    Do you know how I can run arduino program alongside colorduino. I need to use analog inputs and RX and TX for sending midi signals. Is this possible?

    thanks vahakn

    1. Yes, just add more code to the loop() function to do your other processing. Just remember that while the Colorduino code is running, your other code is waiting, and vice versa.

  24. Hi,
    Don’t work for me…
    I have a Colorduino 2.0 and a Arduino MEGA 2560.
    But if I try to load the code, I have this:

    avrdude: stk500v2_getsync(): timeout communicating with programmer
    avrdude: stk500v2_ReceiveMessage(): timeout
    avrdude: stk500v2_ReceiveMessage(): timeout

    apparently, he can’t make the connection with the colorduino

    Please, help me!!!

    Thanks

    1. What’s a Colorduino 2.0? I’ve never seen one. Itead still shows v1.3.
      Give me a link. Is it a shield or standalone? My code doesn’t work with a Mega.
      The error you’re getting is because the bootloader isn’t loaded on the Mega.

        1. Oh, OK, so you’re trying to use the Mega just as a programmer.
          I’ve found that the MCU usually interferes, so you have to remove it, but that’s not possible on a Mega.
          You should try either a USBTinyISP or an FTDI cable.

          1. I forgot to mention.. you can do serial programming only if the bootloader is already installed. Otherwise, you need to use a USBTinyISP to install it. You can also follow the directions for Arduino as ISP in the Arduino Playground to load a bootloader.

  25. Hi.. Your code looks very promising for a small project i’m about to start – so thanks for making your work public first of all. I have two questions though.

    1) Do you use i2c to control the boards?

    2) Is there a possibility to control mulitple boards? cascaded or by choosing a adress for each board?

    Thanks in advance
    \ Jakob

  26. It would be nice if this library supported these functions:

    shiftup
    shiftdown
    shiftleft
    shiftright

    read buffer PixelRGB *p = Colorduino.GetPixel

    This would really help with scrolling and animation.

    1. thanks for the suggestions. they really aren’t that hard to write. if you want to do it, i’ll merge them into the github repository.
      unfortunately, i’m quite busy w/ other projects @ this point.

  27. Hi evrybody,
    Is anyone know if on the colorduino (mine is v1.3) there is some I/O remaining and where ?
    thanks !

  28. Hello,
    I am totally new to all this but after a bit of trial and error I have managed to get my colorduino communicating with my mac via both my usbtiny and my ftdi cable. i even got the RGBmtx to see my device:-)
    My issue is that the plasma sketch uploads but doesn’t look right. Also in RGBmtx when i select a square my LEDs don’t light up correctly. only 2 boxes will make any LEDs turn on and when they do it turns on the entire row of LEDs in the wrong color.
    I am useless as far as this stuff but maybe someone could shine some light on what might be wrong for me. I would humbly appreciate any help:-)
    Thanks!

  29. To elaborate, when I select any box in the bottom of the RGBmtx, the center horizontal row of my LED matrix lights up in a rainbow of colors…

    1. It sounds like your matrix is hooked up wrong. Is your matrix hand-wired, or are you using one that just plugs in? You can troubleshoot by running some simple test sketches, using SetPixel() or ColorFill(), and see if it’s behaving correctly. For instance, to fill the screen with red:

      Colorduino.ColorFill(255,0,0);
      Colorduino.FlipPage();

      Or to Set pixel (3,3) to blue:

      Colorduino.SetPixel(3,3,0,255,0);
      Colorduino.FlipPage();

      Try testing different coordinates with different colors to see if they display in the correct location, and with the correct color. You can report back anything that looks funny, and I’ll try to help you figure out the problem.

  30. Hi! Thanks so much for the reply. I just got it to work this morning with a different matrix. It seems the matrix from Sparkfun doesn’t work with the colorduino. I got one from ebay that works perfectly! I am brand new to all this but I am almost there:-) Thank you so much for sharing all your info and work.
    I am now in the process of trying get the music sync to work. All the other RGBmtx items work in play mode (meteor, snow, and plasma). When I get to music I get nothing at the moment. I can see TX and RX lights going on my FTDI board but nothing on the matrix.I’ve tweaked the threshold in the Slave.pde to try different things but no luck yet. There are no images on the RGBmtx screen in music mode. Not sure if that’s the problem.
    Also not sure how to import the .bmp images into RGBmtx on the mac. Let me know if you have any suggestions. Thank you!

  31. Ha:-) spoke too soon… i just made a few frames and of course it works perfectly now! still not sure how or what to do with the BMP files on the mac as they don’t seem to import. I will mess about a bit. everything else is finally working:-)
    now i need to connect a ton of these!

    1. @Matt, glad you go it working. I’m not sure what you mean about importing the BMP’s into the Mac .. if you download them into the Mac, then RGBmtx will be able to read them just fine.

  32. Hi guys!

    So.. This is my problem… I want to upload a sketch to my colorduino so he runs it whenever i turn it on. The thing is , even though i uploaded the sketch the colorduino (when it’s turned on) still displays the plasma sketch.
    I want to be able to store sketches from RGBmtx to colorduino and keep them there
    Any help is appreciated! thx

    1. If it’s still displaying the plasma sketch, then you really didn’t upload the new sketch.
      And RGBmtx only works interactively with a computer attached. Once the connection between
      RGBmtx and the computer is lost, it will just get stuck on the last frame (until you reboot
      the Colorduino, then it will be lost)

  33. But the RGBmtx does store the sketch into the colorduino right? So that the sketch can be displayed without being connected to the PC. Or am i making a mistake here?

    1. RGBmtx is only used to interactively control the Colorduino. It can set it to plasma mode, or send animations to it.
      I am not sure how you are using the word “sketch” here… when discussing Arduino, a “sketch” is a program. When you
      say “sketch,” are you talking about pictures? RGBmtx can’t store the pictures in the Colorduino, because there isn’t enough
      storage available. In order to do that, you would need to interface it to an SD card reader to store the pictures, and modify
      my sketch (code) to read them from the SD card.

  34. Hi, I am aiming to use the colorduino to run non rgb Leds, essentially allowing me to wire 192 Leds through a relatively small driver. I have no experience with programming and would like the leds to stay static and run at their full potential. I am hoping the programming for static function exists and for some guidance on how i would apply this onto my colorduino.
    Any help would be much appreciated.
    Thanks
    Alks

    1. Colorduino.ColorFill() will fill the matrix with a specific RGB color:

      /********************************************************
      Name: ColorFill
      Function: Fill the frame with a color
      Parameter:R: the value of RED. Range:RED 0~255
      G: the value of GREEN. Range:RED 0~255
      B: the value of BLUE. Range:RED 0~255
      ********************************************************/
      void ColorFill(unsigned char R,unsigned char G,unsigned char B);

  35. Total Novice Here. What am I doing wrong? Using UNU.
    I get the following when trying to verify.
    ColorduinoPlasma:44: error: ‘ColorduinoScreenWidth’ was not declared in this scope
    ColorduinoPlasma:44: error: ‘ColorduinoScreenHeight’ was not declared in this scope
    ColorduinoPlasma.pde: In function ‘void plasma_morph()’:
    ColorduinoPlasma:109: error: ‘ColorduinoScreenHeight’ was not declared in this scope
    ColorduinoPlasma:110: error: ‘ColorduinoScreenWidth’ was not declared in this scope
    ColorduinoPlasma:121: error: ‘Colorduino’ was not declared in this scope
    ColorduinoPlasma:126: error: ‘Colorduino’ was not declared in this scope
    ColorduinoPlasma.pde: In function ‘void ColorFill(unsigned char, unsigned char, unsigned char)’:
    ColorduinoPlasma:138: error: ‘PixelRGB’ was not declared in this scope
    ColorduinoPlasma:138: error: ‘p’ was not declared in this scope
    ColorduinoPlasma:138: error: ‘Colorduino’ was not declared in this scope
    ColorduinoPlasma:139: error: ‘ColorduinoScreenWidth’ was not declared in this scope
    ColorduinoPlasma:140: error: ‘ColorduinoScreenHeight’ was not declared in this scope
    ColorduinoPlasma.pde: In function ‘void setup()’:
    ColorduinoPlasma:153: error: ‘Colorduino’ was not declared in this scope
    ColorduinoPlasma:169: error: ‘ColorduinoScreenHeight’ was not declared in this scope
    ColorduinoPlasma:170: error: ‘ColorduinoScreenWidth’ was not declared in this scope
    ColorduinoPlasma:178: error: ‘plasma’ was not declared in this scope

    1. The library isn’t installed properly. As instructed above, copy libraries/Colorduino to your arduino sketchbook/libraries/Colorduino.
      If you can’t figure out how to do that, you can also just put Colorduino.cpp and Colorduino.h into the same folder as ColorduinoPlasma.pde.

  36. Thanks Lincmatic, That worked.
    in the code below I expected to turn on then off one pixil then turn on the next. instead it turns them on and off in a progressing pattern until they are all on and flashing . I suspect it is in the flippage command. Is there a command reference guide?

  37. Sorry forgot to include the code.

    #include
    void setup()
    {
    Colorduino.Init();
    // compensate for relative intensity differences in R/G/B brightness
    // array of 6-bit base values for RGB (0~63)
    // whiteBalVal[0]=red
    // whiteBalVal[1]=green
    // whiteBalVal[2]=blue unsigned char whiteBalVal[3] = {36,63,63};
    // for LEDSEE 6x6cm round matrix Colorduino.SetWhiteBal(whiteBalVal);
    }
    int r=0;
    int c=0;

    void loop()
    {
    //delay(2000);
    if (r==7) r=0;
    Colorduino.SetPixel(r,c,127,127,127);
    Colorduino.FlipPage();
    delay (500);

    Colorduino.SetPixel(r,c,0,0,0);
    r=r+1;
    Colorduino.FlipPage();
    delay (500);
    //ColorduinoFrame();
    //delay (5000);

    //Colorduino.SetPixel(0,1,255,255,255);
    // Colorduino.FlipPage();
    //ColorduinoFrame();
    //Colorduino.FlipPage();

    //Colorduino.SetPixel(4,4,60,60,60);
    // Colorduino.FlipPage();
    // ColorduinoFrame();

    }

    1. You are right. The problem is FlipPage(). There are two frame buffers, Framebuffer0 and Framebuffer1.
      Say Framebuffer0 is currently being drawn, and Framebuffer1 is offscreen. All of the drawing commands draw
      to the offscreen framebuffer, so they will draw to FrameBuffer1. When you call FlipPage, the buffers swap,
      so Framebuffer1 becomes onscreen, and Framebuffer0 becomes offscreen.

      The problem is that you cleared the pixel in FrameBuffer1, but it’s still not cleared in Framebuffer0.

      Assuming that you start with all pixels dark in both frame buffers, the following code should do what you want:

      if (r==7)r=0;
      Colorduino.SetPixel(r,c,127,127,127); // set pixel
      Colorduino.SetPixel((r==0)? 6 : r-1,c,0,0,0); // clear prev pixel
      Colorduino.FlipPage();
      delay(500);
      Colorduino.FlipPage(); // this just flips to the black frame buffer
      delay(500)
      r=r+1;

  38. I am having difficulty getting the ColorduinoPlasma code to verify an upload to the board. I have the Colorduino.cpp and Colorduino.h files in the same folder as the ColorduinoPlasma, but I am now getting an error compiling which reads

    “In file included from Colorduino.cpp:21:
    Colorduino.h:23:22: error: WProgram.h: No such file or directory”

    I am new to arduinos and very new to the colorduino so I would love any help!
    Thanks!

    1. I am also concerned that my Colorduino does not work properly since it doesn’t run a demo when I plug it in. Do they all have demos pre loaded when you purchase them?

  39. Hi there. Thanks again for this great project! I got everything working except for som reason I can’t load any of the BMPs into RGBmtx. I can record and play back my own drawings as well as run the plasma, snow, meteor examples. I can also save my own animations and play them back. Any idea why the bitmaps wouldn’t load? Thanks!

    1. Hi, what do you mean they won’t load? What happens?
      Are you able to load any of the sample BMP’s from my Instructable?

  40. Thanks for the quick reply! I am unable to “Load From: File” any of the example bitmaps that you included for download. When I get the open dialog box it tries to load them but nothing appears in RGBmtx and RGBmtx crashes. The demos of “snow”, “meteor” etc work and I’m even able to get some of my own patterns working with music (thank you!!!). But for some reason I can’t Load the framesets.zip files or mal_animations either. I’m sure it’s something simple that I just don’t understand:-)

    1. What platform are you running it on? Are you running RGBmtx from my binaries or by loading the sketch into Processing? Try loading the sketch into Processing, and see if it shows any errors in its console when it crashes.

  41. sorry for the delay. when i open the RGBmtx.pde in processing on my mac in osx it says “processing .xml no longer exists. this code must be updated for 2.0”. it adds
    “No library found for com.bric.swing
    The processing.xml library has been replaced with a new ‘XML’ class that’s built-in.
    This code needs to be updated for this version of Processing, please read the Changes page on the Wiki.”
    it’s way too deep for me:-) not sure if it makes sense to you or if you feel like taking your time to explain any of it-)

  42. Hi, would be physically possible to hook a SD slot Card + bluetooth shield in a arduino uno hooked on a colorduino board so I would load and run a large number of animatios via Bluetooth conection independently running without needing a pc host? Thanks in advance.

    1. If you’re going to use Bluetooth, and wirelessly tether, why do you need the SD card? The easy way to do Bluetooth is to use a Bluetooth to serial adapter like this one: http://www.adafruit.com/product/1588
      Then you can just use RGBmtx across a wireless connection w/o having to change any software or firmware. If you want to have it run w/o a computer, then the SD card is the way to go, but you will have to write the sketch yourself

      1. Hey there , good Point. This Adafruit adapter got be just as awesome as your projects and help. Glad you still run this blog. Part of DYI Heaven, yeaH…Easy way out wireless serial ports w/o the heavy writing…and then you can focus in developing the SD card sketch on which, it would feed the Colorduino on standalone mode per say reading groups of .bmp files on loop may be through RGBMtx´s interface or any other way, I don´t know I ´ll have to check on this Furthermore. and If I ever got something figured out I´´let you know..
        Thank ´s!

  43. Yeap Understood ,Thanxs again…Sad to hear that your Lampduino is out. As long as you keep the cool projects on have no problem with that…I´m gonna still work on this matrix cause i think there´s still more to it somehow ,even comercialy i don´t know…I´m relativly new at arduino so thats already to much corn for my little truck to carry…anyways thanks again and good luck as well

  44. Hi linco,
    Thanks for this awesome codes that you have. I’m using this application in our projects right now.

  45. Good Morning.
    Sorry, my english is not good.

    How do I send the direct command of an Arduino instead of a PC? Doing the job RGBmtx?

    Thx

      1. I ‘m about to step on it in the next months or so…i guess that what you would wanna do is code ( on arduino ide java format) each rgbmtx function individualy as a bootloader,example: meteor,snow,load file(from a sd card perhaps videos using a processing scketch)..and so on. I dont know how to do that yet so if you Diego figure this one out before i do please let me know. Good luck.

    1. Hi Markus,
      As you are one of the latest post, I think you may be the most up to date to answer to my questions:
      – Does your latest library work with Arduino IDE > 1.26 ? Or does the frame-buffer issue still exists ?
      – Can you control plug 2 colorduino into each other and use the i2c connection to use the 2x(8×8) display (I am looking to have 2 symmetrical display)
      Best regards

    2. Hi Markus,
      First, thank you for your post;
      I would like to use your sketches but I’m getting the following error when loading the sketch: ‘class ColorduinoObject’ has no member named ‘attachbackgroundcolor’
      In both versions of Arduino: 1.6.5 and 1.8.3
      What can it be?
      Thank you

      1. You’re probably using my version of the library, instead of Markus’. He added the attachbackgroundcolor() function. Use the version of the library from his github.

  46. Hi, nice place for colorduino, I get a Keyestudio 4 * 4 * 4 Rgb Led Kit an it use the same type of shield. Sample program provided with is in fact a 8×8 RGB demo program, because is in .Hex I don’t have solution to modify it. Could you help me to find a sketch working in my Arduino Uno and transferable to my Cube ? Thanks in advance. Vince.

    1. If it’s using the same shield, you should be able to just use my demo sketch included in the library

  47. Hi, I try to include the library into Arduino 1.8.0 IDE without success. When I try using sketch:include library: using Zip I get an error message : file include not valid files. Any help appreciated ;=) Thanks Vincent.

  48. Good evening I installed(settled) colorduinoslave on funduino v1.0 as to explain this above impossible to communicate with rgbmtx .les leds rx tx flashes but matrix led black rest .j’ have to disconnect reset thank you

  49. Hi everyone!
    I have a Text Scroll code; is working but, each letter takes a long time to scroll on the screen; Anyone have any suggestions? Could it be the Scrool.h library? Thank you all

    Code:
    #include
    #include
    #include

    void setup(){

    }
    void loop(){
    //Scroll(“String!”, delay, textcolred, textcolgreen, textcolblue, bgcolred, bgcolgreen, bgcolblue, displaynumber)
    // Scroll(“IJHACK”, 100, 255, 0, 0, 0, 0, 0, 1);
    Scroll(“DANIEL”, 100, 0, 0, 255, 0, 0, 0, 1);
    //Máximo de 20 Caracteres em uma Instância de “Scroll”
    }

  50. I would like to do scrolling (colored) with various Colorduino;
    If anyone can help me (with some website), I thank you!

  51. I am having a little problem with how white, or some color close to white, is displayed on my led matrix. The left 2 colums are more reddish white like, while the right 4 colums are a bit more of a greenish/blueish white. The strange thing is, when I upload the standard sketch where my colorduino came with, and I use the standard sketch to fill the screen with white, I get a (near) perfect kind of white.

    And when I reupload the sketch with the library after having uploaded the standard sketch, the white colors are pretty okay, but every time I press the reset button on my colorduino, it get’s worse every time.

    Is there something I should do with the whitebal variable?

    Thanks in advance for any help

      1. It seems to be a problem with arduino IDE version 1.8.5, so I switched to IDE version 1.0.6 and all the colors work perfect

Leave a Reply to DarkAngel Cancel reply