Rainbow cube questions (actually rainbowduino also)

Hi all,
I just put together my rainbow cube and got the plasma code running with much help from this forum and all the different codes people have written for it. It’s beautiful…

I’m now trying to hack the firmware to get it to do something more appropriate for 3D. I’m wondering how I can get the cube to display more than 16 colors per channel? Color transitions in my cube are very obviously stepped at the moment and it’s quite obvious to the eye when a transition to a nearby color or a change in brightness happens. I’ve been looking at the code trying to figure out what’s going on at the lowest level with the ports but I’m totally lost.

Hi I cant help you but perhaps youy can help me?

I’m struggling with the Plasma sketch i’ve fluked (got lucky) getting the code to load and run once but havent managed a second time.

Have you got a Plasma sketch that compiles without throwing up error mesages about gamma tabs etc? Could you sent it to me?

Or Post a link?

I want to hack it to add a timer so that the whole thing powers down after 15 minutes. I got it permanently installed in a wooden plinth with an acrylic cover.

Ta

Steve

hi there,
the plasma code i got was from combee.net/rainbowduino/Rainbow_Plasma_0.1.zip. let me know more details if you want help getting it running again. what did you change?

an acrylic cover sounds nice, btw.

So I’ve been trying to hack the firmware to get the rainbowduino to display more colors. It seems to come down to the time it takes to raise the voltage on the pins. e.g
shift_data_0;
clk_rising;
which are macros for
SH_PORT_SDI&=~SH_BIT_SDI;
SH_PORT_CLK&=~SH_BIT_CLK;SH_PORT_CLK|=SH_BIT_CLK
which are #defines for
#define SH_BIT_SDI 0x01
#define SH_BIT_CLK 0x02
#define SH_PORT_SDI PORTC
#define SH_PORT_CLK PORTC

These two output operations take on the order of 0.5 to 1 microseconds with times 16 levels of brightness for 8 rows of pixels, ends up taking too long to increase the 16 to 256 say.

My question is, doesn’t this seem to be quite long for a simple raising of the voltage on a few pins? Or is this expected?

Thanks.

what exactly do you mean with “quite long”? do you mean “too long”? because I discovered a bug which is only visible on some led matrices… sometimes one line is always very low red… and sometimes some random pixels appear (very rare).

do you have an idea, how to improve this?

cheers

I mean that it’s longer than I would have expected. Actually I found study somewhere of just this, the time it took to write bits to the ports and it was pretty comparable. So I’ve no idea how to speed things up in that inner loop. It seems like it’s going as fast as it can given the nature of having to push all those bits serially instead of having streams of bits running in parallel.

Actually, I’ve seen something similar to the very low red behavior you describe, except mine (on the cube) has several leds with very low blue colors on almost all of the time. I haven’t tried to debug it yet though. I’d be very curious to hear the details if you can figure out the problem with your led matrices.

About the random pixels lighting up, I’ve no idea. I haven’t seen this.

cheers, Greg

How are you setting the pins?

digitalWrite() isn’t exactly the most efficient function (in fact, it takes something like 5-6 instructions for a SINGLE pin, if i remember correctly).

Writing to pin registers (DDRD, PORTD, DDRB, PORTB) is much much faster.

Edit: Argh, disregard, please. Apparently, i’m unable to read properly today :blush: