### Author Topic: Amusing 5 pin 7 segment LED display  (Read 1507 times)

0 Members and 4 Guests are viewing this topic.

#### Renate

• Super Contributor
• Posts: 1346
• Country:
##### Amusing 5 pin 7 segment LED display
« on: August 28, 2019, 09:17:22 pm »
My apologies if this is old hat, but I've never run into it before...

Everybody knows those 4 digit 7 segment displays.
They have 4 common pins and 7 (+1 for the decimal point) segment pins.
Everything is arranged electrically in a little rectangle, 4 x 8 = 32 lightable thingies.

I found a trashed USB power bank on the highway.
It had a cute little 2.5 digit (188) LED display on it.
I thought that I'd salvage it.
I was amazed to see that it connected on only 5 pins.

If it were 2 rows and 3 columns, that would be 6 lightable thingies.

What they are doing is connecting between every pin and every other pin an LED.
Ok, but that would be 5 * 4, (then divided by 2 since polarity does matter) = 10 lightable thingies.
But! They have LEDs going in both directions between all the pins, 5 * 4 = 20 lightable thingies.
Since this is a 2.5 digit (without decimal points) we only need 16 lightable thingies.

So what we have is actually a square matrix (with the row drivers and the column drivers being the same).
It has a dimension of 5 * 5 (minus of course the 5 where the row and column is the same, i.e. the diagonal) = 20 active crosspoints.
Since we are only using 16 crosspoints, we could use the remaining 4 as pushbutton inputs (with an isolating diode).

Since we're driving LEDs and they need a resistor and there's no division between rows and columns, each of the 5 leads gets a resistor, 1/2 of the value we'd want.

The advantage to all this is that you only need 5 pins out of your uP.
The disadvantage is you have to do wacky bit bopping to determine the right segment.

Since builtin pullups on uPs are easy, I have the multiplexing work by grounding 1 of the 5 pins and either Hi-Z or VSS on the other pins.
Without reading any extra pushbuttons, a 4 phase refresh will do.
With pushbuttons you need 5 phases.
Of course, you could make this 16 (or 17) phase to make sure that the drop across the resistors is absolutely uniform.
« Last Edit: August 28, 2019, 09:31:21 pm by Renate »

The following users thanked this post: Mr. Scram

#### Nusa

• Super Contributor
• Posts: 2193
• Country:
##### Re: Amusing 5 pin 7 segment LED display
« Reply #1 on: August 28, 2019, 09:43:17 pm »

The following users thanked this post: Mr. Scram, Renate

#### mikerj

• Super Contributor
• Posts: 2840
• Country:
##### Re: Amusing 5 pin 7 segment LED display
« Reply #2 on: August 28, 2019, 09:45:16 pm »
This is a technique called Charlieplexing which has been around for quite a long time.  I've not seen a multi digit seven segment display package specifically manufactured to use this method though, so it's an interesting find.

#### Renate

• Super Contributor
• Posts: 1346
• Country:
##### Re: Amusing 5 pin 7 segment LED display
« Reply #3 on: August 29, 2019, 07:28:35 pm »
Ok, well, Charlieplexing.
I'm not really impressed.

To do this properly with LEDs you need either to use a phase per LED or use a special driver that can do all 3 for each pin.
1) A hard drive (unlimited current)
2) Hi-Z
3) Current limited drive.

So, for 64 LEDs we need 9 lines with Charlieplexing.
For a standard matrix we'd need 16! OMG!
But the 8 columns drives aren't real data, it's actually 3 bits of actual information.
So, we'd need 11 lines out of the processor (and a 3-8 driver).
So for saving 2 lines out of the processor we're going to jump through all these hoops?
Ever try debugging a Charlieplex?
Ever see the two LED paths dimly glowing because of leakage?

It's cute, but engineering isn't always about cute.

#### Nusa

• Super Contributor
• Posts: 2193
• Country:
##### Re: Amusing 5 pin 7 segment LED display
« Reply #4 on: August 29, 2019, 08:02:46 pm »
You asked how it was done. Didn't say it was recommended in the general case. When you have a large number of segments, you're better off with a dedicated LED driver in most cases, rather than trying to find enough controller pins.

#### james_s

• Super Contributor
• Posts: 16935
• Country:
##### Re: Amusing 5 pin 7 segment LED display
« Reply #5 on: August 29, 2019, 09:19:06 pm »
IIRC many of the Dallas/Maxim dedicated LED driver ICs use Charlieplexing.

#### mikerj

• Super Contributor
• Posts: 2840
• Country:
##### Re: Amusing 5 pin 7 segment LED display
« Reply #6 on: August 30, 2019, 01:55:38 pm »
Ok, well, Charlieplexing.
I'm not really impressed.

So, for 64 LEDs we need 9 lines with Charlieplexing.
For a standard matrix we'd need 16! OMG!
But the 8 columns drives aren't real data, it's actually 3 bits of actual information.
So, we'd need 11 lines out of the processor (and a 3-8 driver).
So for saving 2 lines out of the processor we're going to jump through all these hoops?
Ever try debugging a Charlieplex?
Ever see the two LED paths dimly glowing because of leakage?

It's cute, but engineering isn't always about cute.

Except you have a 2.5 digit display using just 5 pins, meaning it cold be driven from an 8 pin micro.  A conventional multiplex would need seven segment pins and 3 digit pins, double the number of pins.

#### Renate

• Super Contributor
• Posts: 1346
• Country:
##### Re: Amusing 5 pin 7 segment LED display
« Reply #7 on: August 30, 2019, 04:52:08 pm »
Except you have a 2.5 digit display using just 5 pins, meaning it could be driven from an 8 pin micro.
Well, yeah, that was why I demonstrated it with an ATtiny85, which only has 5 data pins (if you don't muck with PB5, the reset pin).

#### BravoV

• Super Contributor
• Posts: 7336
• Country:
• +++ ATH1
##### Re: Amusing 5 pin 7 segment LED display
« Reply #8 on: August 30, 2019, 05:27:24 pm »
Just google for MAX7219 , driving 8 digits 7 segments leds with only 4 wires.

Smf