Having trouble controlling 3 Row Seven Segment with 4 shift register 74hc595

thanks @PaulRB for ur respon. maybe this is custom part or clone from original modul.

can you give me a sample code for controling a multi seven segment 7 digit?

zifank: can you give me a sample code for controling a multi seven segment 7 digit?

Yes, I could easily give you some example code. But it would be pointless. I know it would not work. Code has to be written to exactly match the hardware. I have never seen your hardware before.

If you can get no help from the seller, you can do some "reverse engineering". Identify the components from their part numbers. Trace the tracks on the PCB. Make your own schematic diagram. From that, you can write some code. We can help with some stages of that process. But you have to start, because you have the hardware in front of you.

Looking closely at the board, this is what I believe I can see and guess. There are 4 chips. It would make sense if they are 74xx595 shift registers as you say. The chip closet to the connector drives 6 transistors which in turn drive the commons for the digits in that column. The other 3 shift registers drive the segments for the digits in the 3 rows, via current limiting resistors. The 4 shift registers must be "daisy-chained", given there are only 5 pins on the connector, including power and ground. I would guess that S=Serial data, C=Clock and R=latch.

The code must perform the multiplexing, sending 3 bytes of segment data and 1 byte to select the digit column, and lighting one column of digits at a time. The most important answers you need to find out, I believe, are the digits common anode or common cathode and are the transistors NPN or PNP (or are they FETs). The part numbers written on the displays and transistors may help answer those questions.

you are the the "rock" master @PaulRB, u bright my day... :)

the digits as common cathode, the transistor is PNP

zifank: the digits as common cathode, the transistor is PNP

Are you sure? How do you know? The transistors appear to be connected to the digit common pins. If the digits are common cathode, I would have expected NPN transistors. For common anode, I would expect PNP.

i test one transistor with multimeter, and the result is PNP, but for the digits i’m not sure.

sorry my bad, the 7 segment is SM4112 and work common anode

And two LEDs per segment. Do you know what colour the LEDs are? I wonder if a 5V supply will be enough.

The color is RED, yes. i used 9volt supply

zifank: i used 9volt supply

Used it for what? You could damage components by applying too high a voltage. What kind of 9V supply did you use and what was the result?

the power is POWER SUPPLY Adapter 9V 1A for arduino. and the result is it's brighter than I use under 9volt, the power is not problem right now, but i still confused to get columns and rows.

this my result and the unfinished codes

int latchPin = 10;
int clockPin = 9;
int dataPin = 8;

// digits from the right
const byte digit[10] =      //seven segment digits in bits
{
  B10000001,  // 0
  B11110011,  // 1
  B01001001,  // 2
  B01100001,  // 3
  B00110011,  // 4
  B00100101,  // 5
  B00000101,  // 6
  B11110001,  // 7
  B00000001,  // 8  fix
  B00100001,  // 9
};


void setup()
{
  Serial.begin(9600);
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
}

void loop()
{
  // step through each digit then increment
  // the counter by one, until nine
  for (int j = 0; j < 10; j++) {
    Serial.println(j);
    updateShiftRegister(0, j);
    delay(1000);
  }
}

void updateShiftRegister(int col, int num)
{
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, B00000101);
  shiftOut(dataPin, clockPin, MSBFIRST, digit[num]);
  digitalWrite(latchPin, HIGH);
}

SevenSegment.ino (888 Bytes)

zifank: the result is it's brighter than I use under 9volt

The only way to supply power to the board is through the connector. The connector supplies power to the 74hc595 chips directly. The maximum voltage of those chips is 6V. By connecting a 9V supply, you may have damaged the chips. If you want my continued help, explain what else you have done that you have not already described. I do not wish to waste my time writing code for a board that is already damaged.

zifank: this may result and the unfinishing code

Please try to speak better English, I did not understand what you just said. Please post any code correctly, according to form guidelines in the sticky post.

this is the seven segment picture with 9volt,
sorry, I have not explained that 9 volts I share with lcd and other devices.

|281x500

@paulRB, can you still help me? if dont bother you, i hope you give me the sample code please. tell me if you need more information.

Does the code you posted produce the digits shown in your picture? Do the digits change as the code runs?

my code is not working properly, still confused specify the position of digit, and I can not specify the columns and rows of each segment

You keep asking if you are bothering me. It bothers me when you ignore a question that I ask.

Here is some code to try:

int latchPin = 10;
int clockPin = 9;
int dataPin = 8;

// digits from the right
const byte digit[10] =      //seven segment digits in bits
{
  B10000001,  // 0
  B11110011,  // 1
  B01001001,  // 2
  B01100001,  // 3
  B00110011,  // 4
  B00100101,  // 5
  B00000101,  // 6
  B11110001,  // 7
  B00000001,  // 8  fix
  B00100001,  // 9
};

byte displayBuffer[3][6] =    //digit to display in each position
{
  {0, 1, 2, 3, 4, 5},
  {0, 0, 2, 4, 6, 8},
  {0, 1, 3, 5, 7, 9}
};


void setup()
{
  Serial.begin(9600);
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
}

void loop()
{
  updateShiftRegister();
}

void updateShiftRegister()
{
  // "static" variables do not loose their value when the function ends
  static unsigned long lastUpdateTime; // time from millis() when the dispaly was last updated
  static byte column; // the column currently being lit

  if (millis() - lastUpdateTime > 3)  // is it time to light the next column?
  {
    digitalWrite(latchPin, LOW);
    for (byte row = 0; row < 3; row++) // update each row for the current column
    {
      byte d = displayBuffer[row][column]; // get the required digit for this row & column
      shiftOut(dataPin, clockPin, MSBFIRST, digit[d]); // send the segment data for each row
    }
    shiftOut(dataPin, clockPin, MSBFIRST, 1 << column); // send the column enable mask
    digitalWrite(latchPin, HIGH);

    column++; // next time, we will light the next column
    if (column > 5) column = 0;
    lastUpdateTime = millis();
  }
}

It is unlikely that it will work correctly at the first attempt. I do not have your display and cannot test the code. I must rely on you to test it. This means you must be accurate and detailed in your description of any faults. Pictures, even video, may be useful.