SPI communication with multiple LED driver chips MAX7221 + TLC5940 + TPIC6B595

I’m planning to use a Arduino Nano to control 3 ICs:

  1. MAX7221 chip drive an array of 38 LEDs
  2. TLC5940 chip to drive 4 5mm RGB common anode LEDS
  3. TPIC6B595 to drive 8 super bright 5mm LEDs

I want to use hardware SPI for one way communication with all three chips. The Arduino will share its MOSI (Master Out Slave In) pin, and SCLK pin with the 3 ICs, . Each IC will have its own unique SS or CS pin, and when that pin is low, the Arduino will be communicating with that device.

My circuit diagram is attached.

The SPI pins I plan to use on my Nano are:
11 - MOSI
13 - CLCK
10 - SS_TLC5940
8 - SS_MAX7221
7- SS_ TPIC6B595

The MAX7221 has a “LOAD / CS” pin. The TPIC6B595 has a “RCK / LATCH” pin. These two chips seem simple to wire up.

I’m mostly unsure of my TLC5940 wiring and wanted to make it’s correct for hardware SPI. The TLC5940 has no CS pin, but most examples I’ve seen set the Arduino’s default SS pin (10) to output, and connected to the TLC5940’s “Blank” pin:

Does my TLC5940 wiring seem correct for SPI? Any other issues w my schematic?

I’m in the early stages of planning a circuit board in Eagle, and don’t currently own any of these ICs to test SPI communication.

Data sheets:
https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf

Does my TLC5940 wiring seem correct for SPI?

I don’t think you can drive this chip from the SPI bus. It needs constant feeding with pulses to keep it going and is a poor choice of chip. These days the PCA9865 is a better bet. It is an I2C chip and is a set and forget chip. That is you set it going and only need to interact with it when you want to change things.

I'm in the early stages of planning a circuit board in Eagle, and don't currently own any of these ICs to test SPI communication.

Hooray! A new form member who plans ahead and asks questions before rather than after wasting their money on unsuitable components!

However, I would say that planning the circuit board at this stage is premature. By all means use Eagle to draw your schematic. Then prototype and test the circuit using proto-board/stripboard or breadboard. This stage may involve anything from several rounds of minor changes to complete re-designs. Keep your schematic up-to-date during this stage. Once it's working well, that's the time to plan your circuit board. Eagle will help by checking your design against the schematic.

  1. MAX7221 chip drive an array of 38 LEDs
  2. TLC5940 chip to drive 4 5mm RGB common anode LEDS
  3. TPIC6B595 to drive 8 super bright 5mm LEDs

Alternative suggestions

  1. Ht16k33 if you decide to move from SPI to i2c bus.
  2. Apa106 5mm LEDs. These are similar to ws2812 and need no driver chip.
  3. "Super Bright" is a meaningless marketing term. Many such LEDs need no more current or voltage than an ordinary 5mm led. Have a close look at the spec/datasheet. Maybe you could drive these from Arduino pins?

Grumpy_Mike:
I don’t think you can drive this chip from the SPI bus. It needs constant feeding with pulses to keep it going and is a poor choice of chip. These days the PCA9865 is a better bet. It is an I2C chip and is a set and forget chip. That is you set it going and only need to interact with it when you want to change things.

I couldn't find any hits for 'PCA9865'. Did you mean "PCA9685"? It seems to do all the functions of the chip you're describing.

I also couldn't find a breadboard friendly package of this ic but this driver board might work for prototyping at least before I go ahead and design a custom board in Eagle.

This chip is more attractive to me over the 'Ht16k33' because I can also dim the RGB LEDs.

Did you mean "PCA9685"?

Sorry yes.

I also couldn't find a breadboard friendly package of this ic but this driver board might work

Yes that is fine. But your could just get a PCB header board from eBay for this package type. It is a TSSOP28 package.
Like this:-
https://www.ebay.Adapter-PCB-Converter-Board-SOP28-SO28-SOIC28-TSSOP28-MSOP28-to-DIP28

insultcomicdog:
This chip is more attractive to me over the 'Ht16k33' because I can also dim the RGB LEDs.

I was suggesting the ht16k33 as alternative to max7219. Pca9685 has i2c interface, so if you go for that over tlc5940, you might want to use other i2c chips rather than mixing SPI and i2c in the same circuit, for neatness.

PaulRB:
3. "Super Bright" is a meaningless marketing term. Many such LEDs need no more current or voltage than an ordinary 5mm led.

Ah! That one gets my goat. :cold_sweat:

