7 Segment Display Multiplexing Arduino with CODE

Поделиться
HTML-код
  • Опубликовано: 16 дек 2024

Комментарии • 148

  • @petrovski1948
    @petrovski1948 11 лет назад +2

    Thanks for the excellent tutorials. I'm 65 and started watching your vids recently and I am actually learning stuff quite quickly. Not bad for me! Watched the serial to parallel latching chip and can actually understand it. Keep up the good work.

  • @NikolajLepka
    @NikolajLepka 11 лет назад +11

    To ease with your "goofy math" even further, consider using the "mod" operator
    it works like this:
    1234 % 10 = 4
    1234 % 100 = 34
    1234 % 1000 = 234
    1234 % 10000 = 1234
    and if you want to separate digits:
    1234 / 1000 = 1
    (1234 % 1000) / 100 = 2
    (1234 % 100) / 10 = 3
    1234 % 10 = 4
    what 'mod' does, is it gives back the remainder of an integer division;
    so 4 / 3 (or int(4/3) to be precise) = 1
    but 4 % 3 = 1
    because 4/3 = 3/3 + 1/3, 3/3 = 1, and 1 remains undivided

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    The resistors are for current limiting the LEDs in the 7-seg display.

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    in this case, since I don't have any free pins on the shift register, I would just use a digital pin off the arduino. check out the datasheet for which pins control the dp

  • @ghlawrence2000
    @ghlawrence2000 10 лет назад

    It is always inspiring to see the teacher getting completely confused during his presentation!! ;) :p Oh and we just had an expletive for good measure...... The first 10 minutes was reasonably concise and coherent, it really went downhill after that.....

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    a better schematic is now up on the website, link in description

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    yes, you can remove power after you program it, and yes you can remove the actual arduino chip (ATMEGA 328) from the development board and use that in a stand alone configuration. I have a ton of videos on that

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yes, that can be done with this technique or with only shift registers, you have 116 outputs? I controlled 1,536 outputs with an arduino on my 8x8x8 LED cube, so it might help to review the theory and code videos for that project.

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    exactly, there are a million ways to do this, but only a few to do it with the parts you have lying around on a rainy sunday

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    yep, you would have to recode it, and probably change the HW slightly. You should be able to add another one no problem though with what the video teaches

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    hmmm, yea you would have to do something like that, but you need to first make sure the added display is working. this sounds like a good challenge for you. good luck

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    I'd say a better way to do this is 7 seg drivers? or maybe straigt shift registers?

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yea this will pull more than an LCD, but because it's multiplexed, you only light up one 7seg display at a time, so saves a lot of power

  • @NikolajLepka
    @NikolajLepka 11 лет назад +1

    also, you don't need to write "int(input/1000)" if 'input' is an integer, the result will always be an integer, and will discard anything following the decimal place

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    yea, that's what you think... problem is that each segment will pull 20mA so 700mA for an '8' Thats a little to mush for the arduino

  • @azenkwed
    @azenkwed 8 лет назад +5

    you can use modulus for your math:
    thousands = int(number/1000);
    hundreds = int((number/100)%10);
    tens = int((number/10)%10);
    ones = int(number%10);

    • @honeylee277
      @honeylee277 8 лет назад

      is goood

    • @jeffersonjanaina3671
      @jeffersonjanaina3671 6 лет назад

      know any good formula to single out a float, or like the a decimal point? be nice for a scale etc. I've tried but I'm not smart enough lol.

    • @MARUTI96
      @MARUTI96 6 лет назад

      Azen Kwed have a look
      ruclips.net/video/swHAe4F1ivU/видео.html

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    awesome! You need to just repeat the display part in your code a few times. then increment the value

  • @rotcivisme
    @rotcivisme 12 лет назад

    i got the fifth display working! however, what do I need to do if I want to slow the count down? so that the last digit, the 'ones' is counting down in seconds. thanks!

  • @RuiSantosdotme
    @RuiSantosdotme 11 лет назад

    Thanks for this video it really helped me learning how to control the 4 digit 7 segment in a different way i didn't thought! I've recently made a project too using a 4 digit 7 segment but i've just used the 74HC595 IC to control the segments and i've used 4 digital pins of the arduino to control the digits!

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    exactly! just an idea with parts I had lying around. Maybe somebody else will learn from this as well

  • @razrbhr8888
    @razrbhr8888 12 лет назад

    If you try to add more functions to the arduino driving your displays which employ delay() there might be a problem like for example the display might stop working properly. You can use an attiny 85 and use it to drive your displays.. and an arduino would talk to it via serial to say stuff like "1000" and the attiny would write 1000

  • @rotcivisme
    @rotcivisme 12 лет назад

    What would I need to do if I want to add more seven segment displays?
    I have tried using a second shift register, I have wired it up learning it from your shift register tutorial, but that did no seem to work. Is is because of the coding?

  • @rotcivisme
    @rotcivisme 12 лет назад

    Would adding a "tenthousands" section work? similar to how you have the "thousands", "hundreds", "tens", "ones". Would I need to add other codings? because I have tried adding in a "tenthousands" section, and that did not work. thank you

  • @ronmann5810
    @ronmann5810 10 лет назад +1

    im trying to get this to work with a common cathode display, same pinout but polarity is reversed and everything i have set up should be working, any advice, i connected the four transistors on top the schematic to gnd and the emmiters of the bottom 7 transistors to positive

  • @SirArghPirate
    @SirArghPirate 10 лет назад +1

    Is it possible to make this without the shift register?

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    it works with the arduino ide, so pde or ino

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yea, for sure! good luck!

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    yes, that is on my list! I want to build it from scratch

  • @felixcat4346
    @felixcat4346 9 лет назад

    This is a cool video. Could you explain how a propeller clock is synchronized to the rpm of the motor.?

  • @mizuqnie
    @mizuqnie 9 лет назад

    is it possible to use a keypad for the input to output in the 7segment display?

  • @1kuhny
    @1kuhny 8 лет назад

    AS FOR FUTURE REFERENCE
    if you have a CD4017 a Decade counter/display driver with a common cathode display, you can just use the arduino to pulse the count up pin and then turn a transistor on, on the cathode end. then turn the transistor off, reset the counter and then repeat for the next digit :)

  • @ronmann5810
    @ronmann5810 10 лет назад +1

    your videos are great! by the way iv been watching them the last few years and thankyou

  • @vickyveetalAustin
    @vickyveetalAustin 11 лет назад

    good one
    can you tell me how much power it takes (voltage and amperes)
    4 no. 7 segments consumes more power or 16*2 lcd display

  • @EntangledQuanta
    @EntangledQuanta 11 лет назад

    I just started a project hacking a midi controller to replace the onboard mcu with an arduino. the very first step is similar to what you have. i think i can use the code almost as is to display the value of a 50K slider.
    Thanks

  • @ArtR0001
    @ArtR0001 10 лет назад

    Was looking for something like this to feed the output of a DTMF decoder into.

  • @FAIZANKHAN-ug4xr
    @FAIZANKHAN-ug4xr 5 лет назад

    Can you please explain 7 segment multiplexing with stm8?

  • @edalimir
    @edalimir 6 лет назад

    is it possible to drive those LED's without using transistors; output voltages of Q's of 74595 is 0V?

  • @caseybaker4640
    @caseybaker4640 10 лет назад

    Great video, I learned a lot. I have a common-cathode display as opposed to the common-anode type shown in the video; can I just switch the 5VDC and GND connections on the transistors and get the magic lights?

  • @wiinick90
    @wiinick90 11 лет назад

    I have no Idea what you are doing. What are the resistors for.

  • @techgood
    @techgood 10 лет назад

    build it and working Ok, now how can I display 777 and delay() or wait detect input pin? wont work only showing last single digit, thank you!

  • @paulobrasko
    @paulobrasko 11 лет назад

    First of all, great video. Secondly, at the beginning of your video you place a note on top of your video saying "yeah, yeah, there are other better ways of controlling a 7-segment display". Could you point me out which other ways, so I can look at them here at youtube? Thanks,

  • @danriley3910
    @danriley3910 9 лет назад

    Can I use a 12 volt dc linear potentiometer to power (6) 12 volt dc LEDs within 1.5 inches of travel?The lights need to light one at a time and stay lite until the momentary potentiometer returns home and turns them off one at a time.

  • @nazgul05
    @nazgul05 12 лет назад

    could you upload or send me a photo of the breadboard and the connections to the arduino, please? I cannot see them clearly from the video :S

  • @ljay0778
    @ljay0778 9 лет назад

    your code wont compile in Keil? strange that the function setup() is neither prototypes or called in the program what does it do? compiler calls all four lines an "Error"? i dont see main() either there is no for loop and the loop dont work as write dang it! what compiler did you use?

  • @iiicrazy
    @iiicrazy 12 лет назад

    Thank you for the good tutorial. Any idea how to use the decimal point?

  • @smiley235
    @smiley235 11 лет назад

    Noob question here from someone who doesn't understand the theory totally, I thought the NPN transistor's (at the top of the circuit) emitters were supposed to connect directly to ground and if that wasn't the case, you would use PNP transistors. Any help here would be appreciated.

  • @valeriejalandoni9563
    @valeriejalandoni9563 10 лет назад

    please where is the site you posted the picture of schematic diagram? can I borrow your design for my project I badly needed it. Thank you.

  • @themouseisinthehouse
    @themouseisinthehouse 11 лет назад

    Could you use 2 bit shifters rather than 1 shifter and 1 BDC to 7 segment? These shifters has latch right? Send the 1st 7 segment data in the 1st shifter (serial) then enable the 1st 7 segment using the 2nd shifter. Send the 2nd segment data in the 2nd shifter then enable the 2nd 7 segment using the second shifter.
    Will this work?

  • @91Tuneup
    @91Tuneup 9 лет назад

    Aren't these common anode displays, instead of common cathode? Did you mix things up, or am I wrong with my interpretation of common anode/cathode?

  • @bratan007
    @bratan007 8 лет назад

    You can build same circuit with just 2 shift registers. I just did. In fact I didn't use a single transistor, just two 74SN695 and 8 1K resistors (just to be safe).

    • @alextrezvy6889
      @alextrezvy6889 8 лет назад

      I suppose he could use even 1 shift registor. Digit selection could be done by MCU.

  • @pikadroo
    @pikadroo 9 лет назад

    I can't seem to get this approach to work at all.

  • @marcooasan1668
    @marcooasan1668 8 лет назад

    hi do you know how to print white text in pcb? thanks

  • @andreww1212
    @andreww1212 12 лет назад

    I just bought the multiplexer along with the display to avoid all of the wiring.

  • @Tubepkp
    @Tubepkp 12 лет назад

    @ 3:42
    It's a Common Anode Display and the Cathodes are not connected internally.
    Even the gut guy that gave you the schematics has made a BOM for us.

  • @joaoferracatim5024
    @joaoferracatim5024 9 лет назад

    Hi Kevin! I like your approach on this because we only need 3 arduino pins.
    I have two questions and I would appreciate if you could answer them.
    The transistors that enable each display shouldn't be PNP instead of 2N3904?
    In order to reduce the space and the number of components in the prototype board, can I connect CD4511 directly to the display? If not, I was thinking about using ULN2003.

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    yes!! glad it helped

  • @McKaamos
    @McKaamos 12 лет назад

    Wouldn't it be easier to cast the number into a char array, then convert each array item to an integer, add 16, 32, 64, or 128 and shiftout that value? That way youget your number in the lower 4 bits and enable the appropriate 7seg display with the upper 4 bits. Just hypothetical, haven't tested it.

  • @gopaljibansal898
    @gopaljibansal898 6 лет назад

    Can you do coding for my Digital meters

  • @322doug
    @322doug 8 лет назад

    hi, im trying to get some of these type except mine have 11 pins and are 3/4 " x 1/2" and red, does anyone know where i might be able to find these? Common Cathode 11 Pin 1 Bit 7 Segment 0.75" Red LED Display Digital Tube

  • @MrLovebollywood
    @MrLovebollywood 12 лет назад

    hello kdarrah1234 , i was wondering if you have a circuit diagram for the connections between each component, and a list of components you used, i am making a ultrasonic range measure for my college project and it would really help!! Thanks

  • @ariyuli4nto
    @ariyuli4nto 11 лет назад

    I'm sorry sir,can I use Arduino Nano V3.0 Compatible to make it???
    If can't , what the kind of arduino can I used???
    Thanks for information..

  • @zaprodk
    @zaprodk 11 лет назад

    I find it interesting that you are using NPN transistors af High-side drivers. In order for the NPN to conduct, the base must be Vbe (about 0.7V) higher than the emiitter, so for your case, you would never see more than 4.3 volts at the emitter (assuming 0 base current) which isn't really ideal.

    • @caseybaker4640
      @caseybaker4640 10 лет назад

      so what do you recommend?

    • @zaprodk
      @zaprodk 10 лет назад

      Casey Baker P-channel MOSFETS.

  • @cyberpunk7088
    @cyberpunk7088 6 лет назад

    i thought u r doing that with code , without shift register

  • @PaulHikes22
    @PaulHikes22 11 лет назад

    Your videos are fantastic. Your great at teaching electronics. Thank you!

  • @MultiGoldensilver
    @MultiGoldensilver 11 лет назад

    What do you save the source code as?

  • @ISmellBurning
    @ISmellBurning 11 лет назад

    a short has max value of 255.
    So you don't need 16 bits, it only needs 8 which is a single byte. A nibble is half a byte.

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    yea, that would be cool! thanks!

  • @tiagorodrigues-xj7oj
    @tiagorodrigues-xj7oj 7 лет назад

    How would that math in the first subroutine look if it were displaying seconds, minutes and hours? I just can't seem to wrap my head around that, other than that this has been very helpful!

  • @wire54321
    @wire54321 12 лет назад

    Thanks! for explaining how Multi-Plexing works!

  • @roopamsonpethkar9592
    @roopamsonpethkar9592 8 лет назад

    can i get this same thing for 8085?

  • @Lost_Hwasal
    @Lost_Hwasal 9 лет назад

    Sort of confusing, your circuit layout on the whiteboard and coding suggest that you have 4 single digit 7 segments, but your video shows a 4 digit 7 segment display, which already has a multiplexer built into it. Some clarification please, thanks.

    • @42222
      @42222 9 лет назад

      AngryKhan The display doesn't have a multiplexer. It has 4 pins for each digit and 8 pins for a,b,c,d,e,f,g,dot. It kind of works like led matrixes.

  • @geneirwin645
    @geneirwin645 Год назад

    This display is actually common anode. The common refers to all the leds in the digit

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    ha, no, why?

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yea maybe, but this here is just for 7 seg displays, so just numbers 0-9

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yes there are... this is just one

  • @scootersdenver
    @scootersdenver 10 лет назад

    Your videos are all very helpful. THANKS!

  • @ivanexequielsytico1797
    @ivanexequielsytico1797 7 лет назад

    can i have your code and schematic?

  • @SlappyMcK
    @SlappyMcK 11 лет назад

    Typically, the emitters for NPNs are connected to the ground, and the load is connected in series with the collector. The reason for such convention escapes me right now....

  • @MultiGoldensilver
    @MultiGoldensilver 11 лет назад

    I have tons of questions. Can I pm you them?

  • @agustinduarte8384
    @agustinduarte8384 11 лет назад

    What kind of arduino board are using you?

  • @EberFreitasDias
    @EberFreitasDias 10 лет назад

    Hey, I'm really new to electronics and Arduino and I was wondering... Are the top transistors really necessary? What would happen if you didn't use them. Thanks!

    • @Kevindarrah
      @Kevindarrah  10 лет назад

      They're just needed to pass more current than the IC can handle

    • @EberFreitasDias
      @EberFreitasDias 10 лет назад

      Kevin Darrah
      Couldn't you just use resistors for that? Or is it a requirement because of the Cd4511?

    • @EberFreitasDias
      @EberFreitasDias 10 лет назад

      Kevin Darrah Don't worry. I get it now :) Thanks!

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    cool, thanks for posting the tips!

  • @wingman358
    @wingman358 10 лет назад

    couldnt get Carlos' schematic and your code to work

    • @Volvo1969
      @Volvo1969 9 лет назад +1

      I had the same problem, pin 8 on the 4511 in the original schematic is grounded, on Carlos it isn't mentioned. And a missed to ground pin 5, and the display just was goofy..

  • @ukdiveboy
    @ukdiveboy 12 лет назад

    Nice! BTW, short is 16 bits. 4 bits would be a 'nibble'.

  • @rainbowsalads
    @rainbowsalads 12 лет назад

    there is a way to daisy chain three shift registers via the Q7 pin, so you can light up 3 x 7 seg displays. you'll only need to send 3 x 8 bit serial commands to change all three displays and they will latch. So there is no need to constantly fire out data to create the illusion they are all on. with only 3 pins needed on the arduino also. it works very well. worth a try.
    search google : " little scale blogspot three-595-shift-registers " should be second result down on google.
    peace : )

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    thanks, nice username!

  • @lawrencejob
    @lawrencejob 12 лет назад

    Nice video. May be worth looking at the modulo operator. :)

  • @JarppaGuru
    @JarppaGuru 10 лет назад +2

    i making display for flight simulator i need minimum 26 digits and layout would be 000 000 00000 00000 00000 00000.i was thinking just use 5 shift register and connect them serial. one will control value and rest position. do you have good solution for arduino code :)

    • @Vtrontv
      @Vtrontv 10 лет назад

      Hey let me know your setup when you are done ! Thanks !

    • @JarppaGuru
      @JarppaGuru 10 лет назад +1

      charan k.v Don't have parts yet to build it, but here is quick schematic how i think it would work :) then need arduino code to drive it.
      hxxp://s4.postimg.org/w50h2s0al/7_Segment_Display_Driver.jpg

    • @mohamedsayed8751
      @mohamedsayed8751 10 лет назад

      Great coincidence !! - I was wondering the same as I'm going to build a 747 cockpit - Needing an IC with 26-output pins & at least 1 input for shifting order to be a shift register, layout will be ( Speed-3 digits / Heading-3 digits / VS-5 digits / Altitude-5 digits / Cpt VHF Stdby-5 digits / FO VHF Stdby- 5 digits ) ...
      I will control this circuit by parallel port , Pin 1,2,4,8 with 4511-IC to give a BCD code // and Pin 16 ( parallel port ) to give a pulse signal to shift register IC input to shift ..
      Code will be done by VB6 :
      1- Timer with a 50 milliseconds scans FSUIPC offsets of MCP digits and VHF tuner and include all numbers without any breaks or spaces in a locked textbox like (250090-2800150001190511905).
      2- Timer with a 10 miliseconds will scan each number individually and sends output to parallel port pins 1,2,4,8 with BCD code and after that it sends a shift pulse output on pin 16 to shift register IC input pin to switch selected digit ..
      3- In the new cycle for reading the 2nd number of the textbox, the shift register would selected the 2nd 7-segment display to feed with BCD code ... and thus
      All I need is a shift register IC with 26 outputs and at least 1 input ...

    • @MARUTI96
      @MARUTI96 6 лет назад

      JarppaGuru
      ruclips.net/video/swHAe4F1ivU/видео.html

  • @iiicrazy
    @iiicrazy 12 лет назад

    I think you did not get my question! I know the 4 DPs share the same pin (7), so each DP is a part of each digit, exactly like A, B, C, ...etc
    Thanks anyway.

  • @andrewhopkinson4445
    @andrewhopkinson4445 8 лет назад

    Hi Kevin, nice work! Just wondering, I don't see the code on your site?

    • @andrewhopkinson4445
      @andrewhopkinson4445 8 лет назад

      Woops, I see it, don't worry about it. :)
      My challenge will to try and chaing two of these together. Phew!

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    thanks man!

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    you may want to remove your email from this comment, a spambot might grab it. I won't be able to help you too much, but what you're trying to do should be very simple, just write whatever number you want to a routine that handles the display. how you countdown is up to you. the display routine will write whatever number you give it

  • @3forksconstruction
    @3forksconstruction 11 лет назад

    I would think if you are going to build your own digits using a driver I would use a MC14489 which saves alot of code. Or just buy the chip already built into the display from ebay if they still have it called tofd-5465 for like 20 bucks for 10 displays the only downfall is they dont have decimals working on them. But then again what do i know im just a plumber

  • @ColinRichardson
    @ColinRichardson 8 лет назад +1

    You say this is a common Cathod Display? But your whiteboard suggests its a common Anode display?? Now I cannot see anyone else saying this, which makes me believe I am wrong, but tying all the A's Cathods together, doesn't make it Common Cathod does it? Since all the A,B,C,D,E,F,G[,H] anodes for a single digit are tied together, this is normally called a common Anode display. Because if it was a single digit, only the Anodes are common.

    • @wizegeek
      @wizegeek 8 лет назад +1

      true, according to Kevin's whiteboard this is a common anode, which just happens to have the cathodes multiplexed.

  • @OneCoolDude08
    @OneCoolDude08 11 лет назад

    85% of YT videos with cool projects DON'T share the code. Thanks for not being a d-bag like them! Subscribed!

  • @HobbyBots
    @HobbyBots 11 лет назад +1

    The Arduino IDE is freaking annoying. A mouse click triggers the scroll if it's in the top or bottom 4-5 visible lines of code. Also the IDE treats a _short_ the same as an _int_ so it's 16-bit (-32,768 to 32,767). Nice video BTW.

    • @NikolajLepka
      @NikolajLepka 11 лет назад +1

      en.wikipedia.org/wiki/C_data_types
      int and short in C are both 16 bit...
      you can use int4_t or int8_t if you want 4 or 8 bit integers respectively

    • @viewfromadistance
      @viewfromadistance 10 лет назад

      You can use a different editor... then just use the IDE to compile and run...

    • @NikolajLepka
      @NikolajLepka 10 лет назад

      Another thing is that the IDE doesn't treat anything as anything, the IDE is just an editor
      Blame it on the compiler

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    eh, just getting creative I guess, but yea you're right, I didn't have to use one

  • @koncertLive
    @koncertLive 11 лет назад

    I think I need that counter to count the number of yawns this video induced!! :)

  • @Kevindarrah
    @Kevindarrah  12 лет назад

    ha, thanks!

  • @UDK11
    @UDK11 11 лет назад

    Grasias si~or Kevin I've been learning a lot