Lesson 28 - 4 Digit 7 Segment Display

preview_player
Показать описание
Four Digit Seven Segment Display Module. Demonstrate the Elegoo sketch provided in the tutorial covering the display module, show it shortcomings and provide a revised sketch to properly control a 4-digit 7-segment display with 74HC595 shift register IC and four PN2222 transistors. A beginner's guide to the Most Complete Starter Kit by Elegoo.

Hello everyone, I'm Rick the Tech Enthusiast here with the next Elegoo Lesson. This is the next lesson on my Arduino UNO Series covering the Most Complete Starter Kit by Elegoo. I try to follow the included tutorial and will point out any changes or corrections as I find them.

As mentioned before, I purchased this Elegoo starter kit and Elegoo isn't sponsoring me. I just thought it would be fun to do a video of each Lesson as I was learning the Arduino environment.

We’ll need a few things from your Elegoo Arduino UNO kit. I’ll list the items below. In this lesson we’re going to check out the 4 Digit 7 Segment Display Module, 5641AS common cathode type. I’ll step through the Elegoo provided tutorial, briefly explain the code, the circuit, and some of the issues. Then I present my revised circuit and sketch that properly demonstrates the functionality. I hope you enjoy it.

Parts you’ll need for the tutorial:
* Elegoo UNO R3 board
* The 74HC595 shift register IC
* 4-digit, 7-segment display
* Four 220-ohm resistors
* The breadboard
* A bunch of male-to-male jumper wires

To build the revised circuit, add the following:
* Four 220-ohm resistors
* Four 5K-ohm resistors
* Four PN2222 transistors
The next lesson will be Lesson 29: DC Motors

Links:

Various Parts can be found: (Note these are Amazon Associates links)
(Full Disclosure: I get a little credit/$ if you purchase a linked item.)

Software:

Affiliate Links that Help my channel:

This is another video for my Arduino tutorial series. If you like the series, be sure to rate and subscribe.

Thanks for watching
Рекомендации по теме
Комментарии
Автор

Nicely done! Very thorough! Wow! Thank you for saving me from burning out the output pins on my Arduino! I only have two transistors in my starter kit, so I am displaying just 2 digits for now. I modified my displayDigits function to display each of the 2 digits for 1 ms each, and I added a for loop around that to set how long in ms to display the two digits for (eliminating the flicker). I set this to about 50 ms which worked great for my decimal counter (0 to 99). Now I know more about transistors!

GaryMarkowski
Автор

12:54 You are overdriving the 74HC595 which has a max chip current of 70mA. With 5v supply, 2.0v forward voltage of red led and 220ohm resistor, each segment requires (5-2)/220 = 13.6mA. When displaying an "8" that's 7 segments x 13.6mA = 95.2mA.

Enigma
Автор

Wonderful tutorial! BTW... I used the pin connections similar to the Arduino tutorial, so my bit positions are different from your spreadsheet, and the values being output for each number are different from your circuit. I used this code to determine the decimal values to output according to my pin connections.

// Bit positions for each segment
const int legTop = 0;
const int legUpperRight =1;
const int legLowerRight = 2;
const int legBottom = 3;
const int legLowerLeft = 4;
const int legUpperLeft = 5;
const int legMiddle = 6;
const int legDecimalPoint = 7;

int setSegments(int number, bool decimalPoint)
{
int retSegments = 0;

switch(number)
{
case 0: bitSet(retSegments, legTop);
bitSet(retSegments, legUpperRight);
bitSet(retSegments, legLowerRight);
bitSet(retSegments, legBottom);
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legLowerLeft);
break;
case 1: bitSet(retSegments, legUpperRight);
bitSet(retSegments, legLowerRight);
break;
case 2: bitSet(retSegments, legTop);
bitSet(retSegments, legUpperRight);
bitSet(retSegments, legMiddle);
bitSet(retSegments, legLowerLeft);
bitSet(retSegments, legBottom);
break;
case 3: bitSet(retSegments, legTop);
bitSet(retSegments, legUpperRight);
bitSet(retSegments, legLowerRight);
bitSet(retSegments, legBottom);
bitSet(retSegments, legMiddle);
break;
case 4: bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legMiddle);
bitSet(retSegments, legUpperRight);
bitSet(retSegments, legLowerRight);
break;
case 5: bitSet(retSegments, legTop);
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legMiddle);
bitSet(retSegments, legLowerRight);
bitSet(retSegments, legBottom);
break;
case 6: bitSet(retSegments, legTop);
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legLowerLeft);
bitSet(retSegments, legBottom);
bitSet(retSegments, legLowerRight);
bitSet(retSegments, legMiddle);
break;
case 7: bitSet(retSegments, legTop);
bitSet(retSegments, legUpperRight);
bitSet(retSegments, legLowerRight);
break;
case 8: bitSet(retSegments, legTop);
bitSet(retSegments, legUpperRight);
bitSet(retSegments, legLowerRight);
bitSet(retSegments, legMiddle);
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legLowerLeft);
bitSet(retSegments, legBottom);
break;
case 9: bitSet(retSegments, legTop);
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legMiddle);
bitSet(retSegments, legUpperRight);
bitSet(retSegments, legLowerRight);
bitSet(retSegments, legBottom);
break;
case 0x0A:
bitSet(retSegments, legTop);
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legLowerLeft);
bitSet(retSegments, legMiddle);
bitSet(retSegments, legUpperRight);
bitSet(retSegments, legLowerRight);
break;
case 0x0B:
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legLowerLeft);
bitSet(retSegments, legMiddle);
bitSet(retSegments, legLowerRight);
bitSet(retSegments, legBottom);
break;
case 0x0C:
bitSet(retSegments, legTop);
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legLowerLeft);
bitSet(retSegments, legBottom);
break;
case 0x0D:
bitSet(retSegments, legMiddle);
bitSet(retSegments, legLowerLeft);
bitSet(retSegments, legBottom);
bitSet(retSegments, legUpperRight);
bitSet(retSegments, legLowerRight);
break;
case 0x0E:
bitSet(retSegments, legTop);
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legLowerLeft);
bitSet(retSegments, legMiddle);
bitSet(retSegments, legBottom);
break;
case 0x0F:
bitSet(retSegments, legTop);
bitSet(retSegments, legUpperLeft);
bitSet(retSegments, legLowerLeft);
bitSet(retSegments, legMiddle);
break;
default:
retSegments = 0;
} // End Case

