Show Posts
Pages: [1]
1  Products / Arduino Due / Re: Timer Interrupts on Due on: November 19, 2012, 12:32:46 pm
Using this code, you can set a timer for any of the ISRs TC0_Handler through TC8_Handler, see table of parameters below. It is possible to use the timers without a physically mapped pin, such as TC1 channel 0 (TC3_Handler) shown here:

Code:
volatile boolean l;

//TC1 ch 0
void TC3_Handler()
{
        TC_GetStatus(TC1, 0);
        digitalWrite(13, l = !l);
}

void startTimer(Tc *tc, uint32_t channel, IRQn_Type irq, uint32_t frequency) {
        pmc_set_writeprotect(false);
        pmc_enable_periph_clk((uint32_t)irq);
        TC_Configure(tc, channel, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK4);
        uint32_t rc = VARIANT_MCK/128/frequency; //128 because we selected TIMER_CLOCK4 above
        TC_SetRA(tc, channel, rc/2); //50% high, 50% low
        TC_SetRC(tc, channel, rc);
        TC_Start(tc, channel);
        tc->TC_CHANNEL[channel].TC_IER=TC_IER_CPCS;
        tc->TC_CHANNEL[channel].TC_IDR=~TC_IER_CPCS;
        NVIC_EnableIRQ(irq);
}

void setup(){
        pinMode(13,OUTPUT);
        startTimer(TC1, 0, TC3_IRQn, 4); //TC1 channel 0, the IRQ for that channel and the desired frequency
}

void loop(){
}

Here is the table of parameters:
ISR/IRQTC        ChannelDue pins
TC0TC002, 13
TC1TC0160, 61
TC2TC0258
TC3TC10none  <- this line in the example above
TC4TC11none
TC5TC12none
TC6TC204, 5
TC7TC213, 10
TC8TC2211, 12

Noob question here, could someone please explain the inputs to the startTimer function? What is channel, and how do we use the frequency input?  Also, what are the pins in the table for?
2  Using Arduino / LEDs and Multiplexing / Re: Driving A 10x10x10 RGB Cube on: November 17, 2012, 12:37:32 am
Another thing that crossed my mind is where you are going to store the data for multiplexing the cube. With the equivalent of 3000 LEDs storing 12 bits per LED is going to take 4500 bytes. Cutting this down to 1 byte per pixel still gives 3K which means you will have to use a Mega.

Aware of this, using a teensy++2.0 right now, but will probably switch to an arduino duo if i can get my hands on one.  Also, I plan to send the data from my computer to the mcu in real time before i try hard-coding some into the chip.

Quote
Simulating it should be easy enough, you don't need to build a cube, just have one TLC5940, one power FET and then drive it as if there were 19 chained TLC5940s and 10 FETs, then you can see if you can get the data and spit it out fast enough. The eye is often more sensitive to point sources of illumination flickering than to diffused areas.

That's true, great idea!  I will give this a try as soon as I get my transistors in next week.

Quote
Quote
I probably won't be running the LED's at the full 20mA anyways, since it might be too bright to look at.
Are you sure with a 10 to 1 on / off ratio?

I plan on seeing how it looks and adjusting the current to my liking.  The experiment you suggested would be a great way to experiment with this.

Quote
Lets hope you have a good scope.

I do smiley

Quote
Quote
Not really sure what your issue is here.
Well it's your issue actually but switching that much current at that frequency on the end of long wires one of the issues will be radio frequency emission causing interference to the controller. There will also be problems caused by reflection of signals at impedance discontinuities ( the end of the line ) , and ground bounce, are just three that immediately spring to my mind.

I know its half the LED's, but I've seen functional RGB 8x8x8's that didn't have these issues.  I think you may be over thinking this a bit with the radio frequency emissions.  I'm planning to use push-pull's on the clock/data lines because of the large traces and fanout.  Ground bounce? Maybe...but if I use separate supplies for the LED's and the IC's, then I don't see too big of an issue here.
3  Using Arduino / LEDs and Multiplexing / Re: Driving A 10x10x10 RGB Cube on: November 16, 2012, 07:01:58 pm
Quote
What major problems do you see in the electronics?
As you said:-
Quote
from switching 15A of power on/off quickly

Quote
(Separate 5V PSU with lots of capacitors on the output? Thick wires for all GND connections?)
If it were only that simple.

