4 digit 7 Segment Serial LED Module Help Please :)

Hello to all ,
I have this module 4 digits 7-segment digital tube: It has 5-pin: VCC, GND, SCLK, RCLK, DIO
I found some examples to make it work with shift register, and I'm happy.
Now I ask you: is there a library that allows me to write code in a more simple way?
To make you understand what I mean, I found this library:
http://playground.arduino.cc/Main/TM1637

But it only it works for the TM1637 module that has 4 pins, whereas I have 5 pins.
I've the RCLK pin more. :o
I searched everywhere on the internet, but I could not find it. :confused:
I'm inexperienced, and new to Arduino, I wanted to know if you know some library for my module with 5 pins.
Thank you all. :slight_smile:

Hi and welcome.

We cannot tell, from looking at the picture you posted, what might be inside the module. Can you post links to where you purchased it, how you connected it to your Arduino, and where you found the sketches that work?

Paul

I used this one and it worked great:

I'm not sure which one your using. Regardless perhaps the code I wrote for mine will help you with yours:

#define NUM_DIGITS 4
#define NUM_SEGMENTS 7

const int PIN_DIGITS[] = {3, 5, 6, 9}; //DIGITS 1-4 (PWM)
const int PIN_SEGMENTS[] = {10, 11, 2, 4, 7, 8, 12}; //Segments Bottom-Left going clockwise

//Segments ABCDEF Bottom-Left going clockwise
const String SEG_ALPHA[] = {
  "1111101", //A
  "1111111", //B
  "1110010", //C
  "1111110", //D
  "1110011", //E
  "1110001", //F
  "1110111", //G
  "1101101", //H
  "1100000", //I
  "0001110", //J
  "1101001", //K
  "1100010", //L
  "1111100", //M
  "1111100", //N
  "1111110", //O
  "1111001", //P
  "1111110", //Q
  "1111101", //R
  "0110111", //S
  "1110000", //T
  "1101110", //U
  "1101110", //V
  "1101110", //W
  "1101101", //X
  "0101111", //Y
  "1011011"  //Z
};
const String SEG_NUMS[] = {
  "1111110", //0
  "0001100", //1
  "1011011", //2
  "0011111", //3
  "0101101", //4
  "0110111", //5
  "1110111", //6
  "0011100", //7
  "1111111", //8
  "0111111"  //9
};
const String SEG_DASH = "0000001"; //-
const String SEG_UNDERSCORE = "0000010"; //_
const String SEG_QMARK = "1011001"; //?

const int DELAY = 3000; //Time to display each digit in Microseconds (there are a thousand microseconds in a millisecond)

//Prototypes
void setup();
void loop();
void display(char value[NUM_DIGITS + 1]);
void displayInt(int i, boolean alignRight = true, char filler = '0');
String parseCharSegment(char c);

//Global variables
boolean sensorHigh = false;

void setup(){
  for (int i = 0; i < NUM_DIGITS; i++){
    pinMode(PIN_DIGITS[i], OUTPUT);
  }
  for (int i = 0; i < NUM_SEGMENTS; i++){
    pinMode(PIN_SEGMENTS[i], OUTPUT);
  }
}

void loop(){
  int time = millis() / 1000;
  displayInt(time);
}

void displayInt(int i, boolean alignRight, char filler){
  String si = String(i);
  int siLen = si.length();
  if (siLen > NUM_DIGITS){
    si = si.substring(0, NUM_DIGITS);
  } else if (siLen < NUM_DIGITS){
    int diff = NUM_DIGITS - siLen;
    for (int i = 0; i < diff; i++){
      if (alignRight){
        si = filler + si;
      } else {
        si = si + filler;
      }
    }
  }
  char csi[NUM_DIGITS + 1];
  si.toCharArray(csi, NUM_DIGITS + 1);
  display(csi);
}

void display(char value[NUM_DIGITS + 1]){
  for (int i = 0; i < NUM_DIGITS; i++){
    String segment = parseCharSegment(value[i]);
    if (segment == NULL){
      delayMicroseconds(DELAY);
      continue;
    }
    digitalWrite(PIN_DIGITS[i], HIGH);
    
    for (int j = 0; j < NUM_SEGMENTS; j++){ //display char segments on/off
      if (segment.substring(j, j + 1) == "0"){
        digitalWrite(PIN_SEGMENTS[j], HIGH);
      } else {
        digitalWrite(PIN_SEGMENTS[j], LOW);
      }
    }
    
    delayMicroseconds(DELAY);
    
    for (int j = 0; j < NUM_SEGMENTS; j++){ //Segments off
      digitalWrite(PIN_SEGMENTS[j], HIGH);
    }
    
    digitalWrite(PIN_DIGITS[i], LOW);
  }
  
  delayMicroseconds(DELAY);
}

String parseCharSegment(char c){
  String segment = NULL;
  
  int ascii = (int)c;
  if (ascii >= 48 && ascii <= 57){ //0-9
    segment = SEG_NUMS[ascii - 48];
  } else if (ascii >= 65 && ascii <= 90){ //A-Z
    segment = SEG_ALPHA[ascii - 65];
  } else if (ascii >= 97 && ascii <= 122){ //a-z
    segment = SEG_ALPHA[ascii - 97];
  } else if (ascii == 45){ //-
    segment = SEG_DASH;
  } else if (ascii == 95){ //_
    segment = SEG_UNDERSCORE;
  } else if (ascii == 63){ //?
    segment = SEG_QMARK;
  }
 
  return segment;
}

@koga73: I know you only want to help, but we know that the OP's module must contain a driver circuit of some kind, because of the 5 pin connector. The display you have is a bare display and needs 12 Arduino pins, so your code would not work.

I suspect the OP's module contains 74xx595 chips, but we need to get confirmation.

Sorry, you are right.
it has on the back 2 chip TM74HC595 (shift registers)

Here is a library. (I have never used it.)

Does this one help ? It sure helped me :slight_smile: