Let's Make Robots!

My LED Cube

Flashes LEDs in cool 3D patterns

Video 3: Completed LED Cube with 8 patterns

 

 

 

 

 

 

 

 

 

 

 

 

 

 I just got the LEDs for the cube yesterday as a backorder from sparkfun. The were for Christmas! I'm using a design where all of the rows on both pairs of levels and all of the columns of both pairs of levels  are connected. That way, I use all 16 outputs of the picaxe 40x1. I will be multiplexing the LEDs Here is what I got done today:

 

100 high-brightness LEDs!

 

the first level in its "mold" (about 3cm spacing)

 

testing the LED

 

first row (common GND)

 

2 rows!

 

The base row mounted on the IRIS System (master control)

 

The picaxe 40x1 (NEVER AGAIN WILL I SOLDER A WHOLE CHIP!)

 

two layers and I'm starting the third right now! (wow, I don't leave myself enough time to post)

 

Orange gloves for insulation because of a few comments below

 

3 layers!

 

The fourth layer is done!

 

This is how i'm going to wire my LEDs. Level one is in the top left and level two is next to it. Level three is below level one and level four is next to it. My picaxe 40x1 has 16 outputs, so I layed out the cube like a grid and have 8 positive controles and 8 negative controls. I will multiplex it.

 

The control board has all of the minimum requirements for the picaxe 40x1 set up and some extra transistors on the side.

 

Completed cube with positive and negative layers done.

 

The guts of the cube from left to right: two LED switching boards, a resistor board, the PICAXE control board.

 

A closer look at the LED control board. It's there to prevent burnouts of my chip.

 

My crazy programing setup.

 

 I removed the protection boards due to loss of current, now I just have to tripple check my code.

 

Look! A cube!!!

 

Multiplexing the whole cube.

 

 I've added a switch and a temporary cover. No more wires hanging out the back!

 

 I've also added 1334 lines of code to the cube. It now plays eight patterns (see video 3)!

 

 I'd like to thank JAX for helping me with the high/low portc commands and birdmum for helping me with the random selection of patterns.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Actually, I'm still using some NPN transistors. To make the columns negative you set it to high. Again, another excellent idea, but I'm just going to keep it simple because I want to move on. Also, the code looks like it takes up more program space. Personally I would like a larger variety of patterns then LEDs of different brightnesses.

NPNs are great. I use a lot of them myself. In fact I just boosted my parts cabinet with 100 PNPs and 200 NPNs and then turned around and ordered two or three hundred more (different ones). At only two to four (US) dollars per hundred, how can we go wrong?  I learned solid-state electronics when everything was still discrete components, so I use transistors a lot for just about everything, whether it is bistable, astable or monostable flipflops, SCR or SCS equivalent circuits, oscillators, rf amps or what-have-you.

As to the code, I did make an editorial note on my other post, but as to variety of patterns, that is really only limited to your imagination and how much programming you care to do.

In that little video I mentioned, all those patterns took nearly 700 bytes.  It could have been more compact, but I wanted to make each sequence a separate subroutine, so they could be called individually, plus an interrupt routine and a main: loop and a 'clear-the-led-data' sub. 

and how do you PWM an LED?

Here is an example interpreted from my own code:

__________________________________________

 

; Sample written for LEDs to light if row is positive and column is negative.
;   This sequence will light 4 leds
;      column1 x row1; column1 x row3; column3 x row1; column3 x row3;

FADE: `   surging brightness increase/decrease

low column1  ;Set the proper columns to ground potential
low column3  ;

for b7= 0 to 255 step 3 ; generate the number to be sent as PWM value
pwm row1,b7,1
pwm row3,b7,1
next b7

for b7= 255 to 0 step -3 ; as this steps down, number sent makes LED dimmer and dimmer
pwm row1,b7,1
pwm row3,b7,1
next b7     ; next PWM value to be sent

high column1  ;Turn off columns (Set the proper columns high which is off.)
high column3  ;

return

__________________________________________

ADDED:

 Of course the heart of it (and the real answer to your question) is simply a single line:

pwm (port pin), (variable -number to send), 1

The last '1' is number of pulses to send at a time. I usually leave this at one, since I am changing the value of the number I am sending each time.

The rest of the lines are just a For-Next loop for increasing the value I am sending (& thereby the brightness), and then another whole For-Next decreasing the brightness.

Check out Picaxe Manual 2, and look at the pwmout and pwmduty commands.

An area where I could use some help is a music tempo sensor...
1. I understand perfectly, but I had a 40x1 on hand and didn't want to complicate an already fine system. 2. Sounds like a good idea, but again, I already have a working system Thanks!

Indeed, I understand.

I thought I would mention those ideas in case you needing more free pins from the picaxe.

Plus, I also considered that others reading this page might be able to utilise the ideas as well.

looks good, though.  Besides flashing the lights, you might also consider PWM pulses for increasing and decreasing brightness in part of your sequences.

Here are a couple suggestions that anyone can try when doing LED displays with multiplexing

(1)  You laid this out as though it were an 8X8 and use 8 outputs from the picaxe for rows and 8 more for columns using a total of 16 pins from the picaxe.  That is perfectly fine, but did you realise that you can use only 6 output pins to achieve the same effect?

There are 3 to 8 decoder chips. (Off the top of my head, I think the 74LS138 is one of those.) Binary is fed into the 3 to 8 decoder as 000,001,010,011,100,101,110, & 111 and each number will decode within the chip into 8 different leads (0,1,2,3,4,5,6, & 7). For the rows only one lead being high at a time, when the right number is fed to the decoder.

Now for the columns, you want them to be the ground side of the LEDs, so for all LEDs to be in an off state, simply run those 8 signals from the second 3 to 8 decoder through inverters (or transistors) and make them all normally high. Only one will be low (gnd) at a time when a signal (1 of 8 posibilities) is fed in. Hmmm, you might actually need one more, a seventh output from the picaxe to disable these, so you can have a state where all the LEDs will be OFF.

 

(2) Another idea you might kick around (but will not work properly if you use the prior suggestion above, but rather only to a limited degree.  Anyway, as you mentioned, your rows are positive to light an LED and your columns are negative. But what if you reverse that? If you make the rows negative and the columns positive?

You can put other LEDs across the same terminals, but reversed in polarity to the original set of LEDs.

If you are thinking that if you do that, some LEDs would be on all the time, you are incorrect. To switch all LEDs off, simply switch both rows and columns to negative outputs, or switch both to positive. With negative (or positive) at both ends of the same LEDs no LEDs can light. If you breadboard it, you will see what I mean. I used that on my little LED flasher board. The blue and green LEDs are wired one direction, while the single white and four reds are wired to the same outputs but in the opposite polarity.

Take a quick look at this video http://www.youtube.com/watch?v=TzlkdM6ZIsg Even though they are wired in reverse polarity you will see occasions where it looks like the red and white are on at the same time as either the greens or the blues. This is that same trick of pulsing the LEDs and then turning them off and when the pulses are fast enough it looks to the eye like they are on continuously at the same time. I did not use them much, since they are the older low output LEDs. If I get some more bright LEDs in pretty colours, I can do some other better effects. I may add more LEDs to the little board, but I need some nice LEDs first.

Anyway, I hope either of these ideas prove a help to you.

 

 well, school has taken over my life at the moment, but don't worry, I'm trying my best to finish it.