Wave Shield and TLC5940
Moderators: adafruit_support_bill, adafruit

Wave Shield and TLC5940

by abcd_ca on Wed Oct 02, 2013 12:31 pm

Is it possible to use the TLC5940 (LED driver) with the Wave Shield? 4 of the pins needed by the driver are already in use by the Wave Shield. From what I can tell, if I switch the driver to using bit banging mode, I can arbitrarily change two of the pins in tlc_config.h. Apparently the pinouts for my Uno are configurable here.

I would love some guidance on how to make this possible, otherwise I'll probably resort to either using less LEDs and not use the driver, or get another arduino just for the lights and connect the two via serial (incidentally, would I just need to connect each others' tx/rx for that(in reverse)?)

P.S.

Thanks!

Andrew
abcd_ca
 
Posts: 11
Joined: Wed Oct 02, 2013 12:23 pm

Re: Wave Shield and TLC5940

by adafruit_support_bill on Wed Oct 02, 2013 1:25 pm

If it is well-behaved SPI, you should be able to just change the CS pin and share the bus with the SD card. The libraries for our LED/PWM breakouts let you specify any combination of pins in the constructor. http://www.adafruit.com/products/1429#Description
User avatar
adafruit_support_bill
 
Posts: 29162
Joined: Sat Feb 07, 2009 9:11 am

Re: Wave Shield and TLC5940

by abcd_ca on Wed Oct 02, 2013 2:08 pm

Thanks for the quick response!
These are the pins that the driver is using. I believe it will let me change Arduino pins 13 and 11. Which one are you saying is the CS pin? Assuming I could change that, I'd still be left with one conflicting pin no?

From the BasicUse example:
Code: Select all | TOGGLE FULL SIZE

    Basic Pin setup:
    ------------                                  ---u----
    ARDUINO   13|-> SCLK (pin 25)           OUT1 |1     28| OUT channel 0
              12|                           OUT2 |2     27|-> GND (VPRG)
              11|-> SIN (pin 26)            OUT3 |3     26|-> SIN (pin 11)
              10|-> BLANK (pin 23)          OUT4 |4     25|-> SCLK (pin 13)
               9|-> XLAT (pin 24)             .  |5     24|-> XLAT (pin 9)
               8|                             .  |6     23|-> BLANK (pin 10)
               7|                             .  |7     22|-> GND
               6|                             .  |8     21|-> VCC (+5V)
               5|                             .  |9     20|-> 2K Resistor -> GND
               4|                             .  |10    19|-> +5V (DCPRG)
               3|-> GSCLK (pin 18)            .  |11    18|-> GSCLK (pin 3)
               2|                             .  |12    17|-> SOUT
               1|                             .  |13    16|-> XERR
               0|                           OUT14|14    15| OUT channel 15
    ------------   


Alternatively, you're saying that with your 24 channel breakout I would use that instead of the driver I have eh? How about this one? Same idea but with 12 channels instead of 24? That might be enough for my project.
abcd_ca
 
Posts: 11
Joined: Wed Oct 02, 2013 12:23 pm

Re: Wave Shield and TLC5940

by adafruit_support_bill on Wed Oct 02, 2013 3:23 pm

The wave shield uses pin 10 for CD. Pins 6, 7, 8, 9 and the 6 analog pins are all free.

Don't know much about the TLC5940, but from your diagram, it looks like it need 5 pins for control.
We have both a TLC5947 -based 24-port board and a TLC5971-based 12-port board: http://www.adafruit.com/products/1455
Both of these can be controlled with any 3 pins.
User avatar
adafruit_support_bill
 
Posts: 29162
Joined: Sat Feb 07, 2009 9:11 am

Re: Wave Shield and TLC5940

by abcd_ca on Wed Oct 02, 2013 3:29 pm

Thank you re: pin 10. It's a bit hard to see in my code post there, but you'll need to scroll down in it to see that pin 3 is there too. The driver and the wave shield both need it. Any thoughts on how I can maybe move that one? I may well end up picking up one of your drivers but for the sake of completing this thread I'm curious about pin 3 still.
abcd_ca
 
