Using TPIC6B595N or MAX7219

Hi

I'm looking for the best way to control 110 individual LEDs. At the moment I'm using a HCF4094 and a ULN2003A driver for my first matrix and this is working well. Than someone suggested to use TPIC6B595N or a MAX7219

Now my question are:

  • can you control 64 LEDs by using 2 TPIC6B595N or woud you still require something linke the ULN2003 driver?
  • would it be more interesting to use the TPIC6B595N or MAX7219 in the end

Thanks!

  1. definitively. You should be able to get below 200us per 64 leds / frame with some programming tricks, or 500us to save a couple pins, on a 16MIPS avr.
  2. depends on what you perceive as "interesting".

So I have been trying to make a very easy setup to test the chip.

The setup is:

To find by clicking here so I don't screw up the topic :slight_smile:

Code is below but I'm not getting a single blink...

/*
 Shift Register Example
 for TPIC6B595 shift register by Jens C Brynildsen

 This sketch turns reads serial input and uses it to set the pins
 of a TPIC6B595 shift register.

 Hardware:
 * TPIC6B595 shift register attached to pins 7, 8, 11 and 12 of the Arduino,
 as detailed below.
 * LEDs attached to each of the outputs of the shift register

 Based on the example created 23 Mar 2010 by Tom Igoe

 */

//Pin to clear the register
const int clearPin = 7;
//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 9;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 10;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 11;

int counter = 0;
int numLedsInUse = 8;

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(clearPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  Serial.begin(9600);
  Serial.println("*");
  
  // delay a little and then set 
  delay(100);
  // Always start by sentting SRCLR high
  digitalWrite( clearPin, HIGH);
}

void loop() {
  // Display LED's running
  if( counter >= (numLedsInUse-1) ){
    counter = 0;
  } else {
    counter++;
  }
  
  // write to the shift register with the correct bit set high:
  registerWrite(counter, HIGH);
  delay( 100 );
}

// This method sends bits to the shift register:

void registerWrite(int whichPin, int whichState) {
  // the bits you want to send
  byte bitsToSend0 = 0;
  // write number as bits
  bitWrite(bitsToSend0, whichPin, whichState);

  // turn off the output so the pins don't light up
  // while you're shifting bits:
  digitalWrite(latchPin, LOW);
  
  // shift the bits out
  shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend0);

  // turn on the output so the LEDs can light up:
  digitalWrite(latchPin, HIGH);
}

From the schematic, your pin declarations are wrong.

You have pins 5, 6 and 8 on the schematic and 7, 9, 10 and 11 in the sketch.

Just change your jumpers to match the code.

The TPIC6B595 can only pull pins low. Current limit resistors to +5V drive the anodes high, the '595 outputs bring the cathodes low to turn them on.

codlink:
From the schematic, your pin declarations are wrong.

You have pins 5, 6 and 8 on the schematic and 7, 9, 10 and 11 in the sketch.

Just change your jumpers to match the code.

Hi

Yes, that's an error between computer design and real life :slight_smile: but it is ok, the pins are as they are in the code... very good observation but that's not the issue..

CrossRoads:
The TPIC6B595 can only pull pins low. Current limit resistors to +5V drive the anodes high, the '595 outputs bring the cathodes low to turn them on.

Hi

Sorry but I'm pretty new to electronics so this might be stupid... does this mean that I have to connect the positive side of my led to my 5v and my negative to my resistor and to the TPIC6B595N? I made a new sketch like this.

In any case, I'm basing my design on this link. My original question was if it would be better and possible to use 2 times the TPIC6B595N to build a matrix, if I understood correctly this is not possible?

Thanks!

Yes -
+5 - resistor - anode, cathode to TPIC6B595

Sure, can use two TPIC6B595.

One will control current into the anodes, one will sink current from the cathodes.
Connect the anode control between the resistor and the anode.

Connect 2nd TPIC6B595 between resistor & anode.

So, drive the anodes, letting them go hi/low as needed for a column with 8 outputs of one shift register.
WIth the other, pull the cathode low for that 1 column.

Anode current is then either going into the anodes, or into the anode shift register.