Using 74hc595 12 unit of 4 digit 7segment

My project required to display on 12 unit of 4 digit 7segment. Im planning to use 74hc595 as being use in this link https://youtu.be/ZGzbAd-Aixc.

There is no problem to control the first 1 unit. But the problem is when i want to use 12 unit of 4 digit at the same time.

Hi, and welcome to the forum. To get proper help, you need to post your code and a wiring diagram or picture(s). Read the forum rules about posting with code tags.

This project could be easier/cheaper if you use 8-digit modules with integrated MAX 7219 driver chip. Nothing else needed, and they can be daisy-chained to as many as you like. Search for "8-digit MAX7219" on ebay. Leo.

Wawa: This project could be easier/cheaper if you use 8-digit modules with integrated MAX 7219 driver chip. Nothing else needed, and they can be daisy-chained to as many as you like. Search for "8-digit MAX7219" on ebay. Leo.

++ I swapped over to using these a year ago; brilliant little units. Also controlled by the 7219 are the 8x8 led matrix modules which I have used to make a "ticker tape" type display.

Here is my code

int latchPin = 2; //pin 12 on the 595
int dataPin = 3; //pin 14 on the 595
int clockPin = 4; //pin 11 on the 595

int numHex[] = {63, 6, 91, 79, 102, 109, 125, 7, 127, 103};
int daerah[4][4] ={ // {latchPin, dataPin, clockPin, input}
  {2, 3, 4, 2342}, // johor
  {5, 6, 7, 4321},
  {8, 9, 10, 7834},
  {11, 12, 13, 4321},
  {14, 15, 16, 7834},
  {17, 18, 19, 4321},
  {20, 21, 22, 7834},
  {23, 24, 25, 4321},
  {26, 27, 28, 7834},
  {29, 30, 31, 7834},
  {32, 33, 34, 394}
};
void setup() {
  Serial.begin(9600);
  for (int i = 1; i < 14; i++){
    pinMode(i, OUTPUT);
  }
}

void loop() {
  for( int i = 0; i < 4; i++){
    display(daerah[i][0],daerah[i][1],daerah[i][2],daerah[i][3]);
  }
}

void display(int latchPin, int dataPin, int clockPin, int num){
  int num1=num/1000;
  int num2=(num/100)-(num1*10);
  int num3=(num/10)-(num1*100)-(num2*10);
  int num4=num-(num1*1000)-(num2*100)-(num3*10);

  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST,63);
  shiftOut(dataPin, clockPin, MSBFIRST,numHex[num1]);
  digitalWrite(latchPin, HIGH);
  delay(1);

  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST,128 + 63 << 1);
  shiftOut(dataPin, clockPin, MSBFIRST,128 + numHex[num2]);
  digitalWrite(latchPin, HIGH);
  delay(1);

  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST,128 + 63 >> 5);
  shiftOut(dataPin, clockPin, MSBFIRST,128 + numHex[num3]);
  digitalWrite(latchPin, HIGH);
  delay(1);

  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST,128 + 63 >> 4);
  shiftOut(dataPin, clockPin, MSBFIRST,128 + numHex[num4]);
  digitalWrite(latchPin, HIGH);
  delay(1);
}

The code is fine. its working.

But the problem is when i want to make the 12 unit (4 digit 7 segment).
The light start to dimm and some number doesn’t appear. So i add 4 transistor(2n2222) for
each digit. the brightness is getting better. but the problem is its only display ‘2222’ instead of ‘2342’.

One obvious thing wrong (but I suspect not what is causing your problem) is that you initialize int daerah[4][4] with12*4 odd values instead of 4*4 values.

More of a problem is that you set pinMode() to OUTPUT on pins 1 to 14 inclusive yet you use pins 2,3 4 etc to 34 inclusive.

I really don't understand your code. In order to help understand your code I would like to see a wiring diagram; one of the blocks of seven segments would probably be enough.

If you would like to use MAX7219 try this site for wiring. You need to scroll down about half way. .http://www.gammon.com.au/forum/?id=11516