Show Posts
Pages: [1] 2 3 4
1  Using Arduino / LEDs and Multiplexing / Re: Using a Photocell to turn on an LED when it's dark on: March 06, 2014, 07:11:33 am
Hi,

I think you could try reversing the map function...

lightlevel = map(lightlevel,  0, 900, 255, 0)

Good luck
2  Using Arduino / LEDs and Multiplexing / Re: TLC5940 Daisychain glitch on: February 03, 2014, 05:50:38 am
I have tried all the variations of switching the chips and switching the data inputs, a-b, b-a kinda thing - same issues.

But when you say the same, do you mean the same phyical chip has the problem, or the problem moves to the chip that's now second in the chain? (I guess it must be the latter, if it was the former you would have worked out that you have a faulty chip by now!)

Thanks for the reply Paul - forgot to reply earlier smiley-small/

Yes tried all that - physically switched the chips, and switched the SIN from chip1 to chip2 and re-arranged the SOUT/SIN linkup, funny that its the exact same glitch which makes me think its in the wiring somehow as I ruled out a code fault.

3  Using Arduino / LEDs and Multiplexing / Re: TLC5940 Daisychain glitch on: February 03, 2014, 05:23:20 am
Hi Mike,
Thanks for reading my code, I appreciate that.   J is set to loop from 0 to 9 , h changes from 0 to 1 above 4 (second chip).
Your answer tells me the code is essentially correct, I didn't miss a command.
I think next step is checking the wiring . . . .

-----------------------------------------------------------
r = (3 * j) + 0 + h;  -->    {0,3,6,9,12,16,19,22,25,28}

r = (3 * j) + 0 + (h * 16);   -->  {0,3,6,8,12,31,34,37,40,43}
4  Using Arduino / LEDs and Multiplexing / Re: Flickering on LED Array on: February 02, 2014, 05:53:43 am
This is how I would have pictured the flickering led's from noise. I am not sure, I have never seen it, but check your capacitors, or put some in...

Capacitors are good.  But the flashing left-side square looked more like a program glitch than the erratic flashing from noise.
5  Using Arduino / LEDs and Multiplexing / Re: TLC5940 Daisychain glitch on: February 02, 2014, 05:38:16 am

And just to comment.. I know that the multiplier in the set statement should be 16 rather than 4 ,  but 4 looks bright enough for this demo - and I'm not exactly sure of my IREF resistor value, so I don't want to overload the Arduino.  So values result at 0-1024 rather than 0-4096.  It even works the same (but dimly) with no multiplier.

Everything is powered by Arduino 5V and works great with the two chips in parallel,  or either separately.

6  Using Arduino / LEDs and Multiplexing / Re: TLC5940 Daisychain glitch on: February 02, 2014, 05:23:31 am
OK, this is the entire sketch copied from Arduino 1.0.5-r2

Code works well, except when daisychaining . . . . .

Code:

   // LED sketch adapted from: http://lizarum.com/assignments/physical_computing/2009/leds/tlc5940.html


#include <Tlc5940.h>   // Set <#define NUM_TLCS    2> in <TLC_config.h>
  int i = 0;  // Defining the variables .. and some spares
  int c = 0;
  int j = 0;
  float n = 0;
  int X = 0;
  int Y = 0;
  int h = 0;
  int d = 0;
  int d2 = 0;
  float p = 0;
  int red = 150;
  int green = 150;
  int blue = 150;
  int r = 0;
  int g = 0;
  int b = 0;
  int oldred = 150;
  int oldgreen = 150;
  int oldblue = 150;
  int newred = 0;
  int newgreen = 0;
  int newblue = 0;
  int LED[2][4];
  int valmin = 0;
  int valmax = 0;
 
 
void setup(){   // Main program loop
  Tlc.init();   // Initialise the TLC59402 to blank
}

