# Help with Elegoo 4 Digit 7 Segment Display Tutorial

**URL:** <https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637>\
**Category:** LEDs and Multiplexing\
**Created:** [March 17, 2021, 2:16am UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637 "2021-03-17T02:16:39Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![obsessed](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@obsessed](https://forum.arduino.cc/u/obsessed)\
**Post date:** [March 17, 2021, 2:16am UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/1 "2021-03-17T02:16:39Z")

</div>

Hello All,

I cannot figure this out. I have my Uno configured exactly as the view below, however, the 4 digits do not cycle through as the tutorial shows (1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f). Instead it goes 1, 3, 5, 7, then gets jumbled, and repeats.

Oddly enough, if I move the red jumper wire from the 5v Pin on the Uno board to the Vin pin on the Uno board, it works perfectly. This makes no sense to me, and I cannot figure why that would solve the problem.

Any guidance? Code is below:

```cpp
//www.elegoo.com
//2016.12.12

int latch=9;  //74HC595  pin 9 STCP
int clock=10; //74HC595  pin 10 SHCP
int data=8;  //74HC595  pin 8 DS

unsigned char table[]=
{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c
,0x39,0x5e,0x79,0x71,0x00};

void setup() {
  pinMode(latch,OUTPUT);
  pinMode(clock,OUTPUT);
  pinMode(data,OUTPUT);
}
void Display(unsigned char num)
{

  digitalWrite(latch,LOW);
  shiftOut(data,clock,MSBFIRST,table[num]);
  digitalWrite(latch,HIGH);
  
}
void loop() {
  Display(1);
  delay(500);
  Display(2);
  delay(500);
  Display(3);
  delay(500);
  Display(4);
  delay(500);
  Display(5);
  delay(500);
  Display(6);
  delay(500);
  Display(7);
  delay(500);
  Display(8);
  delay(500);
  Display(9);
  delay(500);
  Display(10);
  delay(500);
  Display(11);
  delay(500);
  Display(12);
  delay(500);
  Display(13);
  delay(500);
  Display(14);
  delay(500);
  Display(15);
  delay(500);
}

```

 ![Lesson 20.png](https://europe1.discourse-cdn.com/arduino/original/4X/7/4/6/74680a45866924a8e9318b1ba7ff98f2290d5491.png)

 ![Lesson 20.png](https://europe1.discourse-cdn.com/arduino/original/4X/7/4/6/74680a45866924a8e9318b1ba7ff98f2290d5491.png)

---

<div class="post-metadata">

**Author:** ![Paul\_B](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_b/32/216376_2.png) [@Paul\_B](https://forum.arduino.cc/u/Paul_B)\
**Post date:** [March 17, 2021, 10:27am UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/2 "2021-03-17T10:27:24Z")

</div>

Presumably you are powering this via the USB port.

Put a 0.1 µF (or somewhat more) ceramic directly across the supply to the 74HC595. Connect pin 10 to 5 V.

---

<div class="post-metadata">

**Author:** ![obsessed](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@obsessed](https://forum.arduino.cc/u/obsessed)\
**Post date:** [March 17, 2021, 12:07pm UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/3 "2021-03-17T12:07:56Z")

</div>

You are correct in assuming it is powered by USB. Apologies for not calling that out.

I will give the capacitor a try. For my knowledge though (I'm not an EE), what does the capacitor accomplish? Why would the board work with the red jumper on Vin instead? Can you help me understand the logic behind placing the capacitor for my knowledge?

Still very new at this.

Thanks!

---

<div class="post-metadata">

**Author:** ![ieee488](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@ieee488](https://forum.arduino.cc/u/ieee488)\
**Post date:** [March 17, 2021, 2:23pm UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/4 "2021-03-17T14:23:17Z")

</div>

It is odd that you are having trouble with this because the two detailed tutorials on Youtube do not show the need of a capacitor.

Are you sure you have everything connected correctly?

Vin is one diode drop from the barrel connector which is not connected since you are using your PC's USB.

---

<div class="post-metadata">

**Author:** ![obsessed](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@obsessed](https://forum.arduino.cc/u/obsessed)\
**Post date:** [March 17, 2021, 2:39pm UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/5 "2021-03-17T14:39:39Z")

</div>

Attached is a picture of my setup.

It seems odd that it even works without the 5v pin wired up.

I also checked and rechecked the code as well. The pins are called out correctly.

I also tried a separate power board. Same behavior.

I may try to take a video to show behavior if anyone may find that helpful.

 ![Wiring Picture.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/e/4/2/e42b79ccbb0e4587ed8b9e520fd1a22c3657ed49.jpeg)

 ![Wiring Picture.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/e/4/2/e42b79ccbb0e4587ed8b9e520fd1a22c3657ed49.jpeg)

---

<div class="post-metadata">

**Author:** ![PaulRB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulrb/32/216330_2.png) [@PaulRB](https://forum.arduino.cc/u/PaulRB)\
**Post date:** [March 17, 2021, 6:58pm UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/6 "2021-03-17T18:58:40Z")

</div>

Definitely add that 0.1uF cap, and leave it there, even if it does not fix your problem. Internet tutorials may not show it, but the '595 manufacturer's data sheet will, and they know best.

Speaking of bad tutorials, shame on Elegoo. This circuit will draw 60mA from each '595 output pin, and the limit is 35mA. With all 8 segments lit, that's 480mA in total, when the limit is 70mA for the '595, and 500mA for USB, which needs to power the Arduino at the same time.

---

<div class="post-metadata">

**Author:** ![obsessed](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@obsessed](https://forum.arduino.cc/u/obsessed)\
**Post date:** [March 17, 2021, 8:44pm UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/7 "2021-03-17T20:44:00Z")

</div>

Thanks for the help. Would I put the capacitor on pins 8 and 16? Google tells me it should be between Vcc and Ground. However above it is stated to put it between Vcc and pin 10 (which is master reset) if I'm assuming correctly he meant pin 10 of the 595.

---

<div class="post-metadata">

**Author:** ![Paul\_B](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_b/32/216376_2.png) [@Paul\_B](https://forum.arduino.cc/u/Paul_B)\
**Post date:** [March 17, 2021, 9:06pm UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/8 "2021-03-17T21:06:16Z")

</div>

No, I said Put a 0.1 µF (or somewhat more) ceramic directly across the supply to the 74HC595. The supply is pins 16 and 8.

Connect pin 10 to 5 V (pin 16). because your diagram showed it was not connected. 😲

---

<div class="post-metadata">

**Author:** ![obsessed](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@obsessed](https://forum.arduino.cc/u/obsessed)\
**Post date:** [March 17, 2021, 10:45pm UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/9 "2021-03-17T22:45:47Z")

</div>

> Paul\_\_B:  
> No, I said Put a 0.1 µF (or somewhat more) ceramic directly across the supply to the 74HC595. The supply is pins 16 and 8.
> 
> Connect pin 10 to 5 V (pin 16). because your diagram showed it was not connected. 😲

I've never seen a 7 Segment tutorial that has pin 10 connected on the 74HC595 - can you help me understand what purpose it serves?  
I apologize for not knowing any better. Unfortunately crawling comes before walking, and I'm still trying to roll over. 😕

---

<div class="post-metadata">

**Author:** ![Paul\_B](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_b/32/216376_2.png) [@Paul\_B](https://forum.arduino.cc/u/Paul_B)\
**Post date:** [March 18, 2021, 9:12am UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/10 "2021-03-18T09:12:51Z")

</div>

> obsessed:  
> I've never seen a 7 Segment tutorial that has pin 10 connected on the 74HC595 - can you help me understand what purpose it serves?

It is the reset line for the shift register. If you pull it low it zeroes the register. If you hold it low, you can do nothing with the 74HC595. If you let it float it is likely to **randomly** zero the register.

If you **ever** see a tutorial which shows it not connected, you know the author is totally clueless, it is advisable to keep well away from such a website. As PaulRB points out, the circuit you illustrate is an excellent example. 🙄

Some research indicates this was [discussed](https://arduino.stackexchange.com/questions/38834/cant-get-4-digit-7-segment-display-to-show-different-values) a few years back, no doubt more than once. 😀

---

<div class="post-metadata">

**Author:** ![obsessed](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@obsessed](https://forum.arduino.cc/u/obsessed)\
**Post date:** [March 19, 2021, 12:22am UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/11 "2021-03-19T00:22:14Z")

</div>

Thanks everyone for your help!

The issue was the missing connection to pin 10, as suspected. I made that connection and it works flawless.

Thanks so much for your patience with a newbie. I just bought a kit with different things to try to learn, as I want to incorporate an Arduino (Nano maybe?) into a specific project I have in mind, but I have a lot to learn before I can make that happen. 🙂

I have capacitors on order, and will use one as suggested as well.

---

<div class="post-metadata">

**Author:** ![ShermanP](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@ShermanP](https://forum.arduino.cc/u/ShermanP)\
**Post date:** [March 19, 2021, 4:56am UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/12 "2021-03-19T04:56:12Z")

</div>

This tutorial doesn't reflect well on Elegoo. You have all four digits displaying the same character instead of being individually controlled by the Arduino. And the current drawn by all the segments of a digit flows through a single resistor, which means the segments of an "8" will be dimmer than the segments of a "1". And where in the code is the display of "0"?

---

<div class="post-metadata">

**Author:** ![Paul\_B](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_b/32/216376_2.png) [@Paul\_B](https://forum.arduino.cc/u/Paul_B)\
**Post date:** [March 19, 2021, 9:50am UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/13 "2021-03-19T09:50:55Z")

</div>

> ShermanP:  
> This tutorial doesn't reflect well on Elegoo.

Not to mention pin ten! 🙄

Given all the other connections are - sort of - workable and the code straightforward, the behaviour cited by the OP is **extremely** hard to explain and I spent some considerable time examining the code for some obscure error.

So having the shift register erratically and sort of _randomly cleared_ really **is** about the only explanation (and even then does not properly explain "instead it goes 1, 3, 5, 7, " unless it was actually blanking in between). Unfortunately we frequently have to work on a **not-quite** -accurate description of the problem. 🕶

But do keep (using) the 0.1 µF capacitor(s). 😀

---

<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:** [July 17, 2021, 9:51am UTC](https://forum.arduino.cc/t/help-with-elegoo-4-digit-7-segment-display-tutorial/700637/14 "2021-07-17T09:51:40Z")

</div>

Closed on July 17, 2021, 9:51am UTC

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