15A!?  Please double check your math.  Each layer is 10x10, with 3 pins per LED, for a total of 300 pins.  Each pin will drive a max of 20mA, 300x20mA = 6A.  I'm planning to use this power supply to drive the LED's: http://adafruit.com/products/658.  With large enough decoupling caps between Vcc and Gnd on each chip, this shouldn't be an issue.  Not really sure what your issue is here.  I also bought high power mosfets rated for 100V and 40A to handle the switching.  http://www.irf.com/product-info/datasheets/data/irf5210pbf.pdf  I probably won't be running the LED's at the full 20mA anyways, since it might be too bright to look at.

Quote
That is what worries me. You need to make a realistic prototype of a tiny corner of what you plan, run it at the rate the real thing will run before you know if your design is feasible.  

I plan on building a 4x4x4 with a scaled version of the circuit and to practice different techniques of assembling the cube.  However, it's hard to tell from a smaller version if something this large will work because I won't be hitting the same limitations.

Quote
Good so you know what is involved with 500 LEDs, now you want to scale it up to 3000. Scaling up is not easy, you don't just make more. There are lots of things to consider with switching so much current so quickly. I would have thought the TLC5940 was not the best choice as you have to synchronise the multiplexing to the refresh rate.

I thought they would be a better choice than shift registers because I have to chain together a large amount of IC's.  I used shift registers for my 8x8x8.  If I use shift registers I would need to drive a much faster clock through the board to manually handle the PWM.  What do you think is the best choice and why?

Quote
Best of luck with your project. Please post in the exhibition section when you have it working.

Will do, but getting there will not be trivial, and I appreciate the guidance from those who are more experienced in this area than I am.  I'm considering making a build thread to document my progress for those who are interested.


Quote

Having built a 5x5x5 cube, while finding designing, building, debugging the hardware challenging it was at least something I enjoyed and progress was mostly trouble free. The software was another kettle of fish however. The basic scanning of the cube was pretty simple but I found that the 'creative part' of coming up with interesting pattern shows was so very very tedious and very time consuming and I soon lost interest after defining about six basic patterns including a simple random pattern using a RNG. What I really longed for was a PC based GUI pattern editor that I could use to 'visually' build patterns, scan by scan, and then be able to upload the pattern into the arduino driven cube. But of course my PC software skills would never allow me to write such a application. So now when I watch cube being demonstrated on U-tube or wherever, I've really come to appreciate the artistic effort that some have mastered. So in effect the software is the biggest overall factor is the quality of the finished project.

Lefty

I'm a verification engineer, so my job involves both hardware and software, so I'm not really worried about the software side.  I will make a GUI for this, and I have a few other ideas planned as well.  That being said, what I am concerned about is the low-level code on the MCU to handle the multiplexing of all the layers.  There are libraries available that I can adapt to my needs, but I don't know if they will be fast enough to handle what is essentially a 300x10 matrix.
4  Using Arduino / LEDs and Multiplexing / Re: Driving A 10x10x10 RGB Cube on: November 16, 2012, 04:51:00 pm
Quote
it seems like he should probably make something smaller to get some practice with electronics, TLC5940s, Arduino programming, etc.
Let's face it. The OP is never going to make a 10 X 10 X 10 cube, it is one of those over ambitious things a newcomer wants to do. It is a lot more complex than just getting the right circuit and wiring it up. I wouldn't attempt this myself and I have got a bit of experience. I would say that there is over six months of work here.

Excuse me, but you don't know me well enough to make that judgement.  First of all, I have a degree in Electrical Engineering and I have a very good work ethic.  When I decide to do something, I do whatever it takes to accomplish my goals.  I've already made an 8x8x8 cube and fabricated my own PCB at home.  The kind of things we are discussing here are not the kind of things that one learns in college, they are specific to a platform I am currently unfamiliar with.  I am asking for advice from people who have more experience in areas I do not, that doesn't mean I'm stupid or unwilling to put the work in myself.  I've already bought most of the parts, fabricated a jig, and straightened most of the wires.  I expect this project to take a few months, and I'm ok with that.  I'm here to learn and I'm willing to listen to your advice, but please don't make such unfair assumptions.
5  Using Arduino / LEDs and Multiplexing / Re: Driving A 10x10x10 RGB Cube on: November 15, 2012, 05:39:40 pm

300 LEDs per layer means he'll need 19 driver chips. At 24 bytes of data per chip that makes 456 bytes per layer, 3648 bits total.

The SPI bus can send a byte in 17 clock cycles (see thread a couple of weeks ago). The Arduino runs at 16mHz so he can send that much data over 2000 times per second even with a bit of overhead for processing/sequencing.