void loop(){

  do {          // Select the next colour to fade to
   valmin=255;
   valmax=0;
   newred = random(254);
   if (valmin > newred) valmin = newred;
   if (valmax < newred) valmax = newred;
   newgreen = random(254);
   if (valmin > newgreen) valmin = newgreen;
   if (valmax < newgreen) valmax = newgreen;
   newblue = random(254);
   if (valmin > newblue) valmin = newblue;
   if (valmax < newblue) valmax = newblue;
   i = valmax- valmin;
  } while (i < 240);      // Just checking for a definite colour, not off-white
   
   
   for (p = -1; p < 12; p = p + 0.03){  // Loop for each 'frame'

   for (j = 0; j < 10; j++){            // Loop for each LED
     if (p < j) {
      red = oldred;                     // Not at fade yet
      green = oldgreen;
      blue = oldblue;
       }
       else if (p > j+1.5) {            // Fade complete, show new colour
      red = newred;
      green = newgreen;
      blue = newblue;
       }
      else {                            // Fade sequence
      n = p-j;                          // How far into fade
      red = oldred + (n * (newred - oldred) / 1.5);  // Fade increment
      constrain(red, 0, 254);           // In case of math error
      green = oldgreen + (n * (newgreen - oldgreen) / 1.5);
      constrain(green, 0, 254);
      blue = oldblue + (n * (newblue - oldblue) / 1.5);
      constrain(blue, 0, 254);
      }
       
     //LED[0][j] = red;   // Array not required in this sketch
     //LED[1][j] = green;
     //LED[2][j] = blue;
     h=0;                // Chip number
     if (j>4) h=1;       // Second daisychained chip starting at 16
         
     r = (3 * j) + 0 + h;   //
     g = (3 * j) + 1 + h;
     b = (3 * j) + 2 + h;
     
     Tlc.set(r,red * 4);
     Tlc.set(g,green * 4);
     Tlc.set(b,blue * 4);

   }
     Tlc.update();
     d = random(2,10);
     delay(d);   
     
   
   }
     Tlc.update();
     d = random(1000, 10000);
     delay(d);   
     
     oldred = newred;
     oldgreen = newgreen;
     oldblue = newblue;
}
 



7  Using Arduino / LEDs and Multiplexing / Re: Control RGB Led with joystick on: February 01, 2014, 09:51:34 pm
Well he could map *some* of the colours with the joystick...

Use
UP=Red
Down=Green
Left=Blue
Right=Red+Green (Yellow)

That would give centre=OFF .. you could also have centre=ON(White) and each direction is Minus the colours listed above.

Anyway, good luck smiley
8  Using Arduino / LEDs and Multiplexing / Re: TLC5940 Daisychain glitch on: February 01, 2014, 09:41:18 pm
I checked that URL and my setup looks good.

I thought it might be my code, and the way I address the second chip using the library commands . . . 

Code:

        //  ** This is just a snippet where I could have an error in how I address each LED
        //Do loop iterating through   J= 0 to <10    -where J is the LED number
       // if J>4 then P=0 --> P=1      This allows for the 16 outputs on the chip, but only 15 being used

     r = (3 * j) + 0 + p;       // Calculating the pin number required
     g = (3 * j) + 1 + p;
     b = (3 * j) + 2 + p;
     
     Tlc.set(r,red);            // Clocking in the data for each pin, loop back to next LED
     Tlc.set(g,green);
     Tlc.set(b,blue);

   }                                      // End of DoLoop setting each pin's data

     Tlc.update();              // Latching the data to display the frame
 

Each TLC5940 has 16 outputs (0 --> 15)
Is it right to just continue with a Tlc.set(14,<value>),  <skip pin 15> ,  Tlc.set(16,<value>) ,  Tlc.set(17,<value>)  or is there another command for the second chip?

If this appears correct I will try to post a pic fwiw,   but I think the wiring is OK as I said, each chip-circuit works fine individually and with both in parallel.

 - But with with Neo(11) --> SIN(26Chip1)   then  SOUT(17Chip1) --> SIN(26Chip2)  the second chip output misbehaves as detailed above.

9  Using Arduino / LEDs and Multiplexing / Re: TLC5940 Daisychain glitch on: February 01, 2014, 07:03:51 pm
Thanks for replies Paul and GM

I have tried all the variations of switching the chips and switching the data inputs, a-b, b-a kinda thing - same issues.  Also, I was puzzled by the rail-split earlier but jumped across it.  I could post a pic, but I used the standard ~25cm jumpers so its a bit of a spaghetti pile...

The circuit was very flickery before capacitors - the one across the +/- rails made a huge difference, but not 100% .. with the smaller caps near each chip it is steady as a rock.  I used the little round brown ones (?ceramic).

The small capacitors are  near each of the chips at 19/20 (DCPRG/IREF) .. after checking that, I thought I would try 21/22 (GND/VCC) but just as good, but with the same daisychain glitch.

Next, I will have a look at that link of the 3x daisychain  (Thanks again!)

10  Using Arduino / LEDs and Multiplexing / TLC5940 Daisychain glitch on: February 01, 2014, 08:27:33 am
Hi

I have a breadboard circuit with Arduino NEO and two TLC5940s controlling 5RGB LEDs each.  The program uses the TLC5940 library.   I had to use capacitors to settle the flicker which worked great.  The software makes a new colour fade across the LED row periodically.

When I connect the SIN of each chip direct to the Arduino, the sequence works perfectly, if I connect the SIN of both, in parallel they both work perfectly.

BUT If I connect the SOUT  of the first 5940 to the SIN of the second 5940, the first chip's LEDs work well, but on the second chip, the first LED operates in parallel with the first LED of the first 5940 and the rest of the LEDs stay in a fixed bright state.

I have the code feeding in the full 32-value data set, and I changed the number of chips in TLC_config.h to #define NUM_TLCS    2

