# Sevent segments hc595 problem

**URL:** <https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966>\
**Category:** Displays\
**Created:** [May 24, 2024, 9:02pm UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966 "2024-05-24T21:02:36Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![androide\_neon](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/androide_neon/32/1073613_2.png) [@androide\_neon](https://forum.arduino.cc/u/androide_neon)\
**Post date:** [May 24, 2024, 9:02pm UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/1 "2024-05-24T21:02:36Z")

</div>

Hello, I need a little help since I have a problem with my project using three shift registers hc595 and three 7-segment displays.

My problem is that I load my board with a counter program from 0 to 999 and the program works, the problem is that when it displays the digits I get small, very faint blinks on my counter and I need them to be gone. Has anyone had a similar problem? I attach my code and photo of the displays.

```arduino
 #define SER A0 //data
 #define RCLK PE1 // LATCH
 #define SRCLK A1 // CLOCK
 #define Btn A6

uint8_t display[] = { B11111001, B11000000, B10110101, B11100101, B11001100, B01101101, B01111101, B11000001, B11111101, B11001101 };
unsigned long tiempoAnterior = 0;
void setup() {
  pinMode(SER, OUTPUT);
  pinMode(RCLK, OUTPUT);
  pinMode(SRCLK, OUTPUT);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  digitalWrite(RCLK, LOW);
  digitalWrite(RCLK, HIGH);
void loop() {
  tiempoActual = millis();
  if ((tiempoActual - tiempoAnterior) > 100) {
    carga(i, j, k);
    i++;
    if (i > 9) {
      i = 0;
      j++;
    }
    if (j > 9) {
      j = 0;
      k++;
      if (k > 9) {
        i = 0;
        j = 0;
        k = 0;
      }
    }
    tiempoAnterior = millis();
  }
}
int carga(int digito1, int digito2, int digito3) {
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[i]);
  digitalWrite(RCLK, HIGH);
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[j]);
  digitalWrite(RCLK, HIGH);
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[k]);
  digitalWrite(RCLK, HIGH);
  // delay(50);
  

  
}

```

 ![WhatsApp Image 2024-05-24 at 2.40.38 PM](https://europe1.discourse-cdn.com/arduino/original/4X/2/9/f/29fbd68ad85833763dc7fe145eda3c7083860599.jpeg)

im kind of new so i apologize for any mistake.

---

<div class="post-metadata">

**Author:** ![ruilviana](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ruilviana/32/722429_2.png) [@ruilviana](https://forum.arduino.cc/u/ruilviana)\
**Post date:** [May 24, 2024, 10:18pm UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/2 "2024-05-24T22:18:31Z")

</div>

Show your schematic.  
How the resistors are connect to 7seg?

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [May 25, 2024, 2:58am UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/3 "2024-05-25T02:58:40Z")

</div>

> [@androide\_neon](#):
>
> faint blinks on my counter

What is a counter?

> [@androide\_neon](#):
>
> Has anyone had a similar problem?

No.

> [@androide\_neon](#):
>
> ` #define Btn A6`

You never use A6.

This one compiles.

```arduino
#define SER A0 // DATA / DS
#define RCLK A2 // LATCH / STCP
#define SRCLK A1 // CLOCK / SHCP
#define Btn A6 // a button - never used
int i, j, k; // digits 1, 2, 3

uint8_t display[] = { 
  B11111001, // 0
  B11000000, // 1
  B10110101, // 2
  B11100101, // 3
  B11001100, // 4
  B01101101, // 5
  B01111101, // 6
  B11000001, // 7
  B11111101, // 8
  B11001101 // 9
  };

unsigned long tiempoAnterior = 0, tiempoActual;

void setup() {
  pinMode(SER, OUTPUT);
  pinMode(RCLK, OUTPUT);
  pinMode(SRCLK, OUTPUT);

  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);

  digitalWrite(RCLK, LOW);
  digitalWrite(RCLK, HIGH);
}

void loop() {
  tiempoActual = millis();
  if ((tiempoActual - tiempoAnterior) > 100) {
    carga(i, j, k);
    i++;
    if (i > 9) {
      i = 0;
      j++;
    }
    if (j > 9) {
      j = 0;
      k++;
      if (k > 9) {
        i = 0;
        j = 0;
        k = 0;
      }
    }
    tiempoAnterior = millis();
  }
}

int carga(int digito1, int digito2, int digito3) {
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[i]);
  digitalWrite(RCLK, HIGH);
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[j]);
  digitalWrite(RCLK, HIGH);
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[k]);
  digitalWrite(RCLK, HIGH);
  // delay(50);
}

```

> **diagram.json**
>
> ```arduino
> 
> {
> "version": 1,
> "author": "Anonymous maker",
> "editor": "wokwi",
> "parts": [
> { "type": "wokwi-arduino-nano", "id": "nano", "top": 0, "left": 0, "attrs": {} },
> { "type": "wokwi-74hc595", "id": "sr1", "top": 94.8, "left": 24.64, "attrs": {} },
> {
> "type": "wokwi-pushbutton",
> "id": "btn1",
> "top": -51.4,
> "left": 134.4,
> "attrs": { "color": "green" }
> },
> {
> "type": "wokwi-led-bar-graph",
> "id": "bargraph1",
> "top": 110.2,
> "left": 43.4,
> "rotate": 90,
> "attrs": { "color": "lime" }
> },
> { "type": "wokwi-vcc", "id": "vcc1", "top": 29.56, "left": -28.8, "attrs": {} }
> ],
> "connections": [
> ["nano:GND.2", "btn1:2.l", "black", ["v0"] ],
> ["nano:A0", "sr1:DS", "green", ["v0"] ],
> ["nano:A1", "sr1:SHCP", "green", ["v14.4", "h18.7"] ],
> ["nano:A2", "sr1:STCP", "green", ["v0"] ],
> ["nano:GND.1", "sr1:OE", "black", ["v24", "h-86.9"] ],
> ["btn1:1.l", "nano:A6", "green", ["h0"] ],
> ["bargraph1:C10", "bargraph1:C9", "green", ["v0"] ],
> ["bargraph1:C9", "bargraph1:C8", "green", ["v0"] ],
> ["bargraph1:C8", "bargraph1:C7", "green", ["v0"] ],
> ["bargraph1:C7", "bargraph1:C6", "green", ["v0"] ],
> ["bargraph1:C6", "bargraph1:C5", "green", ["v0"] ],
> ["bargraph1:C5", "bargraph1:C4", "green", ["v0"] ],
> ["bargraph1:C4", "bargraph1:C3", "green", ["v0"] ],
> ["bargraph1:C3", "bargraph1:C2", "green", ["v0"] ],
> ["bargraph1:C1", "bargraph1:C2", "green", ["v0"] ],
> ["sr1:VCC", "vcc1:VCC", "red", ["v-18", "h-48"] ],
> ["vcc1:VCC", "nano:5V", "red", ["v19.2", "h144"] ],
> ["sr1:Q0", "bargraph1:A10", "green", ["v-8.4", "h-28.8"] ],
> ["sr1:Q1", "bargraph1:A9", "green", ["v0"] ],
> ["sr1:Q2", "bargraph1:A8", "green", ["v0"] ],
> ["sr1:Q3", "bargraph1:A7", "green", ["v0"] ],
> ["sr1:Q4", "bargraph1:A6", "green", ["v0"] ],
> ["sr1:Q5", "bargraph1:A5", "green", ["v0"] ],
> ["sr1:Q6", "bargraph1:A4", "green", ["v0"] ],
> ["sr1:Q7", "bargraph1:A3", "green", ["v0"] ],
> ["sr1:GND", "nano:GND.1", "black", ["v9.6", "h9.6", "v-48", "h38.4"] ]
> ],
> "dependencies": {}
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![Grumpy\_Mike](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/grumpy_mike/32/213521_2.png) [@Grumpy\_Mike](https://forum.arduino.cc/u/Grumpy_Mike)\
**Post date:** [May 25, 2024, 3:19am UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/4 "2024-05-25T03:19:24Z")

</div>

That sketch in the first post does not compile.

So can you post the sketch that you claim works except for the faint blinking, please.

---

<div class="post-metadata">

**Author:** ![Rintin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/rintin/32/1013044_2.png) [@Rintin](https://forum.arduino.cc/u/Rintin)\
**Post date:** [May 25, 2024, 5:36am UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/5 "2024-05-25T05:36:06Z")

</div>

> [@xfpd](#):
>
> ```arduino
> int carga(int digito1, int digito2, int digito3) {
> digitalWrite(RCLK, LOW);
> shiftOut(SER, SRCLK, MSBFIRST, display[i]);
> digitalWrite(RCLK, HIGH);
> digitalWrite(RCLK, LOW);
> 
> ```

Why latching after every shiftout?

---

<div class="post-metadata">

**Author:** ![Grumpy\_Mike](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/grumpy_mike/32/213521_2.png) [@Grumpy\_Mike](https://forum.arduino.cc/u/Grumpy_Mike)\
**Post date:** [May 25, 2024, 8:12pm UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/6 "2024-05-25T20:12:09Z")

</div>

> [@Rintin](#):
>
> Why latching after every shiftout

Absolutely no reason, except that is the way the OP did it in his code, and it has no effect.

---

<div class="post-metadata">

**Author:** ![androide\_neon](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/androide_neon/32/1073613_2.png) [@androide\_neon](https://forum.arduino.cc/u/androide_neon)\
**Post date:** [May 27, 2024, 4:47pm UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/7 "2024-05-27T16:47:04Z")

</div>

![Sin título](https://europe1.discourse-cdn.com/arduino/original/4X/7/2/9/72908d461dd005b9e111619fe6dd32e057a093de.jpeg)

Thank you very much for taking the time to respond. Here is my diagram, it is not exactly which pin goes with which pin but it is the idea. I am controlling the hc595 with an atmega328pb that sends the signals to a uln2803 to drive a 7 sec display that is powered at 12v

---

<div class="post-metadata">

**Author:** ![androide\_neon](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/androide_neon/32/1073613_2.png) [@androide\_neon](https://forum.arduino.cc/u/androide_neon)\
**Post date:** [May 27, 2024, 5:03pm UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/8 "2024-05-27T17:03:56Z")

</div>

Thank you very much for taking the time to respond. And sorry if I haven't explained it properly.

> What is a counter?

I'm trying to program a counter from 000 to 999 seconds.

> You never use A6.

Pin A6 is for a button that I added, but in the program that I showed I was only trying to display the numbers on the displays.

---

<div class="post-metadata">

**Author:** ![androide\_neon](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/androide_neon/32/1073613_2.png) [@androide\_neon](https://forum.arduino.cc/u/androide_neon)\
**Post date:** [May 27, 2024, 5:10pm UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/9 "2024-05-27T17:10:06Z")

</div>

> Why latching after every shiftout?

tank you for the awnser. It is the last test I was doing, I understand that latching after every shiftout is not necessary, but I wanted to find out if that could eliminate the flickering that was causing me problems.

---

<div class="post-metadata">

**Author:** ![androide\_neon](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/androide_neon/32/1073613_2.png) [@androide\_neon](https://forum.arduino.cc/u/androide_neon)\
**Post date:** [May 27, 2024, 5:11pm UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/10 "2024-05-27T17:11:33Z")

</div>

> Absolutely no reason, except that is the way the OP did it in his code, and it has no effect.

yup youre rigth, It is the last test I was doing, I understand that latching after every shiftout is not necessary, but I wanted to find out if that could eliminate the flickering that was causing me problems.

---

<div class="post-metadata">

**Author:** ![androide\_neon](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/androide_neon/32/1073613_2.png) [@androide\_neon](https://forum.arduino.cc/u/androide_neon)\
**Post date:** [May 27, 2024, 5:22pm UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/11 "2024-05-27T17:22:13Z")

</div>

```arduino
#define SER A0 //data
#define RCLK PE1 // LATCH
#define SRCLK A1 // CLOCK
//#define Btn A6
uint8_t display[] = { B11111001, B11000000, B10110101, B11100101, B11001100, B01101101, B01111101, B11000001, B11111101, B11001101 };
int i = 0, j = 0, k = 0, l = 0;

unsigned long tiempoAnterior = 0;
unsigned long tiempoActual = 0;

void setup() {
  pinMode(SER, OUTPUT);
  pinMode(RCLK, OUTPUT);
  pinMode(SRCLK, OUTPUT);

  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  digitalWrite(RCLK, LOW);
  digitalWrite(RCLK, HIGH);
}

void loop() {
  tiempoActual = millis();
  if ((tiempoActual - tiempoAnterior) > 100) {
    carga(i, j, k);
    i++;
    if (i > 9) {
      i = 0;
      j++;
    }
    if (j > 9) {
      j = 0;
      k++;
      if (k > 9) {
        i = 0;
        j = 0;
        k = 0;
      }
    }
    tiempoAnterior = millis();
  }
}

int carga(int digito1, int digito2, int digito3) {
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[i]);
  shiftOut(SER, SRCLK, MSBFIRST, display[j]);
  shiftOut(SER, SRCLK, MSBFIRST, display[k]);
  digitalWrite(RCLK, HIGH);
  delay(50);
}

```

> [@Grumpy\_Mike](#):
>
> That sketch in the first post does not compile.
> 
> So can you post the sketch that you claim works except for the faint blinking, please.

this is the program that im uploading, tank you for yor help.

---

<div class="post-metadata">

**Author:** ![Grumpy\_Mike](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/grumpy_mike/32/213521_2.png) [@Grumpy\_Mike](https://forum.arduino.cc/u/Grumpy_Mike)\
**Post date:** [May 28, 2024, 6:18am UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/12 "2024-05-28T06:18:27Z")

</div>

> [@androide\_neon](#):
>
> his is the program that im uploading,

There is something vital you have not told us.  
What Arduino are you using? It is not a Uno, so without telling us what it is we can't help any more.

As to your schematic:-

> [@androide\_neon](#):
>
> Here is my diagram, it is not exactly which pin goes with which pin but it is the idea.

Sorry not good enough. As schematic is exactly which pin goes with which pin. Otherwise there is no point. You need pin numbers on every rectangle as well.

It does not even include an Arduino, nether does it show any method of powering and where all the ground connections go.

Basically your problem is down the the fact that your data latch is not actually having any effect. In other words what you think of as a latch is not acting as a latch. That would cause the effect you describe. But you schematic does not give the information we need to be able say if this is the problem and more importantly, what the cure is.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [November 24, 2024, 6:18am UTC](https://forum.arduino.cc/t/sevent-segments-hc595-problem/1263966/13 "2024-11-24T06:18:51Z")

</div>

Closed on November 24, 2024, 6:18am UTC

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