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.
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!
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!
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.
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!
@@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...)
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! 😉
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.
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!
@@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
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...
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).
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. 😲
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.
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!)
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.
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!)
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!
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. 👍
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.
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.
@@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.
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. 🙂
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 CZcams!.
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.
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.
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.
@@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!!
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.
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!
@@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.
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. 😲
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.
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.
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.
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.
@@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.
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
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.
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)!
@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.
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.
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.
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!
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.
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.
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*
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.
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.
@@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.
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
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!
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.
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!!!
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 😊
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!
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.
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!
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
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.
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 czcams.com/video/g1rbIG2BO0U/video.html Video #172 czcams.com/video/6OH_ZiD2xoI/video.html Video #173 (uses ATTiny85) czcams.com/video/S2y1oAVmxdA/video.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.
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?
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.
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?
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!
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?
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)!
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!
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.
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.
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.
😁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?
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
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.
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.
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!
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!
Bacon drippings, Gord? Quite frankly that doesn't sound too appealing but I get the meaning. 🌭🥓🍳
@@RalphBacon it's a compliment to your sharing of very helpful and insightful knowledge. Thanks again!
The dual, complimentary mosfet is a great idea!
I think so too! Thanks MrAIFuture!
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.
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!
@@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...)
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! 😉
Can we share the royalties too, Simon, I'm a bit skint this month, what with the electricity and gas prices in the UK...
@@RalphBacon Yes, let's do that. This time next year, Rodders, we'll be millionaires! 😁
The use of the MOSFETs is clever
and the use of a 74XX chip to drive the LED may reduce the use of GPIO and programming
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!
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.
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!
@@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
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.
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...
@@RalphBacon I never noticed. Thank you sir
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).
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. 😲
@@RalphBacon Thanks for responding. All the best Ralph!
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.
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!)
Shows how technology has moved in since the 70’s
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.
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!)
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!
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. 👍
Very insightful and well explained. Thank you ... 🇬🇧
You are very welcome! Nice to see you here 😉
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.
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.
@@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.
Everything is better when wrapped in BACON!!!! Thanks for sharing.
Nice of you to say, thanks for commenting and visiting 🥓
Thanks, Ralph for a clean demonstration. Very nice!
My pleasure!
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. 🙂
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. 😟
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 CZcams!.
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.
@@RalphBacon I bought some 1/8” ruby-red plexiglas (poly carbonate) and two layers does well in bright light ☀️
Yet another interesting circuit design and demonstration thanks, Ralph.
Many thanks!
Awesome info, Ralph! Thank you!
Glad it was helpful!
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.
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.
@@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!!
Good stuff Ralph, thanks
No problemo, thanks for visiting.
Great idea Ralph, thank you.
Thanks for visiting, Jonathan 👍
Good to see you back!!
Nice to be here, thanks!
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.
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!
@@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.
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. 😲
@@RalphBacon 👍👍👍
Another well done video. Keep up the good work!
Thanks for the visit!
Very very useful tutorial 👍 thanks for your detailed explanation 🙏
My pleasure 😊
Very Clever, All the best Ralph
Cheers, Gr eg!
Always appreciate a way to save one more GPIO. ;-)
True that!
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.
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.
Very competent person
Some may disagree with you but thank you for your commendation!
Superb 'lean' method of creating a system. Very nice.
Thank you! Cheers!
Thanks for the information. I'm sure that it will prove helpful in a project.
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.
Very useful information. Thanks
Glad it was helpful!
✔✔ I always enjoy your videos, Ralph !
Nice of you to say, Roman.
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.
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.
@@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.
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
Large projects like that take a long time but I'm sure something will come up sooner or later!
thanks Ralph
great as always :)
Most welcome, Colin!
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.
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)!
Clever idea, man. I like it.
Thank you! Cheers!
@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.
i saw that, 1 is brighter than 8
Hmm. I'm guessing you wrote this before watching more of the video! 🤦
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.
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.
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!
Nice video ralph, and a nice explaination 🙂
Glad you liked it!
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.
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.
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*
A demultiplexer ic and maybe a small capacitor on led segment(to reduce flicker) and you could rule the world with a single pin.
Well a few pins,s
Yes, a minimum of three pins it would seem. Better to use I2C which only uses two. But the chip will probably cost more.
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.
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.
@@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.
Very very useful idea 👍💡. thanks for sharing 🙏
Most welcome 😊
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
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!
@@RalphBacon Thank you Sir.
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.
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!!!
I'D LOVE to see your take on the Back to the Future Time Clock!
Something tells me they didn't use multiplexing!
Thanks for your great tutorials!
Glad you like them!
Nice one Ralph. Needless to say, I viewed them in the wrong order.🙄
Not to worry, at least you have now watched both!
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 😊
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!
This shimmer effect looks like a combination of multiplexing, which you mentioned, and rolling-shutter effect.
You can't see the effect with the naked eye, so it is the _interaction_ of the camera (shutter) and multiplexing, for sure.
Useful information
Glad you think so!
Could the MOSFETS be replaced by NPN and PNP bipolar transistors? I realise different values of driving resistors would be required.
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.
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. 🤣
And for my next trick... 🪄🎩
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!
😭😭😭
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
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 👍
Great vid!
Thanks, Chris! Great to see you here 👍
That was very interesting. Thanks for sharing.
Glad you enjoyed it
Always like your videos.
I appreciate that!
Certainly, you get a prize... my like and comment!
Sounds like a great deal, thank you!
Very nice
Thanks!
Another brilliant video.
You are too kind, Jonathan. But don't let me stop you 😆😁😜
Cool
Cheers, ISO Guy!
This was a great vid, thanks!
Glad you enjoyed it, Marcelo!
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.
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 czcams.com/video/g1rbIG2BO0U/video.html
Video #172 czcams.com/video/6OH_ZiD2xoI/video.html
Video #173 (uses ATTiny85) czcams.com/video/S2y1oAVmxdA/video.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.
NICE ONE FELLA :)
Thanks for the visit!
Very Intresting
Thanks, Steve!
I’ve added a comment ‘cause you asked so nice 👍
Thanks for that!
Great Video! Thx a lot! :)
Glad you liked it!
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?
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.
U asked for a comment so here it is.
And most welcome it is, thank you. 🎊🎉💃🥳
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?
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!
IBM did this long ago so we'll move you to 2nd to do it
They stole my idea. I've been robbed 😡
Nice Video :)
Thanks for the visit!
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?
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)!
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!!
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!
@@RalphBacon I hope a load of pictures will work for you?
The link to GitHub is not working.
Thanks for letting me know, working now! 🙄
😍😍😍😍😍😍😍😍
Always first to the party, Yogesh 🎉🎊🥳
What is the arduino code for this thing?
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.
Multiplex at a higher frequency and do it per segment and you can do it with one resistor ...
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)?
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.
I don't multiplex the _segments_ just the _digits_ (ie all 8 diodes in that digit).
My data gets copied on both displays even if i switch one of them on once at a time...
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.
@@RalphBacon Yes
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.
😁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?
.
You get the prize for the shortest, allowable comment in the history of YT comments. But I'm not complaining, it all counts, Rory!
Blink comment /blink
Nice comment. I like it. Let's hope YT does too! 👍
@@RalphBacon i forgot to add font color=pink size=23 some media used to like that a lot back in the days
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
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.