Lesson 28 - 4 Digit 7 Segment Display

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 มิ.ย. 2024
  • 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:
    This lesson’s sketch and associated drawings can be found at [Github](github.com/rmorenojr/ElegooTu...)
    Various Parts can be found: (Note these are Amazon Associates links)
    (Full Disclosure: I get a little credit/$ if you purchase a linked item.)
    * Elenco 350 Piece Pre-formed Jumper Wire Kit on Amazon: amzn.to/2z6sCCw
    * Elegoo EL-KIT-001 UNO R3 Project Complete Starter Kit with Tutorial for Arduino (63 Items) on Amazon: amzn.to/2KxZ8mA
    * Elegoo’s web site www.elegoo.com/ www.elegoo.com/product/elegoo...
    Software:
    * Fritzing Software: fritzing.org/download/
    * Arduino Language Reference (English): www.arduino.cc/reference/en/
    * How to use a common anode 7-segment, 4-digit display? arduino.stackexchange.com/que...
    Affiliate Links that Help my channel:
    * Logitech M510 Wireless Mouse on Amazon: amzn.to/2z4FF7F
    * Try Prime Discounted Monthly Offering: amzn.to/2PnVgSA
    * Try Amazon Prime 30-Day Free Trial: amzn.to/2E5Hy4O
    * Prime Student 6-month Trial: amzn.to/2ElxwNE
    * Join Amazon Prime - Watch Thousands of Movies & TV Shows Anytime - Start Free Trial Now: amzn.to/2PsEZvE
    * Give the Gift of Amazon Prime amzn.to/2EkFaYG
    * Kindle Unlimited Membership Plans: amzn.to/2QJl548
    * Try Audible and Get Two Free Audiobooks: amzn.to/2QD2B5v
    * Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices: amzn.to/2Ptpdkl
    Royalty Free Music from HookSounds.com, by artist Rodrigo Vicente - [FutureBass_Full](www.hooksounds.com)
    This is another video for my Arduino tutorial series. If you like the series, be sure to rate and subscribe.
    Thanks for watching
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 83

  • @johnjackson9767
    @johnjackson9767 3 ปีที่แล้ว

    Fantastic explanation and walkthrough. Subbed.

  • @GaryMarkowski
    @GaryMarkowski 2 ปีที่แล้ว

    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!

  • @1996rblue
    @1996rblue 26 วันที่ผ่านมา

    It works!!! Thank you so much!!!

  • @LHommeDeParfum
    @LHommeDeParfum 4 ปีที่แล้ว +1

    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

  • @ElGarziaSiempre
    @ElGarziaSiempre ปีที่แล้ว

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

  • @clarkso65
    @clarkso65 4 ปีที่แล้ว +2

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

    • @ceoofpoonis3668
      @ceoofpoonis3668 3 ปีที่แล้ว

      Clark what is your location

    • @killianrocky3431
      @killianrocky3431 3 ปีที่แล้ว

      Pro tip : watch movies at Flixzone. Me and my gf have been using it for watching a lot of movies these days.

    • @alvinjamir3130
      @alvinjamir3130 3 ปีที่แล้ว

      @Killian Rocky Yea, I've been watching on Flixzone} for years myself =)

  • @abdullahanwar3270
    @abdullahanwar3270 3 ปีที่แล้ว +1

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

  • @brunosuperman
    @brunosuperman 11 วันที่ผ่านมา +1

    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?

  • @GaryMarkowski
    @GaryMarkowski 2 ปีที่แล้ว

    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);
    }

  • @GerryChoco
    @GerryChoco ปีที่แล้ว

    What if I have multiple display module? How can I control it ?

  • @rikjanssen6440
    @rikjanssen6440 26 วันที่ผ่านมา

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

  • @colepdx187
    @colepdx187 ปีที่แล้ว +1

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

  • @MrMikeD28
    @MrMikeD28 3 ปีที่แล้ว

    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

  • @aaamarco6726
    @aaamarco6726 3 ปีที่แล้ว

    buongiorno bel video, volendo fare un orologio con RTC3231, 4 display 7 segmenti, che visualizza: ore: min: sec, e che periodicamente da temp. e giorno, come faccio a leggere i dati dal RTC e a visualizzarli sui display? Grazie

  • @muezaffar
    @muezaffar 3 ปีที่แล้ว

    can you show the design of it in quartus 2 please?

  • @manuelfreitas7165
    @manuelfreitas7165 2 ปีที่แล้ว +1

    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

    • @SpheresVA
      @SpheresVA 2 ปีที่แล้ว

      yeah I need mine without the processor

  • @techsilv5170
    @techsilv5170 3 ปีที่แล้ว

    Hi it's possible to that but with a 5digit 7segment?

  • @24-dinitrophenylhydrazine29
    @24-dinitrophenylhydrazine29 2 ปีที่แล้ว

    thank you sir.

  • @titoharyo6897
    @titoharyo6897 2 ปีที่แล้ว +1

    Do you have code colaborate with lm35??

  • @thetaylors8759
    @thetaylors8759 3 ปีที่แล้ว

    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?

    • @rickmorenojr
      @rickmorenojr  3 ปีที่แล้ว

      Greetings, first I need to confirm that you are using the same Elegoo lesson as shown in the video. Also Vin will supply unregulated power out. To get regulated 5V out, use the 5V pin. If you are using a USB cable, you're getting 5V from your computer. Your adapter may supply up to 9V. You can do a quick Google search for more information.

  • @Enigma758
    @Enigma758 ปีที่แล้ว +3

    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-3)/220 = 13.6mA. When displaying an "8" that's 7 segments x 13.6mA = 95.2mA.

    • @user-by8fp5uw2o
      @user-by8fp5uw2o 5 หลายเดือนก่อน +1

      I'm just starting out with micro controllers and just finished wiring this. If I proceed, will the shift register just have a shorter lifespan? If so, how much shorter?

    • @Enigma758
      @Enigma758 5 หลายเดือนก่อน +1

      @@user-by8fp5uw2o It's a roll of the dice. Just use higher value resistors, 470 instead of 220 and you should be fine. You won't even notice the difference in brightness.

  • @adixtrim
    @adixtrim 4 ปีที่แล้ว +2

    very good...

  • @bernardo5758
    @bernardo5758 4 ปีที่แล้ว

    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?

    • @rickmorenojr
      @rickmorenojr  4 ปีที่แล้ว

      I seem to recall that the Q0-Q7 max output current is 20ma each. I'll have to double check the datasheet. Though like many chips that are switch on and off rapidly, they can tolerate a little higher currents if need be.

  • @wclumiere5665
    @wclumiere5665 5 ปีที่แล้ว +2

    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!

    • @rickmorenojr
      @rickmorenojr  5 ปีที่แล้ว +1

      Thanks! Great suggestion! I worry that sometimes I go over the code in too much detail.

    • @amruthanair9988
      @amruthanair9988 4 ปีที่แล้ว

      wow such a good dumbo

    • @Inertia888
      @Inertia888 4 ปีที่แล้ว +1

      @@rickmorenojr Certainly not too much detail. It has taken me quite a number of hours to find such a quality explanation with such detail that I am able to begin to understand this project.
      Since beginning with LCD displays and I2C connections, seven segment displays with this type of connection were surprisingly more complicated. Maybe this is why it has not been easy to find great tutorials on them? I don't know...🤷‍♂️
      Either way, I am grateful for the work that you put in to help others learn. We may be very quickly approaching a world that will require this type of knowledge from us. At very least I think that having this knowledge will give a person a hand up in life.

  • @nxtlego
    @nxtlego 3 ปีที่แล้ว

    The kit only comes with two transistors. What do I do?

    • @Jason-xl8fm
      @Jason-xl8fm 3 ปีที่แล้ว

      Buy more, they aren't expensive. I saw a pack of 10 listed on adafruit for just under $2. I think he is using the Elegoo Complete Starter Kit which comes with 10 instead of 2.

  • @henriqueers
    @henriqueers 3 ปีที่แล้ว

    Where's the pin for GND?

  • @kosiogboruche4889
    @kosiogboruche4889 3 ปีที่แล้ว

    thx

  • @lacki9900
    @lacki9900 4 ปีที่แล้ว +1

    what do I have to write in the sketch to have a point at the 1000th place? At DisplayDigits [3] ??? you even wrote the byte DigitDP, but did not use it ...

    • @GaryMarkowski
      @GaryMarkowski 2 ปีที่แล้ว

      It is important to know the decimal value of the pin connections. In the original Arduino tutorial, the decimal value for the decimal point is 128. In the program here, the decimal value for the decimal point is 32. Add this value to the output value to turn on the decimal point.

  • @kvamsidharvamsi5800
    @kvamsidharvamsi5800 5 ปีที่แล้ว +1

    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

    • @rickmorenojr
      @rickmorenojr  5 ปีที่แล้ว +1

      Great suggestion. Thanks!

    • @kvamsidharvamsi5800
      @kvamsidharvamsi5800 5 ปีที่แล้ว

      @@rickmorenojr come on bro i want to use in my project for next month 10th can you post before that "2 or more single digit 7 segment display with 74HC595 " how to use and connect

    • @rickmorenojr
      @rickmorenojr  5 ปีที่แล้ว +2

      Unfortunately, the Elegoo kit only includes one 7-segment display. I did order a few more and hoping they arrive soon.

    • @amruthanair9988
      @amruthanair9988 4 ปีที่แล้ว +1

      @@rickmorenojr from where do you get to know your circuits. I want to learn it myself a well

  • @user-yp5yx1pt7r
    @user-yp5yx1pt7r 2 ปีที่แล้ว

    Thanks for you

  • @kolhatkarchinmay
    @kolhatkarchinmay 3 ปีที่แล้ว

    You will forget electronics and embedded systems after watching this video for sure!! Char is 16 bit...he'll yeah

    • @rickmorenojr
      @rickmorenojr  3 ปีที่แล้ว

      Oh darn. To clarify, typically a char is a value from 0 to 255, which is single byte and typically represents a letter or character. A byte can be a value between -128 to 127. An unsigned byte is 0 to 255. While researching this lesson I found that a char in Java is a UTF-16 code unit. It's not necessarily a complete Unicode character, but it's effectively an unsigned 16-bit integer. I'm not sure if this still hold true.

    • @kolhatkarchinmay
      @kolhatkarchinmay 3 ปีที่แล้ว

      @@rickmorenojr Ohh I dont know about the Java man. But I think as far as u r twiking around embedded systems char is always 8 bit or 1 byte...yes ofcourse you can creat your typedef to creat your own 16 bit char😉. Great video by the way!!

  • @kamleshajamere6784
    @kamleshajamere6784 4 ปีที่แล้ว +3

    where is the code

    • @rickmorenojr
      @rickmorenojr  3 ปีที่แล้ว

      The link to the code is available in the show notes.

    • @2010RSHACKS
      @2010RSHACKS 3 ปีที่แล้ว

      @@rickmorenojr Can you please show how to connect the wires and components on the breadboard. I dont care how it works, I just want to use it...

  • @cones914
    @cones914 2 ปีที่แล้ว +2

    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.

  • @adammiles5087
    @adammiles5087 ปีที่แล้ว +9

    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.

    • @1996rblue
      @1996rblue 23 วันที่ผ่านมา

      I kinda did it

  • @dorasimon7059
    @dorasimon7059 3 ปีที่แล้ว +1

    I dooooooooooooooooooooooo9

  • @CuberGamesOG
    @CuberGamesOG ปีที่แล้ว

    Imagine if his name was Rick Astley

  • @ziggymondus8753
    @ziggymondus8753 3 ปีที่แล้ว +1

    I don't get why you say "char array", instead of "character array" which would surely help learners absorb the concepts, as they would then recognise why 'char' is used in the code.

    • @rickmorenojr
      @rickmorenojr  3 ปีที่แล้ว

      Well, Arduino's reference calls this data type a "char" www.arduino.cc/reference/en/language/variables/data-types/char/

    • @PercyPanleo
      @PercyPanleo 3 ปีที่แล้ว

      @@rickmorenojr It's defined as "char" due to it being abbreviated. This is the case for (pretty much) any language that has a "char" data type.

  • @gohan3243
    @gohan3243 2 ปีที่แล้ว

    "char" should be "khar" since it is a character not a "tsaracter"

  • @aaamarco6726
    @aaamarco6726 3 ปีที่แล้ว

    Ciao bel lavoro
    puoi fare un video per
    quali modifiche devo fare per adattarlo a questo?
    th-cam.com/video/aRmNmZihD8o/w-d-xo.html
    th-cam.com/video/KZMISO55mGQ/w-d-xo.html
    grazie

  • @jeetenderkakkar7570
    @jeetenderkakkar7570 2 ปีที่แล้ว +2

    Pakistann

  • @RetroGamer-zz5jn
    @RetroGamer-zz5jn 2 ปีที่แล้ว

    after watching this, theirs too much inconsistancy with ur examples and hard to follow witch diagram is correct one. i have 3 diff breadboards and none of them match ur cheap sketch up version on 12.42 time frame. the segement display doesnt leave eno room for wires to run

    • @SpheresVA
      @SpheresVA 2 ปีที่แล้ว +3

      He clearly lists the "junk ones" as JUNK. also, that's your problem, not his. the only cheap sketch up is yours, and yours is CLEARLY too small. get a new one and stop whining

  • @jeetenderkakkar7570
    @jeetenderkakkar7570 2 ปีที่แล้ว +1

    Pakistann