# Lomont.org

(Also lomonster.com and clomont.com)

Published

Summary

### The 3D LED Cube, Part Three

Over the past few months in our spare time, we have added several features to the 4x4x4 cube and started building the 8x8x8 cube.

For the best part, see the videos.

Now, on to the work completed.

### The 8x8x8 Cube is (almost) alive!

First I’ll present Gene’s master soldering of the 8x8x8 cube. We finalized a design that minimizes wires through the space of the cube with the benefit that all wiring comes out the bottom nicely.

Another shot:

A closeup of the bottom:

And one final picture….

Next to help test it, Gene prototyped a few planes of the controller for me to program:

A picture of blinking dots on the monster.

Here is a link (3 MB) to an AVI of it running. Note this is only a test board, and there are not any visualizations yet.

During this phase I determined that the PIC18F4620 does not have enough horsepower to run the 8x8x8 cube flicker free, or if it does, it will be extremely tight on time, limiting the quality of what we can display on it. The resulting decisions and redesign of the controller are covered below in the section on the Gumstix, which will ultimately give us a really nice cube.

### Code and Hardware Changes

From last time, we made a lot of changes to the code, and made some hardware changes.

During this update, I added the following features to the code (the ones I remember):

• A profiler for profiling code. This allowed me to really optimize the main interrupt for refreshes.
• Very robust, 32-bit rand function to get nicer variety. Derived by me using Galois theory, optimized for PIC.
• Palette handling routines.
• Generic path and movement routines.
• Fixed point math for fast rotation/sin/cos/math routines.
• Arbitrary transformation/symmety/translation at the SetPixel level.
• Multiple transitions between visualizations.
• EEPROM storage of rand seeds to change the images every powerup.
• More basic drawing routines like boxes (2D/3D/solid/hollow).
• Code protection to prevent code tampering/copying if we ship these.
• Many helper functions like linear interpolation, smooth palette transitioning, debugging functions.
• A Win32 verson for testing and debugging ease.
• An Easter-egg!

Here is a picture of my markerboard while deriving the necessary items from group theory to implement good symmetry functions, with left and right transformations and inverses possible, using only 1 byte to store all needed information. This allows visualizations to change symmetry in a fluid, reversible, and visually pleasing manner.

We decided to make a few hardware changes, in order to free up the UART pins on the PIC, so we can talk to the 4x4x4 cube from a PC serial port, allowing updating the program easily through an encrypted bootloader, directly playing back visualizations from a PC, or using it as a music visualization tool (the PIC does not have enough power to analyze the sound onboard, so the PC would do it, and send frequency data to the UART). Here is a board diagram showing our "finalized" wiring layout for the cube, so we can make PCBs with the feature that the cube wires directly into them, removing the need for intermediate wiring.

At this point we have about 50 parameterized visualizations and 10 transitions, and since there is variable smooth timing control going on, the number of possible things to see is quite large and varied. I have a lot more visualizations and a few more transitions to do in the code, and then I plan to go through all the visualizations and clean them up to make them as pleasing as possible. Will this code ever be done?!

I also want to add the encrypted bootloader for consumer updates, the ability to play visualizations from a PC through the serial port (which would allow using the cube and a PC as a sound visualization device), and some compression routines to allow faster transfer of data/programs to the cube.

Next we designed a PCB for the 4x4x4 cube, so we can make them in higher quality and quantity. After waiting a few days for our order from Advanced Circuits [www.4pcb.com], it arrives, complete with a complimentary bag of popcorn (since eaten).

Here is one side of our dual layer board, showing the holes for the LED wiring, the chips, and some expansion ports we added for our use in development. Final 4x4x4 cubes will likely have no external interface.

And the moment of truth: one of them is built, with the (optional) wires for our programmer. The final cubes won’t have wires coming off except for power, but since it is almost free to add traces and holes for an optional programmer, we did. During this phase we discovered a few errors in our PCB design: 1) the holes for the LED wires were too small, making us use a different wire, 2) the red and ground wires had their order 0-7 reversed, but the green wires were correct, which fortunately was easily fixable in software using a fast table lookup to reverse bits, and 3) we accidently made the wire spacing larger than intended, which results in a much larger cube than we planned. But overall, the PCBs work!

A final picture showing the new PCB cube running, along with three other sizes we have tried. Overall we prefer the third to largest one, in the lower right. The PCB was supposed to be this size but we miscalculated in our design.

We also designed laser cut acrylic cases (exactly 256 cubic inches in volume), and have them on order, so soon we will have a consumer class piece of hardware, which we hope to sell as kits, as completed items, and in stores. So save up your pennies, boys and girls, because you know you want one of these! For some purchase info see the Main LED Cube page.

### Attack of the Cleaning Lady

At two times during our work, the cubes became mysteriously smashed. For example, here is a picture of one of them one morning.

And here is another smashed cube a few weeks later.

We suspect the cleaning people either knocked them around with sweepers, or perhaps backed a car over them. Oh well, after some rebending and soldering, they were back to working. If the 8 cube gets flattened there will be death and destruction following….

### All work and no play….

During the many late nights coding/soldering/testing, we had a coney dog that I had left over from lunch. In one of our other many experiments, we froze it solid and took a drill to it, resulting in the following. Surprisingly, if you freeze it pretty good, you can drill through solid mustard, onions, bun, and meat. You have not seen the last of this dog…..

### New hardware requirements for the 8x8x8 cube

I computed that the hardware and code we developed for the 4 cube would not run the 8 cube, missing by about 50% of the horsepower we needed, just for refreshing the display fast enough to avoid flicker on the low colors. So we searched around and decided to replace the $10 PIC with a$140 Gumstix (www.gumstix.com). This is a Linux based XScale computer, running at 400MHZ, with 64MB of RAM and 16MB of ROM. This is serious overkill. We order it and a few accessories to learn about, and it arrives. Note the actual gumstix computer (in the pink static bag) fits in the white case, and is literally about the size of a pack of gum!

After some assembly, building our own special serial cable, and screwing around with installing colinux, USB networking, and more futzing around…….

I could SSH into the gumstix and fool around! This will be much better to program for than that PIC, and will give us enough power to do a web interface to the 8 cube, give us FFTs for doing sound analysis directly on the cube, and much much more. Of course it is over 15 times the cost of the old processor……

Hooray! Now I get to program in C++ instead of lame C, and I can develop the entire thing (carefully) using Visual Studio .NET 2005, and then transfer it with minimal changed to the Gumstix. This should greatly speed up development since there will be a lot less compiler problems, the debugger is a lot better, and the overall suck factor of PIC programming vs state of the art Windows C++ devleopment will decrease.

Plus, you can ssh into the 8x8x8 cube. It has doubled in coolness right there.

### New and improved videos:

In case you missed it above, here are a lot of small videos of the cube in action.

### The LED Cube - End 2005

And that is the end of the first few months of cube work. Stay tuned for more…

See also: MainPage, Part II, Part III, Part IV, Videos

Categories:

Tags: