Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Charlieplex (N²) ?

Chipwizard

New Member
I have been looking at Charlieplexed designs in details in the past 2 weeks. Most successful designers elected to use the internal toggling of the input/output in the programming of the microcontroller to address "High-Z" portion of Tri-state of a charlieplex. I also noticed most complained about the brightness of the LED's since the duty cycle was low (100/N) with no way of adjusting the current feed in rows and columns above 25mA per limitation of individual input/output of microcontroller!

I Posed the following questions to get me started:
Can the logic "High Z" be addressed digitally outside the controller?
Can the number of wires to the LED matrix still be kept at minimum?
Can the brightness be increased to compensate for duty cycle?
Is the maximum output bits of a Charlieplex really limited to N(N-1)?

I would like to get some constructive inputs as I might be on to something.

Regards,
Rom
 
Last edited:
I will only answer the 1st question because the other two seem dependent on it and what you are doing.

The HighZ state of a bit in a PORT is controlled by the bits in the TRIS SFR corresponding to that port. Anything outside the controller will have to communicate with the program to have it change the TRIS register.
 
Hi Brian (3v0)
Thank you for your comment. My point was to relieve the controller completely from addressing the 3rd state and function normally as a controller would do.
Instead use the output ports of the controller to do some of the work in driving other devices such as a latch. Without compromising the duty cycle have the controller send out two commands for LEDs instead of one. First command to latch identifying the row and lock it in (Sink, -LED). Then second command tell the colum to Drive it (+LED).

I am thinking "N" latches would act as one-in, lock-out the rest (Buffer out, or High Z). I am working on one possible diagram.
 
Last edited:
Although I have not found the perfect latch consider: MC10H175 Quint Latch, 5 D-FlipFlops (N=5), clock, reset.
Characteristics: Clock low loads the input, clock high latches (locks out all inputs to previous state), clock high + reset high will reset all the latches.
 

Attachments

This is the elephant in the room.

If you are going to involve another chip simply use a 74xx585. You only need 3 pins and you get 8 outputs. Even better you can attach additional 595's with no additional pins. And you get 100% duty cycle.

There are also port expanders and other options.

Charlieplexing is limited.
 
If you draw a charlieplexed matrix in a more conventional column and row format and study the signal paths you may realize you can use column driver transistors to light multiple LEDs in a column at one time. This increases the duty cycle (and brightness) on the 20 LED matrix below from 1/20th (5%) to 4/20th (20%).

**broken link removed**

Once you add a driver IC to your design, there's no longer any advantage using Charlieplexing. You might as well use conventional multiplexing for a full brightness display. The same five pins you used for a Charlieplexed matrix of 20 LEDs can be used to drive a conventional matrix of 32 LEDs, or more, to full brightness, with PWM brightness control.

Regards, Mike

macmux-4-digit-7-seg-png.51945

macmux-3-png.49214
 
Last edited:
That "charlieplexed" matrix is quite clever Mike. :) That has to be one of the simplest solutions I've seen for getting 20 bright individually dimmed LEDs from one 8pin PIC.

If I was to suggest one improvement it would be to tie the 5 transistor base pins low with a high value resistor, say 330k. Since the charlieplexing will leave many base pins floating at high impedance the transistors will be likely to turn on from noise.

As for overall multi-LED functionality, brightness etc I agree an external shift register IC with "latch" pin is still king.
 
This is the elephant in the room.

If you are going to involve another chip simply use a 74xx585. You only need 3 pins and you get 8 outputs. Even better you can attach additional 595's with no additional pins. And you get 100% duty cycle.

There are also port expanders and other options.

Charlieplexing is limited.

Wow! I am impressed with the number of gurus responded. To 3V0: Although I agree that charlieplex is not one of the most efficient ways to "multiplex" (Used losely). I need the maximum LED per minimum PIC outputs. Hence 20 LED's with only 5 outputs from 683. The duty cycle of the design I posted is 20%. It is scanning one row at a time and then picks the one LED to be turned on. If you wish to turn all the row on you can to increase to 100% duty. Yes you can use 5 outputs and use a 5 to 32 (combination of) demultiplexer chip. But you only are turning on one LED at a time decreasing the duty cycle to 1/32. Wrong direction.
Regards,
Rom
 
If you draw a charlieplexed matrix in a more conventional column and row format and study the signal paths you may realize you can use column driver transistors to light multiple LEDs in a column at one time. This increases the duty cycle (and brightness) on the 20 LED matrix below from 1/20th (5%) to 4/20th (20%).