Posts: 11
Joined: Wed Oct 02, 2013 12:23 pm

Re: Wave Shield and TLC5940

by adafruit_support_bill on Wed Oct 02, 2013 3:34 pm

Pin 3 is one of the pins used to control the DAC on the wave shield. You can change the jumpers to map it to a different pin, but you need to hack the WaveHC library and change it there too.
User avatar
adafruit_support_bill
 
Posts: 29162
Joined: Sat Feb 07, 2009 9:11 am

Re: Wave Shield and TLC5940

by abcd_ca on Wed Oct 02, 2013 3:52 pm

Thanks!
abcd_ca
 
Posts: 11
Joined: Wed Oct 02, 2013 12:23 pm

Re: Wave Shield and TLC5940

by abcd_ca on Sun Oct 27, 2013 1:05 pm

Hello, I abandonned the use of my TLC5940 LED driver and haven't received my Adafruit one as it appears my order is delayed through a distributor. So, I'm trying to fade in and out two white LEDs with two PWM pins instead and I'll forego having lots of lights.

Given the available digital pins you cited above, I am trying to use PWM on 6 and 9 (these are in fact PWM pins on Arduino UNO).

When the only code I have in my app is the fades, they fade in and out as expected on those pins. However, when I enable my wave shield code, the LEDs remain fully lit, with no fades. I've narrowed it down to this block of code:

Code: Select all | TOGGLE FULL SIZE
// look in the root directory and open the file
  if (!f.open(root, name)) {
    Serial.print(F("Couldn't open file ")); Serial.print(name); return;
  }


Specifically, it's the f.open() I believe. Its as though the FatReader (f) is using pin 9 to read from the SD card. Could this be?

If so, I would also be happy to run the two LEDs off the same pin, having them fade in unison. I currently have a 220 Ohm resistor on each, would I half that – put the lights in series with one 110 Ohm resistor?

Thanks!

Andrew
abcd_ca
 
Posts: 11
Joined: Wed Oct 02, 2013 12:23 pm

Re: Wave Shield and TLC5940

by adafruit_support_bill on Sun Oct 27, 2013 2:09 pm

The shield doesn't use pin 9. But if opening a file is causing a problem, then I would suspect that you have a memory (SRAM) problem. http://learn.adafruit.com/memories-of-an-arduino
User avatar
adafruit_support_bill
 
Posts: 29162
Joined: Sat Feb 07, 2009 9:11 am

Re: Wave Shield and TLC5940

by abcd_ca on Sun Oct 27, 2013 9:07 pm

I originally suspected an SRAM limitation but apparently I have 249 bytes free (using the freeRam function in WaveUtil.cpp). Furthermore, if I use pin 6 and not also pin 9, I get fading and everything else in my app functions. If I use only pin 9 and not 6 I get a solid light and the wave shield starts to play my startup sound then stops and everything is halted, no more output. So, it still seems to me to be something specific to pin 9, wouldn't you say?

Thoughts about using the same pin 6 with LEDs in series?
abcd_ca
 
Posts: 11
Joined: Wed Oct 02, 2013 12:23 pm

Re: Wave Shield and TLC5940

by abcd_ca on Sun Oct 27, 2013 10:54 pm

Still curious about pin 9 but for lack of time before Halloween I figured out my math and circuitry and ended up putting 200Ohms on each bulb in parallel, sharing pin 6. Total current, 16mA at full brightness. Seems to be working fine and I have 249 bytes of mem still.
abcd_ca
 
Posts: 11
Joined: Wed Oct 02, 2013 12:23 pm

Re: Wave Shield and TLC5940

by adafruit_support_bill on Mon Oct 28, 2013 5:20 am

I think it is a timer conflict. The wave shield uses one of the timers to clock updates to the DAC. I believe it is the same timer used for PWM on pin 9.
User avatar
adafruit_support_bill
 
Posts: 29162
Joined: Sat Feb 07, 2009 9:11 am

Re: Wave Shield and TLC5940

by abcd_ca on Mon Oct 28, 2013 4:18 pm

OK thank you!
abcd_ca
 
Posts: 11
Joined: Wed Oct 02, 2013 12:23 pm