He can cut the TLC5940's PWM cycle short at the end of each transmission, latch the PWM data and start on the next layer. With ten layers he can update the cube 200 times/sec. - a perfectly acceptable rate.

These calculations look correct, based on the fact that you can send a byte in 17 clock cycles.  I'm a bit skeptical though, because adding a delay of more than 10 in the code above causes the lights to flicker/blink.  I'd like to see where you found that, could you post a link?

Quote
(You mean 10 to 1...?)
Well no, I was assuming, and said, that he was going to multiplex so that one column of one plane would be on at any one time. Now if you are going to drive it with 300 LEDs in one plane all on at the same time then yes it is only 10 to 1. However that means he will have to have 300 / 16 = 19 TLC5940 to drive it. While not impossible, there needs to be some signal buffering going on, proper construction and good layout. It is not something you are going to make on bread board.

Maybe not a breadboard...but a perfboard, maybe?  Last time I tried to make a large pcb at home using toner transfer it was a real challenge...I'm hoping not to have to resort to that again.

Quote
It can drive 120mA per pin
Yes that is the current, now work out the power dissipation that will cause in the chip and you will find you can't run the chip at that current.

I only need to drive the LED's at 20mA or less, so this shouldn't be a problem.
6  Using Arduino / LEDs and Multiplexing / Re: ShiftPWM support topic. Latest update: Schematics, high power LED's, LED strips on: November 14, 2012, 08:10:28 pm
@milamber Thank you for the link!  Is shiftMatrixPWM being actively developed alongside ShiftPWM?  If so, where can I get the latest version?

I think it may be possible to do this using the ardunio uno.  Has anybody tried using the uno to control shift registers running at 5V using something like this: http://rocky.digikey.com/WebLib/Texas%20Instruments/Web%20data/SN74LVC4245A.pdf ?  Would this work?
7  Using Arduino / LEDs and Multiplexing / Re: Driving A 10x10x10 RGB Cube on: November 14, 2012, 07:13:53 pm
tlc.update() always returns immediately. It doesn't wait for the LEDs to update.

You need to look at the flag returned by tlc.update() and wait for it to return a 0m like this:

Code:
while (tlc.update()) {
}


Thanks, I'll give this a try! I am still having serious doubts now about these chips being fast enough to drive the cube.  Is there any hardware limitation here? Do I need to use an arduino due to acheive the kind of perfomance required to multiplex 300 pins across all 10 layers quickly enough for persistence of vision?  If so, will these chips work with 3.3V inputs and 5V outputs?