Once you add a driver IC to your design, there's no longer any advantage using Charlieplexing. You might as well use conventional multiplexing for a full brightness display. The same five pins you used for a Charlieplexed matrix of 20 LEDs can be used to drive a conventional matrix of 32 LEDs (below) or more to full brightness with PWM brightness control.

Regards, Mike
-------------------------------------------------------
Mike-K8LH
The design I posted was inspired by your diagram you posted a while back. I still can scan one row at a time (20% duty cycle). My diagram looks a lot more complicated than it actually is. It is expansion on your charlieplexing of 5 ports. I added 5 transistor to the rows, 5 resistors to the columns (keeping current in check), and the latch simply aids 683 in crunching the "Z" by blocking out the unwanted "sinking" lines on the rows. Please note adding the chip does not affect the duty cycle. The previous LED remains on until the next LED comes on. The Latching and strobing of the clock is extremely fast that LEDs won't even see it or feel it.

This is the chain of commands coming from PIC: 11111 (Reset Latch), 00000 (Latches ready for data), select anchor row to go high and the rest low (00001, GP0 for example). A split second later because of the built-in propogation delay, the clock is strobed "High" with sum of 1+0+0+0+0 = 1. Now we latched all the data and blocked all inputs. (0,0,0,0,1). Transistor Row1 is on sinking the row to ground ready for column. This remains on until all the latches are "reseted". And second 5 bits from PIC come in. Say we want to turn LED17 on. Pic will push out 10000 to turn column transistor from GP5 on. Hold the bit for as long as you want. LED17 comes on and remains on until instructed otherwise. The next complete set of command will reset the latches, zero them out to receive data and then sets clock high again to latch it. Your on time of the LED is so much larger than time for reset, data, and latch.
Your thoughts....
 
Last edited:
Additionally by adding the extra parts I am able to increase the current per each LED compensating for 20% duty cycle.
Now here is the brain teaser that I was wondering if it would work once I take the bugs out.
Given two step command for lighting the LED thru latch, who is to say I can not use the other 5 combination that was left on the table by typical Charlieplex. I.E: row1+ col1, row2 +col2, row3 + col3, row4 + col4 to turn on an additional 5 LEDs completing Nx(N) instead of Nx(N-1)?
Everyone's thought on that...
 
That "charlieplexed" matrix is quite clever Mike. :) That has to be one of the simplest solutions I've seen for getting 20 bright individually dimmed LEDs from one 8pin PIC.

If I was to suggest one improvement it would be to tie the 5 transistor base pins low with a high value resistor, say 330k. Since the charlieplexing will leave many base pins floating at high impedance the transistors will be likely to turn on from noise.

As for overall multi-LED functionality, brightness etc I agree an external shift register IC with "latch" pin is still king.

Mr RB: I am not sure if you were talking to me or commenting on Mike's (K8LH) design. If you were commenting about my design, the transistors on the columns are driven from PIC's output, so they are not floating. In regards to transistors on the rows, they always will have a value fo zero or 5v from the latch. The latch does not leave them floating but rather locks them in at their value before the clock went high. If the value was zero it remains zero and if it was high, it remains high until reseted...
If the comment was not towards me please disregard this comment...
Regards,
Rom
 
Since it might be a while since I will revisit I thought I put this out there for review:
The design is a morphed charlieplex that acts like a classic multiplex.
One is able to control 20 LED's with only 5 ports of a controller. (Perhaps 25 LED's, NxN)
There is no need for a "High Z" state in the programming or in the hardware.
The blocking of specific bits to reach the LED's is done with the latching the additional chip. The status of unwanted bits are kept at zero and maintained until reset.

I stand corrected on previous comments on duty cycle.
Here are my claims. Please correct me if misspoken:
Any rows or combination of rows can be turned on in one shot (100% duty cycle)
Any columns or combination of columns can be turned on in one shot (100% duty cycle)
Any symetrical square patterns from the center towards 4 corners can be turned on in one shot (100% duty cycle)
Any other scattered combination of LED's on different rows and columns can be turned on in 5 steps max (20% duty cycle minimum). This scans the entire 5x5 matrix.
 
If you are going to use additional circuitry then why not use a chip specifically designed for the job. The MAX7219 is controlled by 3 lines and can handle 64 LEDs with high brightness and full brightness control. Plus, they're cascadable.

Mike.
 
Once you add a driver IC to your design, there's no longer any advantage using Charlieplexing. You might as well use conventional multiplexing for a full brightness display. The same five pins you used for a Charlieplexed matrix of 20 LEDs can be used to drive a conventional matrix of 32 LEDs, or more, to full brightness, with PWM brightness control.

Regards, Mike

