#249

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

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

  • @MrEdwardhartmann
    @MrEdwardhartmann 2 года назад +4

    This is a great idea for a small project with limited I/O lines. And using a single resistor does cut down on parts and complexity with the noted downside that numbers that use less segments will be a little brighter. I have seen a 7 segment driver that allowed you to configure it for single resistor implementations and the driver would automatically shorten the “on” time the bright digits to make them all look about the same. Best of both worlds - one resistor and digits that all look alike. But I “assume” that this driver controls the on and off times using the common line, and that would not work in your dual use configuration since there would need to be times when both digits are off. It could be done, but I expect it would be more difficult.

    • @RalphBacon
      @RalphBacon  2 года назад +2

      Indeed. I wouldn't use the single resistor design for a bedside alarm clock as the change in digit brightness would be quite noticeable. If the time were 10:18 the "0" and "8" would be noticeably dimmer than the "1" digits.
      But for a simple error reporting dual 7-seg display we can live with the slight difference in brightness, I reckon.
      Interesting about shorting the "on" time depending on what digit is being displayed. So a "1" would be on for a shorter time than an "8", for example, to give the same perceived overall digit brightness. Interesting!

  • @Poult100
    @Poult100 2 года назад +1

    Ahh, this takes me back, Ralph! A company I used to work for built big digit displays for scoreboards. But the segments were made from incandescent bulbs with Fresnel lenses driven by Darlington BJTs. It all got rather warm! But they were multiplexed in a similar way only, not with your complementary switch! However, I also used the same method for switching a couple of motorised valves, with a single data line. So we'll have to share the patent! 😉

    • @RalphBacon
      @RalphBacon  2 года назад +2

      Can we share the royalties too, Simon, I'm a bit skint this month, what with the electricity and gas prices in the UK...

    • @Poult100
      @Poult100 2 года назад

      @@RalphBacon Yes, let's do that. This time next year, Rodders, we'll be millionaires! 😁

  • @gpTeacher
    @gpTeacher 2 года назад +1

    I can't think of a better way to start the weekend than with another insightful sample of electronic "Bacon drippings"! Thanks for another great tutorial Ralph!

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Bacon drippings, Gord? Quite frankly that doesn't sound too appealing but I get the meaning. 🌭🥓🍳

    • @gpTeacher
      @gpTeacher 2 года назад

      @@RalphBacon it's a compliment to your sharing of very helpful and insightful knowledge. Thanks again!

  • @MrAlFuture
    @MrAlFuture 2 года назад +2

    The dual, complimentary mosfet is a great idea!

    • @RalphBacon
      @RalphBacon  2 года назад +1

      I think so too! Thanks MrAIFuture!

  • @MaxintRD
    @MaxintRD 2 года назад +2

    Hi Ralph. Another nice video with great explanations! Thank you!
    For readers looking into this: if you cheaply want to reduce pin count and processor usage even more, I can recommend the TM16xx series of LED drivers by Titan Micro. The TM1638 is used in a popular LED & Key module. These chips use only two or three data lines, do the multiplexing automatically and can drive many leds in a display. 8x16 for the TM1640 for instance. (Mentioning my library and videos about them would be a shameless plug, so I will refrain from that. ;-)
    Years ago Ralph also made some videos (video #9 and up) about a similar chip: the MAX7219. That one is a bit more expensive and doesn't offer support for reading button presses, but is also quite popular.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Spooky! Today I have been using the MAX7219 in earnest for a future project (finally found a use for my 1 metre long matrix display) but I want it controlled / controllable via Wi-Fi.
      So you have a library for the TM1638? Not this one: github.com/maxint-rd/TM16xx
      We will see whether YT kills this comment due to external links!

    • @MaxintRD
      @MaxintRD 2 года назад

      @@RalphBacon Was it coincidence or a glitch in the matrix? 🙂 Thank you for dropping that link! Indeed, that's the one. Hopefully YT keeps it there...
      After first using the library made by Ricardo Batista, I made some improvements. Then I came across many more chips within that family and accepted suggestions by other people, resulting in a sizable collection of variants of modules and bare chips. Although these chips have their limitations, I find them quite useful and very affordable. I had great fun with many blinkenlight projects. (If only I could reach your skill and productivity to capture that in YT videos...)

  • @enriqueeenriquez8818
    @enriqueeenriquez8818 2 года назад +4

    The use of the MOSFETs is clever

    • @enriqueeenriquez8818
      @enriqueeenriquez8818 2 года назад +2

      and the use of a 74XX chip to drive the LED may reduce the use of GPIO and programming

    • @RalphBacon
      @RalphBacon  2 года назад +2

      Quite so. We shall discover all this if the PCBs arrive. Did I say "if"? Did I say "if"? I meant "when", obvs, any day now!

  • @jstro-hobbytech
    @jstro-hobbytech 2 года назад +1

    It's usually 8 or 3. But I'm used to using single digits. Enable the thank you button or membership so I can give back to your hard work brother.

    • @RalphBacon
      @RalphBacon  2 года назад

      I have a "Buy Me A Coffee" button (link) in my video description, Joey, but they've ruined it because it was $5 and now it's £5 (quite a jump). And they stopped PayPal. If it ain't broke...

    • @jstro-hobbytech
      @jstro-hobbytech 2 года назад

      @@RalphBacon I never noticed. Thank you sir

  • @la6mp
    @la6mp 2 года назад +1

    Thanks again for an interesting video, over the years you have taught me a lot! I have a suggestion for a future video; how to control a bunch of 7 segment displays with only 3 GPIO pins. I have built a clock with 6 big 7 segment displays, in order to get enough brightness they are driven by 12V. I manage to control them with only 2 595 shift registers in cascade. The fist sets the 7 segments (and even has one pin free to control a punctuation mark if needed), and the second 595 chooses with display to be supplied by 12 V using P-channel MOSFETs on the hight side. In theory I could use these 595s to control 8 displays! Because of the 12 V supply I buffered the output from the first 595 with a driving circuit that can handle the voltage. I did this as readymade drivers for 6 segments really didn't cut it due to the higher voltage of the displays. It was a lot of work, but I think I got a fair understanding of how to implement serial data. OK, this is just an idea.. Cheers!

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Interesting use of two 595s. I'm using two in my forthcoming dual 7-seg display. I did not think to control the power (via a MOSFET) with them though. Sounds very novel. 👍

  • @Enigma758
    @Enigma758 2 года назад +1

    4:44 I think common cathode works well when you're driving the segments directly from an I/O or a chip pin (and possibly overall less current draw since the I/O outputs are "off" when the the display is blank and at rest. However, when using an external supply and driving the display with NPN BJTs or N channel mosfets, I think the common cathode works "best" since N types are effective current sinks and can drive each segment low (as a low side switch). But in that case, the common cathode requires a high side switch using less common P types. In addition, if the external supply is greater than I/O pin "on" voltage, and a common cathode is used, the lowly I/O pin can't turn the P transistors on since the base can't be driven close enough to the high rail. A common solution is to drive the P with an N, but now that requires two transistors per segment. For this reason, I generally prefer common anode LEDs. But of course I suspect you will agree that its best to first consider the application and power before deciding on which is "best" (and that is why both configurations exist).

    • @RalphBacon
      @RalphBacon  2 года назад +2

      As you say, always best to see what works best in any one particular case. I was a little surprised this worked so well. Oh, maybe I should not have said that. 😲

    • @Enigma758
      @Enigma758 2 года назад

      @@RalphBacon Thanks for responding. All the best Ralph!

  • @scottstevens7569
    @scottstevens7569 2 года назад +2

    An Interesting video well presented again Ralph. Thanks for all your innovation! Very deserving of a prize for this idea, Surely your Nobel Prize is in the mail. :)
    Persistence of vision can be a useful electronics trick as you have aptly used here and that multiplexing is really handy with these small MCs. 🙂

    • @RalphBacon
      @RalphBacon  2 года назад +2

      I checked the post this morning, Scott, (Post Office strike cancelled due to Her Majesty's passing) but no Nobel anything in there at all. 😟

  • @SpinStar1956
    @SpinStar1956 2 года назад

    LEDs are my favorite display but unless you implement very dark filters, they are problematic in direct sunlight and of course utilize more energy.
    That being said, I first had an LED watch and did go through a lot of batteries; I then got a an LCD w/o backlight and indoors it was a bust. Guess I needed a solar powered LED one.
    Great Video as always with detailed explanation. One of the very best Arduino/electronics channels on RUclips!.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Thank you for all your kind words! Yes, I will be using a dark red acetate for a future project, involving lots of LEDs in a matrix. I might even see whether a small piece works better for the error-display dual digit project.

    • @SpinStar1956
      @SpinStar1956 2 года назад +1

      @@RalphBacon I bought some 1/8” ruby-red plexiglas (poly carbonate) and two layers does well in bright light ☀️

  • @b.c.5024
    @b.c.5024 2 года назад +1

    You can make it even cheaper (no transistors needed) by connecting common anode and common cathode segment displays together. Common low drives one segment, common high drives the other. Also since you're only momentarily driving an led (and GPIO's rarely source much current anyway) you can get away without any resistors. But I also vote for the Aliexpress TM1638 "LED & KEY" boards which make prototyping easy. Cheap, simple, and frees CPU cycles.

    • @RalphBacon
      @RalphBacon  2 года назад

      Yes, the common anode/cathode complementary 7-seg digits would work, and I did mention that in a previous comment. I still would use a current limiting resistor though! Even though each digit is on just a fraction of a second, that could still mean excessive current flow and a (much) shorter LED life.
      My 74HC595 project also frees CPU cycles as it is a fit and forget system, but I'll look at the TM168 too (now that you mention it, I'm I've already done this, must check!)

  • @keitholiver3981
    @keitholiver3981 2 года назад +2

    This took me back quite a few years, cost prohibited we used a 14 pin DIL resistor pack as current limiting for the segments. In production easer to install and the design of the PCB.

    • @RalphBacon
      @RalphBacon  2 года назад +2

      I actually looked at resistor networks but they were too expensive and big, too. These days, 8 tiny 0402 SMD resistors would be used. (Not soldered by me, but someone in the Far East with better eyesight!)

    • @keitholiver3981
      @keitholiver3981 2 года назад

      Shows how technology has moved in since the 70’s

  • @doverivermedia3937
    @doverivermedia3937 2 года назад +2

    Very insightful and well explained. Thank you ... 🇬🇧

    • @RalphBacon
      @RalphBacon  2 года назад +1

      You are very welcome! Nice to see you here 😉

  • @jp040759
    @jp040759 2 года назад +4

    I think you should put the resistor on the Drain of the P-Channel tranny. The voltage drop across it subtracts from the (Vgs) gate voltage that turns the MOSFET on. It may not be saturate . This wiring of the P-Channel is not really the proper use of it. The LED drop of each segment already subtracts 1.5 to 2 volts so your Vgs is only -3 volts instead of the full supply rail of -5 to fully saturate the P-Channel Mosfet. OR This is done often in circuits that need inversion from one control pin. This is a more common accepted prractice. Use the N channel FET to drive one segment and also drive a second N Channel MOSFET's gate. But now the second MOSFET gate has a pullup resistor to turn it on when the first FET is off. So when the first FETs gate has 5 volts on it, it fully saturates ON. That pulls the gate of the second FET to ground and turns it off. The seceond N Channel FET has become a simple inverter circuit that then toggles the two segment's commons. You should always directly reference the Gate and Souces of the MOSFETs to the power rails like you did the N channel ciruit you drew.

    • @RalphBacon
      @RalphBacon  2 года назад +2

      I would not want to put a resistor on the Drain of the "P" channel as that will raise the ground reference level; MOSFETs can behave oddly if the GND is not a GND.
      What I should have done (maybe) is used a Common Anode for one digit and controlled the power via the P -Channel in the supply line (ie before the LEDs).
      But: this method works!

    • @jp040759
      @jp040759 2 года назад

      @@RalphBacon P Channels are usually wired as high side switching and not referenced to ground. They are reference to Vcc. Anyway. Just out of curiosity which P channel FETs are you using? You never mentioned it. Thanx

  • @sandesh.achari
    @sandesh.achari 3 месяца назад

    Thanks, Ralph for a clean demonstration. Very nice!

  • @grahamheath3799
    @grahamheath3799 2 года назад +2

    Multiplexing is old hat; I remember talking about in my twenties (that would make it circa 1975, ouch. Mind you that would have been with filament 7 segment displays. Also there are latch-able 7 segment displays with decoder therefore 4 lines per digit. The use of N and P channel mosfets is interesting though.

    • @RalphBacon
      @RalphBacon  2 года назад +3

      It's the last bit I'm claiming a "first" for, not multiplexing! I built my first multiplexing bedside alarm clock around 1973. Of course I was only 2 years old at the time. Maybe 3.

    • @grahamheath3799
      @grahamheath3799 2 года назад

      @@RalphBacon Yes it's just so long was spent on the multiplexing that I had mentally switched off by the time we got to something interesting.
      I cannot claim to be such a child prodigy!!

  • @stevewilliams1054
    @stevewilliams1054 2 года назад

    Yet another interesting circuit design and demonstration thanks, Ralph.

  • @jparky1972
    @jparky1972 2 года назад +1

    If you are still running out of GPIO pins...
    You *could* have a secondary microprocessor chip do all the hard work.
    I.e. A 328p chip used as an I2C Slave to the main processor. This chip connects to the display one GPIO per segment.
    It receives commands via I2C from the main processor. So only takes 2 pins from the main processor
    AND.. You can program in additional functions like flashing, fade, busy animation, error displays etc.
    AND.. It minimizes the code footprint in the main processor.
    You could even build this as a stand alone PCB module that could be used in 'any' project.
    I love I2C. So versatile.

    • @RalphBacon
      @RalphBacon  2 года назад +3

      I2C is great, but to consume a whole 328 processor to do this would never pass the finance committee stage, Jason.
      I hope to see how it goes with a (much cheaper) Tiny167 (already on order just to experiment) so we're already sort of on the same page.

    • @jparky1972
      @jparky1972 2 года назад

      @@RalphBacon
      I haven't used a Tiny167 and in all honesty haven't heard of one. There are so many new Tiny's that it is difficult to keep up.
      I used the 328p as an example simply because I know it has enough pins and plenty enough memory for the task.
      I've used an ATTINY85 in the past as a serial to i2c bridge in much the same way.
      I look forward to seeing your Tiny167 project.

  • @ForwardGuidance
    @ForwardGuidance 2 года назад +1

    Everything is better when wrapped in BACON!!!! Thanks for sharing.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Nice of you to say, thanks for commenting and visiting 🥓

  • @anokhautomation4453
    @anokhautomation4453 2 года назад +1

    Very very useful tutorial 👍 thanks for your detailed explanation 🙏

  • @1_HighDuke
    @1_HighDuke 2 года назад +1

    Awesome info, Ralph! Thank you!

  • @igrewold
    @igrewold 2 года назад +1

    Good stuff Ralph, thanks

    • @RalphBacon
      @RalphBacon  2 года назад +1

      No problemo, thanks for visiting.

  • @blic-sx9ix
    @blic-sx9ix 2 года назад +1

    Another well done video. Keep up the good work!

  • @MrCatchers
    @MrCatchers 2 года назад

    Hi Ralph,
    I always enjoy your videos, especially when they provide the opportunity to be hands-on.
    I really enjoyed making your internet radio, but that must be almost a year ago now. Hopefully you will have the time to design another project for us Arduino fans soon?
    Brian

    • @RalphBacon
      @RalphBacon  2 года назад

      Large projects like that take a long time but I'm sure something will come up sooner or later!

  • @peoplethesedaysberetarded
    @peoplethesedaysberetarded 2 года назад

    Good to see you back!!

    • @RalphBacon
      @RalphBacon  2 года назад

      Nice to be here, thanks!

  • @jonathangainsford6811
    @jonathangainsford6811 2 года назад +1

    Great idea Ralph, thank you.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Thanks for visiting, Jonathan 👍

  • @Enigma758
    @Enigma758 2 года назад +1

    Looks like you are using an Uno R3 which has 5v output and a chip max of 150mA. So if you use one 220ohm resistor per segment and DP, and assuming a 2v forward voltage of each red LED, that's a total current draw of 109mA. That results in using up 73% of the total current available when all digits and DP are lit for a single digit. Always calculate power usage, not just for each pin, but also for the max allowable chip current.

    • @RalphBacon
      @RalphBacon  2 года назад +2

      Well, you're being a bit conservative there. 😲
      The total current that the ATMega328P can safely consume is 200mA. Using a 220Ω resistor allows about 10mA forward current on the LED segments I'm using. So, 80mA per digit. Only one digit is on at any one time. Pretty safe. 😉
      More importantly, as I've tried to put everywhere, you would never use that many pins directly from an Uno, it's just too wasteful. This is just a demo. In Real Life we'd use some additional hardware, like the 74HC595, to reduce the pin count to just 3. Or maybe a PCF8574T which can be controlled by I2C (so just two pins) and is often used to control LCD displays for the same reason. And it keeps the current flow well away from the Arduino pins too!

    • @Enigma758
      @Enigma758 2 года назад +1

      @@RalphBacon The source I found indicated 150mA, but after checking, you're correct it does appear to be 200mA. One must also be careful when using the 74HC595 which has a total chip limit of 70mA, so that's even tighter. I see many abuses of that in '595 circuits driving LEDs directly that I find on the web.

    • @RalphBacon
      @RalphBacon  2 года назад +2

      You are, of course, quite correct 👍 that we must observe _total chip_ current capacity, not just the individual GPIO limit; it would be very easy to overload the chip otherwise.
      Often we use "20mA per GPIO pin" rule, but the actual maximum is 40mA. Once again it's important to see what the current for the pins _in the same port_ are, as well as the ATMega328P, otherwise things could get very toasty!
      I've noticed that the 74HC595 is often "abused" in the way you describe. In my (future) design I'm using about 5mA per leg, which is REALLY bright on the new LEDs I'm using and well within the overall limit. I'll try and remember to emphasise this when I get to doing that video. Burning out one LED is no big deal; burning out a segment on a 7-seg LED is disastrous. 😲

    • @Enigma758
      @Enigma758 2 года назад +1

      @@RalphBacon 👍👍👍

  • @mikescott58
    @mikescott58 2 года назад

    Great idea to use a single GPIO pin to multiplex two displays. I have one suggestion which is a slight software tweak. Based on your description, you change the segment outputs just before switching digits. This will briefly send one display's data to the other one which could cause unlit segments to light dimly creating a "ghosting" effect.
    My suggestion is to first turn off all segments, switch digits, then output the digits for that display.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Cool idea! I guess it is always worth experimenting which way works best. BTW as you saw, I didn't get any ghosting (much to my surprise) but other devices may not be so forgiving!

  • @adrianrubio5396
    @adrianrubio5396 2 года назад

    Always appreciate a way to save one more GPIO. ;-)

  • @U8uxa8SP
    @U8uxa8SP 2 года назад +1

    Thanks for the information. I'm sure that it will prove helpful in a project.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      I hope so! One day you will remember this technique but with no idea who told you it or where you can now find the information. Oh well.

  • @gregwmanning
    @gregwmanning 2 года назад

    Very Clever, All the best Ralph

  • @markfox6741
    @markfox6741 2 года назад

    Superb 'lean' method of creating a system. Very nice.

  • @romancharak3675
    @romancharak3675 2 года назад +1

    ✔✔ I always enjoy your videos, Ralph !

    • @RalphBacon
      @RalphBacon  2 года назад

      Nice of you to say, Roman.

  • @blutlust_yt5557
    @blutlust_yt5557 5 месяцев назад +1

    Very competent person

    • @RalphBacon
      @RalphBacon  5 месяцев назад

      Some may disagree with you but thank you for your commendation!

  • @BersekViking
    @BersekViking 2 года назад +2

    Nice but... While the N-channel will switch fulll on. The P-channel has S connected via the LED , and will have a voltage drop because of the G-S voltage (a few volts) needed to turn it on. It looks to me that one digit is slightly dimmer then the other.
    Try using 2 N-channel, using the first as a driver and an inverter. Connect the second G to the D on the first. A resistor on D to 5 volt on the first one may be needed.

    • @RalphBacon
      @RalphBacon  2 года назад

      Hmm, it's running here and I don't see a difference in brightness between the two digits, I must admit.
      Of course, a "1" will look brighter than an "8" for the reasons I state in the video (the current is being shared between segments).
      What I do see is an error in the circuit diagram in the GitHub: I've omitted the series resistor on both legs (180Ω), oops. But these could be tweaked to get the brightness equal, too.
      I'll see about replacing that circuit diagram.

  • @OsoPolarClone
    @OsoPolarClone 2 года назад +1

    Very useful information. Thanks

  • @colindevaux4476
    @colindevaux4476 2 года назад +1

    thanks Ralph
    great as always :)

  • @byronwatkins2565
    @byronwatkins2565 2 года назад

    The 74HC595 can extend this to many digits. The segment states can be shifted out SPI and latched. One N-channel FET for each digit simultaneously grounds the common cathodes for one digit and enables the 74HC595 output for that digit. One port bit for each digit can activate the FETs or a ring counter can save these port I/Os for a truly long display. Using paired digits like those illustrated, one bit and its inverse can alternate between the two independently of all other pairs.

    • @RalphBacon
      @RalphBacon  2 года назад

      Yes, it seems that there are many, many ways to achieve this and your suggestions are good. I'm going to see whether a cheap μC is a simple and flexible way of doing this too (eg Tiny167)!

  • @anokhautomation4453
    @anokhautomation4453 2 года назад

    Very very useful idea 👍💡. thanks for sharing 🙏

  • @fredflintstone1
    @fredflintstone1 2 года назад

    Nice video ralph, and a nice explaination 🙂

  • @DafyddRoche
    @DafyddRoche 2 года назад

    Hi Ralph. I’m a lurker. I work in semiconductors by day, but I often find I learn more tricks by watching channels like yours!
    I was thinking of ways you could drive the 8 anodes. Do you think you could use a 4017 Johnson counter, to sequentially step through each anode, then an additional n channel BJT under your p/n digit mux to tell the circuits when to light the LED’s?
    You’d then be using 4 gpio’s total. 2 for the Johnson counter, 1 for the digit selector and 1 as a “this led on or skip”.
    You might also be able to skip the “this led on” gpio if you change the clock time on the counter, quickly toggling the clock line to skip an led you don’t want to show?
    Anyway - would love to hear your thoughts. Thanks again for a great channel.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Lurk away, Dafydd, although I have spotted you a couple of times, I'm sure!
      Your suggestion is a good one but has been suggested somewhere else in these comments. I'm pretty sure the logic is sound. Actually, I think someone commented that they had actually _done_ this already.
      Yes, we are all singing off the same hymn sheet.

    • @beatadalhagen
      @beatadalhagen 2 года назад

      I have done pretty much the same when putting together a model with many small glow-in-the-dark parts. Thankfully those have persistence in the order of 10s of seconds. One 4017 clocking a second 4017 and lighting all the (UV) LEDs in a matrix. The Glowing Round Things strike terror in the hearts of children hiding behind the sofa. 'eee...eeeee..eeeeeggggg.......eeeeggggggg...." Are you saying those things are eggs? Are they your eggs? "EEeeeeeeeeggggggg!" *pauses* "Eegg sternum eight" ... You want eight eggs? Where? ... "Eggsternumeight!" Ack, gotta run real fast. *br-zap*

  • @stevegelnett4469
    @stevegelnett4469 2 года назад

    Clever idea, man. I like it.

  • @TheDefpom
    @TheDefpom 2 года назад

    @11:40 it is best to use one resistor per segment otherwise if you just use one per digit the digit brightness will vary depending upon the number of segments that are on.

    • @jyvben1520
      @jyvben1520 2 года назад

      i saw that, 1 is brighter than 8

    • @RalphBacon
      @RalphBacon  2 года назад

      Hmm. I'm guessing you wrote this before watching more of the video! 🤦

    • @Enigma758
      @Enigma758 2 года назад

      But at 220 ohms per segment will result in significant current draw when all segments are lit and you won't be able to do much else with your uC since you'll use up most of the max allowable current draw.

  • @TheUnofficialMaker
    @TheUnofficialMaker 2 года назад

    I'D LOVE to see your take on the Back to the Future Time Clock!

    • @RalphBacon
      @RalphBacon  2 года назад

      Something tells me they didn't use multiplexing!

  • @guidovlaere
    @guidovlaere 2 года назад +1

    Thanks for your great tutorials!

  • @intrepidca80
    @intrepidca80 2 года назад

    You could compensate for the brightness varying depending on the digit being displayed, while still using only a single resistor, by pulse-width modulating the output to compensate for the number of segments displayed in each digit.. so for example 8 would be the dimmest, so you'd compensate with a higher PWM value, and 1 would be the brightest, so you'd compensate by using a lower PWM value.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      I could even just display the 8 for a bit longer (or the 1 for a shorter) period to make it seem brighter. Currently all digits displayed for an arbitrary 10mS so could easily be programmed.

    • @intrepidca80
      @intrepidca80 2 года назад

      @@RalphBacon Yes, that would work too :). You'd just want to ensure you're still alternating between the digits at a consistent rate. For example, say you only light up an 1 for 5ms instead of 10ms... that doesn't mean you can move on to the other digit after those 5ms. You'd need to have all LEDs off to fill in the remaining 5ms. Otherwise I think you'd end up with a situation where what number you display on one of the digits affects the brightness of *both* digits, since you'd be affecting the total cycle time.

  • @kentswanson2807
    @kentswanson2807 2 года назад +1

    A demultiplexer ic and maybe a small capacitor on led segment(to reduce flicker) and you could rule the world with a single pin.

    • @kentswanson2807
      @kentswanson2807 2 года назад

      Well a few pins,s

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Yes, a minimum of three pins it would seem. Better to use I2C which only uses two. But the chip will probably cost more.

  • @pfeerick
    @pfeerick 2 года назад

    I made some ESP8266 powered clocks as I was fed up with setting time when it drifted or power went out - these set themselves. Uses 4 max#### based 8x8 led matrix, controls over SPI IIRC. Used red electrical tap to act as a diffuser, still working great some 2-3years later :) I can see this being handy if it could be made to work over serial or I2C... Just pop the module on and it gives the error code.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Sounds a good idea. BTW instead of red tape (which I'm sure works just fine) I use red acrylic sheet, the sort that am-dram societies use on their stage lights. You'll see it in action in a future MAX7219 project - hey you just mentioned those, small world!!!

  • @philowen2755
    @philowen2755 Год назад +1

    Nice one Ralph. Needless to say, I viewed them in the wrong order.🙄

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

      Not to worry, at least you have now watched both!

  • @paulodagraca3469
    @paulodagraca3469 2 года назад +2

    What could be a next step? Maybe 2x 8bit shift register with resistor arrays, to bring pin count down. That would however bring the component (cost) up. Lets stick with this. Great MosFET tip, just uses 1 pin 😊

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Possibly! There are many ways to do this, Paulo. When the PCBs arrive we'll build the 74HC595 shift register method you mentioned. Got to keep it cheap!

  • @099bmac
    @099bmac 2 года назад +1

    Ralph thank you for the helpful , well produced videos. Would you please tell me what model of bread board you are using in this video? Thank you, BMac

    • @RalphBacon
      @RalphBacon  2 года назад +2

      The breadboard is a UK-sourced one, not cheap (the price has risen dramatically recently) the AD-11:
      coolcomponents.co.uk/products/ad-11-advanced-solderless-breadboard
      I now have 5 of these boards as I kept running out!

    • @099bmac
      @099bmac 2 года назад

      @@RalphBacon Thank you Sir.

  • @TheEmbeddedHobbyist
    @TheEmbeddedHobbyist 2 года назад +1

    The problem with the P-channel, just having a quick look at it.
    Turned off state.
    VS = 5V
    VD = 0V
    VGS = 5-5 = 0.
    Now turn it on by pulling the gate to 0V.
    VS = 5V
    VD = 0V
    VGS = -5V
    So fet turn on.
    But Now it's on VS=VD + a very small bit VDS on.
    So what is the gate voltage VGS its now 0V and VS is almost 0V so it will turn off.
    I expect that it will oscilate in this state. Unless you can take the gate below ground.
    This is the same as why you can't use a N-Channel as a high side switch without providing a voltage VGths above the VCC, with a diode charge pump. When it switchs on VS + VD So VGS has to be more positive to hold it on.

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Yes, I was a little concerned I might have to bias them (well, connect the gate of each to GND/VCC which would then involve diodes, getting messy) but it worked very well.

    • @TheEmbeddedHobbyist
      @TheEmbeddedHobbyist 2 года назад

      @@RalphBacon The problem is when using a P-channelas a low side switch, the gate has to go lower than the source by VGS(th) if your drain is connected to 0V then you need a negative voltage to pull the gate down to. as the source will become the same voltage as the drain e.g 0V once turned on. Put a meter set to AC volts across the source and drain, this may show if the fet is osc back and forth between on and off. A scope would be better as it may well be faster than the meter can detect. There is a chance that it looks to the eye that its working as expected can't say without looking at it. anyway thanks for the gray cell workout.
      As a side note i'd use one resistor in the common connection and just drive one segment at a time. the eye still wont notice of you do it fast enough and save a lot of current.

  • @saturdayscience5540
    @saturdayscience5540 2 года назад

    I should have paid more attention; I thought you had some magic to control a 2 digit 7 segment LED with one GPIO. Oh but you said saving one GPIO. 🤣

    • @RalphBacon
      @RalphBacon  2 года назад

      And for my next trick... 🪄🎩

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

      Well _actually_ , at about 9 seconds in Ralph said "... and we're controlling that *using one GPIO pin* ", and again at 20 seconds "... each digit is itself only *controlled by using one line* , not two". I also found it extremely confusing, so I don't think it's your attention that's the problem, I think it's Ralph's!

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

      😭😭😭

  • @peoplethesedaysberetarded
    @peoplethesedaysberetarded 2 года назад

    This shimmer effect looks like a combination of multiplexing, which you mentioned, and rolling-shutter effect.

    • @RalphBacon
      @RalphBacon  2 года назад

      You can't see the effect with the naked eye, so it is the _interaction_ of the camera (shutter) and multiplexing, for sure.

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

    That was very interesting. Thanks for sharing.

  • @jensschroder8214
    @jensschroder8214 2 года назад

    I would have taken a CD4049, CD4069 or 74HC04 inverter. These ICs can drive enough current for LEDs.
    Your solution is good for two digit displays. Only 8 IO pins

    • @RalphBacon
      @RalphBacon  2 года назад

      Yup, I would not drive a 7-seg display directly from an UNO, as it used too many valuable IO pins. Your suggestion is a good one 👍

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

    Another brilliant video.

    • @RalphBacon
      @RalphBacon  Год назад +1

      You are too kind, Jonathan. But don't let me stop you 😆😁😜

  • @stephenbarlin2314
    @stephenbarlin2314 2 года назад

    Useful information

  • @BigA1
    @BigA1 Год назад +1

    Could the MOSFETS be replaced by NPN and PNP bipolar transistors? I realise different values of driving resistors would be required.

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

      Yes, of course, that's how it was always done "in the old days". Just be aware that BJTs do not have such a low forward resistance so could get warm (hot even) depending on the current flow.

  • @thisoldjeepcj5
    @thisoldjeepcj5 2 года назад

    Always like your videos.

  • @chrismailloux5428
    @chrismailloux5428 2 года назад

    Great vid!

    • @RalphBacon
      @RalphBacon  2 года назад

      Thanks, Chris! Great to see you here 👍

  •  2 года назад

    An unrelated question to the video: I remember an episode about the outdoor bins power management; something about using the dual MOSFET package and switch to turn on the MCU to send a signal and turn itself off. I watch all videos but I can't seem to be able to find it. I want to make a cat door opening/closing counter so we can know when cat is outside. I'm thinking about using a reed switch and if that triggers send an mqtt message to my homeassistant server so I can log the openings.

    • @RalphBacon
      @RalphBacon  2 года назад

      Yes, that would work although you have to be very careful about the current through a reed switch - they are designed for signals so a 5v signal at some very, very low current should be fine to trigger the auto on/off project (which I'm using every day in my outdoor bins, just as you say).
      There are some variations in the design, depending on what you want to do, so here are some links:
      Video #123 ruclips.net/video/g1rbIG2BO0U/видео.html
      Video #172 ruclips.net/video/6OH_ZiD2xoI/видео.html
      Video #173 (uses ATTiny85) ruclips.net/video/S2y1oAVmxdA/видео.html
      There are probably others (I use that circuit quite a lot) but these should get you going. If you need information that is not in the GitHub for those videos do let me know. I reckon the circuit diagram in #173 (see GitHub) without the additional circuitry is what you will need.

  • @marceloa.1597
    @marceloa.1597 Год назад

    This was a great vid, thanks!

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

      Glad you enjoyed it, Marcelo!

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

    Certainly, you get a prize... my like and comment!

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

      Sounds like a great deal, thank you!

  • @isoguy.
    @isoguy. 2 года назад +1

    Cool

  • @erniberni8507
    @erniberni8507 2 года назад

    Very nice

  • @gazzacroy
    @gazzacroy 2 года назад

    NICE ONE FELLA :)

  • @alfonsneumann1878
    @alfonsneumann1878 2 года назад

    Hey Ralph, your clip caught my attention but I couldn't find this dual 7-segment display on aliexpress. Neither your link worked nor the search for them directly on ali gave me any result. What am I doing wrong?

    • @RalphBacon
      @RalphBacon  2 года назад

      I just clicked on the link in my GitHub (this one: s.click.aliexpress.com/e/_DBvpDQL ) and it worked like a dream.
      Just in case I got another link for the same product: s.click.aliexpress.com/e/_DCHJEaj
      Have a go and let me know!

  • @jp040759
    @jp040759 2 года назад +2

    U asked for a comment so here it is.

    • @RalphBacon
      @RalphBacon  2 года назад +2

      And most welcome it is, thank you. 🎊🎉💃🥳

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

    Great Video! Thx a lot! :)

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

    Ralph, Can I send you a load of stuff? I'm getting too old to continue this passion, and I have soo much stuff to give away!!

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

      If you email me what you have I will have to "cherry pick" because I have so much stuff too. 😲 I discarded some older stuff in the summer as I cleared out my storage bins!

    • @johnstephenson2891
      @johnstephenson2891 Год назад +1

      @@RalphBacon I hope a load of pictures will work for you?

  • @steverileyretired
    @steverileyretired 2 года назад

    Very Intresting

  • @hopje01
    @hopje01 2 года назад

    What to do if you have 10 displays multiplexed. The leds light up only 1/10 of the time and get dim. Is it allowed to overdrive the led current by lowering the resistors 10 fold?

    • @RalphBacon
      @RalphBacon  2 года назад +1

      It doesn't dim as much as you might think, Eddy.
      Consider that a bedside clock with four digits (sometimes six) is still plenty bright enough to read in daylight. We can ensure that the full 20mA (or whatever the spec sheet states) can flow down each segment (with the correct resistor in series with _each_ segment LED) with an overall brightness control in the common cathode (PWM, probably) for daytime / night-time use.
      We could also consider multiplexing half the LEDs separately; in your example, 5 in one 'block'. So they get 1/5th of the time, not 1/10th of the time. Plenty!
      I certainly would not advise _overdriving_ any LED. It might survive for a while but you would be using it outside of its manufacturer's stated parameters - lifespan will definitely be short(er)!

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

    I’ve added a comment ‘cause you asked so nice 👍

  • @apollorobb
    @apollorobb 2 года назад

    IBM did this long ago so we'll move you to 2nd to do it

    • @RalphBacon
      @RalphBacon  2 года назад

      They stole my idea. I've been robbed 😡

  • @HelmutFischer-thehefi
    @HelmutFischer-thehefi 2 года назад

    The link to GitHub is not working.

    • @RalphBacon
      @RalphBacon  2 года назад

      Thanks for letting me know, working now! 🙄

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

    Do you have a video about effective/smart way to multiplex 7segments display AND input buttons? 4 displays and 4 buttons let's say with minimal wires and cheap discrete components?

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

      I think the 7-seg LEDs are covered here and to multiplex 4 buttons you just need to use a matrix - have a look at the wiring for the 10-button keypad you can get just about everywhere.
      That said, multiplexing is more effective with more buttons, because for 4-button you still need 4 wires - might as well use 4 standard GPIO pins.

  • @twotool
    @twotool 2 года назад

    Nice Video :)

  • @justinklino7487
    @justinklino7487 2 года назад

    What is the arduino code for this thing?

    • @RalphBacon
      @RalphBacon  2 года назад +1

      The code for this video (like all my videos) is in the GitHub; the link for _that_ is in the video description. Now even I am confused.

  • @yogeshitaliya473
    @yogeshitaliya473 2 года назад

    😍😍😍😍😍😍😍😍

    • @RalphBacon
      @RalphBacon  2 года назад +1

      Always first to the party, Yogesh 🎉🎊🥳

  • @BerndFelsche
    @BerndFelsche 2 года назад

    Multiplex at a higher frequency and do it per segment and you can do it with one resistor ...

    • @RalphBacon
      @RalphBacon  2 года назад

      Would the overall (perceived) brightness not be lower (as each segment would only be on for an eighth of the time that they are on now)?

  • @pointBreak64
    @pointBreak64 5 месяцев назад

    My data gets copied on both displays even if i switch one of them on once at a time...

    • @RalphBacon
      @RalphBacon  5 месяцев назад +1

      Make sure you have correctly given the number of display elements to the program (one element is the complete 7-seg display). So if you have 4 digits, you supply 4 in the sketch. And so on.

    • @pointBreak64
      @pointBreak64 5 месяцев назад

      @@RalphBacon Yes

  • @mikelopez9893
    @mikelopez9893 2 года назад +1

    Sorry, Ralph, but multiplexing IO and using visual persistence has been done too many times for you to claim it as a first. :(
    Having said that though, I think running through some classic circuits would be a good match for your channel. Perhaps start with the 555 and then go through some of Don Lancaster's TTL work from the 1970s? I think your viewers would like it.

    • @RalphBacon
      @RalphBacon  2 года назад

      😁No, Mike, I'm not claiming _multiplexing_ as a first, but in using a SINGLE GPIO pin to control 2 digits by virtue of the N/P channel MOSFET. I can find no-one doing this, always one transistor : one control line, per digit.
      GPIO pins are a scarce commodity so reducing the number in displaying info via LEDs has got to be good, right?

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

    is you have complicated program running you may have to do that display multiplexing from timer interrupt to get even power distribution between segments.
    It seems this answered wondering of that debug display video if there was current limiting resistor.

    • @RalphBacon
      @RalphBacon  Год назад +1

      I don't multiplex the _segments_ just the _digits_ (ie all 8 diodes in that digit).

  • @rorymacleod8488
    @rorymacleod8488 2 года назад +1

    .

    • @RalphBacon
      @RalphBacon  2 года назад +1

      You get the prize for the shortest, allowable comment in the history of YT comments. But I'm not complaining, it all counts, Rory!

  • @hansdegroot652
    @hansdegroot652 2 года назад +1

    Blink comment /blink

    • @RalphBacon
      @RalphBacon  2 года назад +2

      Nice comment. I like it. Let's hope YT does too! 👍

    • @hansdegroot652
      @hansdegroot652 2 года назад

      @@RalphBacon i forgot to add font color=pink size=23 some media used to like that a lot back in the days

  • @jcxtra
    @jcxtra 2 года назад

    Since you asked so nicely :p I like the idea, if you just need to save one GPIO pin, although I also like using the uhh PCF84XX something. It's the same chip used on those 16x2 or 20x4 LCD backpacks, gives you 8 pins over I₂C, and you can use multiple. There's probably even better ways than that :) Hope life is going okay for you friend x

    • @RalphBacon
      @RalphBacon  2 года назад

      Yes, I indeed, I mentioned those "backpacks" somewhere (in another comment I guess) which are great because they are controlled by only two I2C wires.
      Life is going just fine for me right now, thanks for asking. I hope the same is true for you. Of course, what with Queen passing, it's been quite surreal.