Early LEDs were not efficient, poor dim little things invisible in daylight. Sadly, I have some deposits of them that I bought with projects in mind which never came to fruition and never will because they are now obsolete and entirely useless.

The technology has advanced immensely - by orders of magnitude to the point that they are now quite efficient indeed and as we well know, the virtually universal choice for efficient lighting, displacing even gas discharge lamps. Just look at your street lights.

As such, the correct descriptive term is not "Super Bright" but simply "efficient" in contrast to the old ones. OK, "High Efficiency" would be the term. :grinning:

I've updated my schematic to reflect replacing the TLC5940 with the PCA9685 chip. I'm using common anode RGB LEDs.

From the PCA9685 data sheet:

"Each LED output can be off or on (no PWM control) or set at its individual PWM controller value. The LED output driver is programmed to be either open-drain with a 25 mA current sink capability at 5 V or totem pole with a 25 mA sink, 10 mA source capability at 5 V. The PCA9685 operates with a supply voltage range of 2.3 V to 5.5 V and the inputs and outputs are 5.5 V tolerant. LEDs can be directly connected to the LED output (up to 25 mA, 5.5 V) or controlled with external drivers and a minimum amount of discrete components for larger current or higher voltage LEDs."

Does my wiring for the 4 RGB LEDs to the PCA9685 appear correct?


I think you should connect A0-A5 and OE to ground. Add a 0.1uF bypass cap for the PCA chip. Otherwise ok.

PaulRB:
I was suggesting the ht16k33 as alternative to max7219. Pca9685 has i2c interface, so if you go for that over tlc5940, you might want to use other i2c chips rather than mixing SPI and i2c in the same circuit, for neatness.

Ah ok I understand now. I was hoping to leverage the speed of the hardware SPI bus so my matrix animations driven by the MAX7121 chip could be fast.

The speed of RGB led animations aren't super critical, so i2c to the Pca9685 should be sufficient.

PaulRB:


I think you should connect A0-A5 and OE to ground. Add a 0.1uF bypass cap for the PCA chip. Otherwise ok.

Thanks will update the schematic. It seems I have to connect 'EXTCLK' to GND too. "external clock input - This pin must be grounded when this feature is not used." I think this is separate from the normal SCL pin, and I don't think I'm using this feature.

insultcomicdog:
It seems I have to connect 'EXTCLK' to GND too. "external clock input - This pin must be grounded when this feature is not used." I think this is separate from the normal SCL pin, and I don't think I'm using this feature.

Agreed. EXTCLK is nothing to to with SCL. It's for when you have multiple pca9685 in the circuit and you need to synchronise the PWM frequency & phase between them.

Add two 10k pull up resistors to the I2C lines.
Leo..

I finally got my PCB fabricated and populated. I can control my LEDs using the TPIC6B595DW and MAX7221CWG chips.

I’m trying to use the PCA9685 chip to control 4 RGB LEDS via pwm, and am not having any luck.

I tried using a I2C scanner sketch and can’t find an address for the chip.

Here’s my schematic.

Here’s the data sheet:
[datasheet PCA9685](http://" datasheet PCA9685")

I’m using 4.7K pull up resistors on the SDA and SCL pins. Pins A0-A5 are all pulled to GND.

Is there anything wrong in my schematic? Any ideas how to trouble shoot this issue?

insultcomicdog:
I’m trying to use the PCA9685 chip to control 4 RGB LEDS via pwm, and am not having any luck.
I tried using a I2C scanner sketch and can't find an address for the chip.

I2C address should be 0x40 with all address lines grounded.

Post a clear picture of both sides of the board, and post the sketch (with code tags).
Leo..

insultcomicdog:
I tried using a I2C scanner sketch and can’t find an address for the chip.

I'm hazarding a guess that SDA and SCL are simply not connected correctly to the I2C pins of your Nano. Your call as to how/ why. :grinning:

Or no power to the board.

Small update...

I tested an mpu6050 module w Nano to ensure I was able to detect I2C addresses. It worked fine.

I tried three different PCA9686 chips on my PCB and wasn't able to find the I2C address on any of them. At this point I was suspecting the chips (from Aliexpress) were suspect.

I ordered the exact same chip from Digi-Key, and was able to get the address fine first try. I'm able to control all four RGB LEDS via pwm.

All my chips, caps, resistors and ics for this project were from Aliexpress. All the components worked fine except for this one chip. The IC from Digi-Key was only marginally more expensive and shipped in 2 days vs 2 months!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.