Since we are changing the topic of charlieplex to multiplex and shift registers: With all due respect Mike, your concept will only work in your specific application. Since your duty cycle is 25% (1 of 4) your currect is limited to 25/4. It works well with full brightness using those specific 7-sigment LED modules which most likely are using 7-10mA current (or less). If you use conventional LED's which draw 20-25mA the brightness will suffer. I have designed several arrays of shift registers (Latches) using similar layouts. After all that is what the LED moving signs do!

That said if you dedicate one 8 bit latch to one 7-sigment each you do not have a need for additional 4 wires on top, daisy chaining unlimited number of latches (Serial-in, Parallel-out, Serial-out) with all latches only require 3 wires (Data, Clock, Latch). This will also improve your duty cycle to 100%. Also one can string up several lines of latches with each level have a common clock and latch, have the controller parallel input data in each level at the same time and shifting it across the entire array.

Setting all that aside your design is clever, compact, and very efficient for its intended application. My compliments to you sir.


Regards,
Rom
 
Last edited:
Since we all agree Charlieplex is not the best answer to such projects, I will let it be.
Now since I have your attention, the original concept that I was after was to produce a remote LED board that requires minimum number of wires to communicate with outside world.
This project did not answer it.

I am trying to build a very thin (0.25 inches) LED board with 4 wire connects. No onboard chip What is the maximum number of LED's I can address? What concept design do you suggest?

Regards,
Rom
 
Since we are changing the topic of charlieplex to multiplex and shift registers: With all due respect Mike, your concept will only work in your specific application. Since your duty cycle is 25% (1 of 4) your currect is limited to 25/4. It works well with full brightness using those specific 7-sigment LED modules which most likely are using 7-10mA current (or less). If you use conventional LED's which draw 20-25mA the brightness will suffer. I have designed several arrays of shift registers (Latches) using similar layouts. After all that is what the LED moving signs do!
With all due respect wiz', you seem to be a little fuzzy on the concept of "peak" and "average" current in a mux'd display. The design I posted will drive each LED at approximately 80-ma "peak" current, which is about 20-ma "average" current at 25% duty cycle, for full brightness. That TPIC6C595 IC can sink something like 90-ma current on each output.

The method I posted, backed up by several years of experiments and projects, works quite well with almost any type of 20-ma LED, not just 7-segment displays.

That said if you dedicate one 8 bit latch to one 7-segment each you do not have a need for additional 4 wires on top, daisy chaining unlimited number of latches (Serial-in, Parallel-out, Serial-out) with all latches only require 3 wires (Data, Clock, Latch). This will also improve your duty cycle to 100%. Also one can string up several lines of latches with each level have a common clock and latch, have the controller parallel input data in each level at the same time and shifting it across the entire array.
That's what 3v0 suggested, and no argument from me. That's a viable design if you've got the PCB real estate for the extra chips. You can also use Mr RB's variation of an old design trick to drive a chain of 74HC595s, or other serial-to-parallel driver ICs, with just one (1) pin.

Good luck in your studies and experiments.

Cheerful regards, Mike
 
Last edited:
If you are going to use additional circuitry then why not use a chip specifically designed for the job. The MAX7219 is controlled by 3 lines and can handle 64 LEDs with high brightness and full brightness control. Plus, they're cascadable.

That's a nice IC but it's just so big. Have you used it Mike? I have samples but I've never tried it. The few projects I've seen that used it, including one that Futz did, did not seem to be very bright. I seem to recall the data sheet suggested much less "peak" current available than what I would consider is necessary for a full brightness display, but I may be wrong (it's been several years).
 
Last edited:
Hi,

If i remember right the number of LEDs that can be "Charlieplexed" in the usual way mathematically works out to:
nLEDs=P(n,r)
where
r is the number of leads of each LED (2 for each LED), and
n is the number of signal lines, and
P(n,r)=n!/(n-r)!

For example, P(5,2)=20, which means 20 LEDs with two leads each can be driven with 5 output lines.
 
Last edited:
Hi,

If i remember right the number of LEDs that can be "Charlieplexed" in the usual way mathematically works out to:
nLEDs=P(n,r)
where
r is the number of leads of each LED (2 for each LED), and
n is the number of signal lines, and
P(n,r)=n!/(n-r)!

For example, P(5,2)=20, which means 20 LEDs with two leads each can be driven with 5 output lines.

Hi Al:
That formula makes perfect sense. For 2 pin-LED 4 wire P(4,2)=12 which is reducing N(N-1)(N-2)!/(N-2)!= N(N-1) = 4 * 3
I guess 12 LED for 4 wire is what you are suggesting and that is the max I came up with. What method of matrixing would you use? You said charlieplex already...sorry.
 
Last edited:

Latest threads

Back
Top