Another idea/question: are there any chips out there that would support sending out the data to 3 sets of these chips at once (one for red, one for green, one for blue)?
8  Using Arduino / Project Guidance / Re: 10x10x10 RGB LED Cube on: November 14, 2012, 07:08:23 pm
10x10x10x3 = 3000 LEDs.  You'll need 188 TLC5940's to drive them.  To load those you need 12 bits * 3000 LEDs or 36,000 bits.  At 8 million bits per second (SPI's highest speed, I think) you'd be able to update the entire cube over 220 times per second.  I don't think you will have a hardware limitation, at least as far as pushing bits through SPI.

Does the library you are using use the SPI pins and SPI hardware or does it do the shifting in software?

An alternative would be to use 38 shift registers to drive the 300 columns and two more to drive the 10 planes.  40*8 = 320 bits per plane per update.  For all 10 planes that's 3,200 bits.  At 8 Mbps that's 2500 updates per second.  At 32 levels of brightness that's about 78 updates per second.

Hmm...I think your calculation is a little off.  To control the cube I need to control each of the layers (10x10x3 = 300 pins) plus the layer select (10, 1 for each layer).  To animate something on the cube, I need to be able to update 300 pins and select a layer repeatedly 10 times over and over, quickly enough to acheive perstistence of vision so the LED's don't look like they're flickering.  Every time I select a layer I have to re-update the 300 pins.

Also, I'm using the standard arduino tlc5940 library.
9  Using Arduino / LEDs and Multiplexing / Re: ShiftPWM support topic. Latest update: Schematics, high power LED's, LED strips on: November 14, 2012, 01:39:51 pm
Looking for some advice here...how well does this library work when you start trying to multiplex the LED's?  Is there any built in support for that?  I'm looking to drive 100RGB led's multiplexed 10 times for a 10x10x10 RGB LED cube, would this be the fastest possible solution? What kind of processing power would I need to achieve persistence of vision across all 10 layers?
10  Using Arduino / LEDs and Multiplexing / Driving A 10x10x10 RGB Cube on: November 14, 2012, 01:30:19 pm
I need some advice on how to drive a 10x10x10 RGB LED cube.  It basically comes down to 300 pins multiplexed 10 times for the 10 layers.  My first thought was to use TLC5940's, but I tried a simple test of just turning all the pins on one on and off as fast as I could.  However, there was noticeable flickering in the LED's, so I'm having my doubts.  If I can't even achieve persistence of vision on 16 pins, how could I possibly do it with 300 multiplexed 10 times?  Here's the code I used for reference (Note I was using a Teensy++2.0):

Code:
void loop()
{
  int i = 0;
  while(1){
    //Tlc.clear();
    if(i == 1){
      Tlc.set(1, 4095);
      Tlc.set(2, 4095);
      Tlc.set(3, 4095);
      Tlc.set(4, 4095);
      Tlc.set(5, 4095);
      Tlc.set(6, 4095);
      Tlc.set(7, 4095);
      Tlc.set(8, 4095);
      Tlc.set(9, 4095);
      Tlc.set(10, 4095);
      Tlc.set(11, 4095);
      Tlc.set(12, 4095);
      Tlc.set(13, 4095);
      Tlc.set(14, 4095);
      Tlc.set(15, 4095);
       i = 0;
    }else{
      Tlc.set(1, 0);
      Tlc.set(2, 0);
      Tlc.set(3, 0);
      Tlc.set(4, 0);
      Tlc.set(5, 0);
      Tlc.set(6, 0);
      Tlc.set(7, 0);
      Tlc.set(8, 0);
      Tlc.set(9, 0);
      Tlc.set(10, 0);
      Tlc.set(11, 0);
      Tlc.set(12, 0);
      Tlc.set(13, 0);
      Tlc.set(14, 0);
      Tlc.set(15, 0);
      i=1;
    }
    Tlc.update();
    //delay(300);
  }
}

Is there a way to speed things up here, or should I scrap the TLC5940's entirely for something else?  I've heard about other people using shift registers, would that be fast enough?
11  Using Arduino / Project Guidance / 10x10x10 RGB LED Cube on: November 14, 2012, 03:01:29 am
A couple years back, I built an 8x8x8 cube with blue LED's following a guide on instructables that everyone here is probably familiar with.  I recently decided that I wanted to make an RGB LED cube, and I noticed that Arduino had a TLC5940 library. I had a Teensy ++ 2.0 lying around from another project (http://www.pjrc.com/teensy/index.html), and I noticed that it's compatible with Arduino (http://www.pjrc.com/teensy/teensyduino.html).  I purchased 1500 common annode RGB LED's and 20 TLC5940's.  I got my TLC5940's in the mail today, and I tried a simple test, and it looks like I've encountered a pretty serious problem. 

Code:
void loop()
{
  int i = 0;
  while(1){
    //Tlc.clear();
    if(i == 1){
      Tlc.set(1, 4095);
      Tlc.set(2, 4095);
      Tlc.set(3, 4095);
      Tlc.set(4, 4095);
      Tlc.set(5, 4095);
      Tlc.set(6, 4095);
      Tlc.set(7, 4095);
      Tlc.set(8, 4095);
      Tlc.set(9, 4095);
      Tlc.set(10, 4095);
      Tlc.set(11, 4095);
      Tlc.set(12, 4095);
      Tlc.set(13, 4095);
      Tlc.set(14, 4095);
      Tlc.set(15, 4095);
       i = 0;
    }else{
      Tlc.set(1, 0);
      Tlc.set(2, 0);
      Tlc.set(3, 0);
      Tlc.set(4, 0);
      Tlc.set(5, 0);
      Tlc.set(6, 0);
      Tlc.set(7, 0);
      Tlc.set(8, 0);
      Tlc.set(9, 0);
      Tlc.set(10, 0);
      Tlc.set(11, 0);
      Tlc.set(12, 0);
      Tlc.set(13, 0);
      Tlc.set(14, 0);
      Tlc.set(15, 0);
      i=1;
    }
    Tlc.update();
    //delay(300);
  }
}

With the delay commented out completely, there is still noticeable flickering in the LED's.  What is causing this?  Are the TLC5940's too slow to work in this application?  The Teensy++2.0 runs at 16MHz, so I doubt that is what's causing the slowdown.  Has anyone successfully made an LED Cube using the TLC5940's?  Is an extensive rework of the standard library needed to get this working properly?

I'm willing to switch to shift registers or something more basic if that's a better approach.  Are there shift registers that would be fast enough and provide variable outputs to the LED's?  Some guidance would be greatly appreciated.  Thanks.

Pages: [1]