if (decimalPoint)
{
bitSet(retSegments, legDecimalPoint);
}

return(retSegments);
}

GaryMarkowski
Автор

The best tutorial for arduino I have ever seen for now. :)

clarkso
Автор

My kit is the Super Starter Kit and it came with only 2 transistors. Your scheme is really complex. Is it the only way to connect this display?

brunosuperman
Автор

Thanks for poiting out the flaws in the lesson 28 tutorial. Actually I am using a common anode but didn't realise the tutorial was about common cathode. But I could not figure out how to wire for a CC. So the shift register IC was boiling hot! I stopped everything. What are the modifications necessary for a common anode wiring? Cheers

LHommeDeParfum
Автор

Shame in you Elegoo; you just wasted my whole day. All I wanted to do was display some numbers on the 4-panel LED, so I thought I'd start with the Elegoo demo and take it from there. Then I find it doesn't work and spend hours trying to debug it. Then I come across this video and it tells me how bad and dangerous the sample is! Now after watching this video, I see how complicated it will be so I am giving up and will just use the LCD. This video is great if you want to proceed with it; but I don't now.

adammiles
Автор

Fantastic explanation and walkthrough. Subbed.

johnjackson
Автор

Very good and well explained tutorials Ricardo, I've been looking for this kind of 74HC595 shift register tutorials and even though there are plenty all over the net, I've been able to really understand how they work with your explanations. Could you please make a tutorial showing how to control a Led matrix and if possible how to create some effects on it like scrolling right to left and vice versa and some other effects? Like I said before there are a lot of videos about led matrices but they only show the hardware part but not how the code really works. If you decide to do it I will really appreciate it.
Thanks for all your Hard Work. Keep it UP!

wclumiere
Автор

Very well done video! I'd really like to convert this to a count down timer with minutes and seconds format MM.SS 99.59 to 00.00

MrMikeD
Автор

I've never seen a 'char' data type that is 16 bits. In Arduino IDE the char is an 8 bit signed integer.

colepdx
Автор

Why we need to use transistores? It's possible to do it without them?
I'm using a esp32-cam and i need to wire my 4 digit 7 segment display with the 74hc595

manuelfreitas
Автор

How do I connect my decimal point with with shift register? Do you have a code that then writes privileged 1.141?

rikjanssen
Автор

Before I watch this video I am going to make an assumption: The four digit display is controlled by setting certain segments from high to low and you can pick which one of the 4 digits you want to multiply.

cones
Автор

Bro can you upload a video on how to use 2 or more single digit 7 segment display with 74hc595 shift register with Arduino , i saw your videos all but there is no like that, your videos r great clean understand what we want to do in our projects, thanks for your hard work and we support u always

kvamsidharvamsi
Автор

The issue I have is my numbers don't start from 1 at the they start from a random value.... anyone know a solution?

heidik
Автор

Beautiful tutorial! But if i want write a casual decimal value on the segment, what is the command for that?

ElGarziaSiempre
Автор

is it possible to use the sn74hc595 with a common anode ?

abdullahanwar
Автор

So, the shift register is providing the power for the LEDs right? But in the 74HC595 datasheet, it says it's capable of providing 6mA output drive. But since you used 220 ohm resistors for limiting the current to the LEDs, that gives approx. (5-2)/220 = 14mA of current per LED. Wasn't that current supposed to fry the shift register?

bernardo
Автор

Okay I have tried to replicate the lesson from Elegoo (in which the four digits all cycle through) and have quadruple checked connections, and it goes through a very odd cycle starting with 1, 3, 5, 7, etc. Interestingly, if I move the red jumper wire from 5v (coming out of the Uno board) to the Vin pin, it works as shown above. Any idea what could be going on?

thetaylors