Is there some other setup I need to do to get the daisy-chain working?
11  Using Arduino / Project Guidance / Re: New here - Planning a 5x5x5 on: May 29, 2012, 04:39:29 am
Added the jumpers to join the emitters in the multiplex grid, fixed the plug leads, swapped the PWM pins onto the anode planes.  Now nothing works.  

Could I have cooked the transistors by over-soldering?  They look OK and have about 5mm of leg-length.

This is becoming quite a mystery.
12  Using Arduino / Project Guidance / Re: New here - Planning a 5x5x5 on: May 28, 2012, 02:06:55 am
I had a good look at the board under a microscope at work, and the solders are great.  I removed some residual copper from the drill-holes that may have been shorting.  Also two of the HM3410 header plugs had a loose wire.  But the embarrassing bit is, I left out the wiring to bridge the emitters in the transistor grid   smiley-red
I might have to solder that on the back of the board - 20 jumpers.

So I have no idea how the LEDs were getting any power at all.

More later...
13  Using Arduino / Project Guidance / Re: New here - Planning a 5x5x5 on: May 27, 2012, 01:19:07 am
Thanks, that D14-19 will help a lot.

Trouble is, with the code below, I get incomplete vertical planes of LEDs coming on sequentially instead of individual lights, and the last plane never lights up.  In the first cycle, horisontal-plane 1 is OFF, in the next cycle horisontal-plane two is OFF etc.  So I'm wondering if the code is wrong - or maybe I have a fundamental wiring error.

There are so many sources of error it's hard to figure.  I'll have to look at my soldering for bridging.  Also check the board drill holes for any errant residual copper.  The solders appear to have good flow and minimal excess, but this is making me think I need better glasses.  I had to mount the transistors on adjacent rails to fit it all on the ~30x34 hole board.

Also, the LED grid itself might have some bad solders.. there were some dry joints that failed while I was setting the LED framework into the support-base which I re-soldered, but there could even be some LED leg shorts too. 

Code:

int xPin[] = {
  3,5,6,10,11  };  //PWM Pins to bases (multiplex grid)
                  //(Should have PWM running to anode planes - will change later)

int yPin[] = {
  2,4,7,8,12  };   // Bases of grounding transistors (multiplex grid)

int zPin[] = {
  15,16,17,18,19  };  //+5V to LED anode planes via R150

int x;
int y;
int z;

void setup()
{
  for (y=0; y<5; y++){
    pinMode(yPin[y], OUTPUT);
  }
  for (z=0; z<5; z++){
    pinMode(zPin[z], OUTPUT);
  }
}

void loop()
{
  for ( int z = 0; z < 5; z++){
   for ( int y = 0; y < 5; y++){
    for ( int x = 0; x < 5; x++){
      analogWrite(xPin[x], 0);   //Initialisation Loop everything is OFF
      digitalWrite(yPin[y], LOW);
      digitalWrite(zPin[z], LOW);
    }
   }
  }
 
  for ( int z = 0; z < 5; z++){
   for ( int y = 0; y < 5; y++){
    for ( int x = 0; x < 5; x++){ //Loop through each LED in sequence

      analogWrite(xPin[x], 255);
      digitalWrite(yPin[y], HIGH);
      digitalWrite(zPin[z], HIGH);  // Turn LED ON
      delay(200);

      analogWrite(xPin[x], 0);
      digitalWrite(yPin[y], LOW);
      digitalWrite(zPin[z], LOW);  // Turn LED OFF
      delay(500);

    }
  }
}
}


14  Using Arduino / Project Guidance / Re: New here - Planning a 5x5x5 on: May 26, 2012, 09:45:24 am
I have got some lights working now, but not as expected. 

I'll go over the wiring with a multimeter tomorrow and do some troubleshooting.

But I'm still not sure if I'm addressing the A1 to A5 pin outputs correctly.
15  Using Arduino / Project Guidance / Re: New here - Planning a 5x5x5 on: May 26, 2012, 07:36:20 am
All building is done now.

I have made up a controller board to manage the multiplexing.  The circuit is as per CrossRoad's design of 25 transistors with 5 more running the power to ground.  This has connector-plugs to the LED cube and to the Arduino using ribbon cable.

But now I need help with addressing the output pins A1 to A5.

What I have so far:  (Nothing lights up)
Code:

int xPin[] = {
  3,5,6,10,11  };

int zPin[] = {
  2,4,7,8,12  };   

int x;
int z;

void setup()
{
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
pinMode(A4, OUTPUT);
pinMode(A5, OUTPUT);
}

void loop()
{
 
digitalWrite(A1, HIGH);

analogWrite(xPin[1], 255);

digitalWrite(zPin[1], HIGH);  // Turn LED ON

delay(500);

digitalWrite(A1, LOW);

analogWrite(xPin[1], 0);

digitalWrite(zPin[1], LOW);  // Turn LED OFF

delay(500);

}
Pages: [1] 2 3 4