Charlieplexing

Charlieplexing (also known as tristate multiplexing, reduced pin-count LED multiplexing, complementary LED drive and crossplexing) is a technique for driving a multiplexed display, keypad or touchscreen,[1] in which relatively few I/O wires from a microcontroller are woven in a diagonally-intersecting pattern to access a large number of I/O entities (e.g. LEDs for output or switches or micro-capacitors for input).

This diagram shows how eight inputs to a lattice touchscreen or keypad creates 28 unique intersections, as opposed to 16 intersections created using a standard x/y multiplexed touchscreen.
Six diagonal Charlieplexed I/O lines formed into a very simple and scalable LED matrix.
A Charlieplexed digital clock which controls 90 LEDs with 10 pins of a PIC16C54 microcontroller.

Charlieplexing can be used in displays and resistive or projected capacitance keypads and touchscreens, using a simple array (shown). The diagram shows that eight inputs creates 16 intersections when used in an x/y array, but 28 intersections when used in a Charlieplexed array. When functioning as an LED display or mechanical keypad, the use of reversed pairs of LEDs or standard diodes at the intersections doubles the 8 input matrix size from 28 to 56.[1]

The method uses the tri-state logic capabilities of microcontrollers in order to gain efficiency over traditional multiplexing.

Although it is more efficient in its use of I/O, a small amount of address manipulation is required when trying to fit Charlieplexing into a standard x/y array (as described later in this article).

There are no problems if a diagonal array is used. The diagram shows a six I/O Charlieplexed array that is scalable to any size without difficulty.

Other issues that affect standard multiplexing but are exacerbated by Charlieplexing are:

a) consideration of current requirements and the forward voltages of the LEDs.

b) a requirement to cycle through the in-use LEDs rapidly so that the persistence of the human eye perceives the display to be lit as a whole. Multiplexing can generally be seen by a strobing effect and skewing if the eye's focal point is moved past the display rapidly.

Charlieplexing simulator

To see how I/O states affect LEDS in various sizes and arrangements of a Charlieplex matrix, go to https://malcolmbinstead.github.io/charlieplexing/. In a real life situation, however, voltage levels and shared current (described later in this article) have to be taken into account.

Origin

The Charlieplexing technique was introduced[2] by Maxim Integrated in 2001[3] as a reduced pin-count LED multiplexing scheme in their MAX6951 LED display driver.[3][2] The name "Charlieplexing", however, first occurred in a 2003 application note.[2] It was named after Charles "Charlie" M. Allen, an applications engineer of MAX232 fame,[4][5][6] who had proposed this method internally.

Also in 2001, Don Lancaster illustrated the method as part of his musings about the "N-connectedness" problem,[7] referring to Microchip Technology,[7] who had already discussed it as "complementary LED drive technique" in a 1998 application note[8] and would later include it in a tips & tricks booklet.[9]

While Microchip did not mention the origin of the idea, they might have picked it up in the PICLIST, a mailing list on Microchip PIC microcontrollers, where, also in 1998, Graham Daniel[10][11] proposed it to the community as a method to drive rows and columns of bidirectional LEDs. Daniel at the time had created simple circuits with PIC 12C508 chips driving 12 LEDs off 5 pins with a mini command set to set various lighting displays in motion.[10][11]

The method, however, was known and utilized by various parties much earlier in the 1980s, and has been described in detail as early as in 1979 in a patent by Christopher W. Malinowski, Heinz Rinderle and Martin Siegle of the Department of Research and Development, AEG-Telefunken, Heilbronn, Germany for what they called a "three-state signaling system".[12]

Reportedly, similar techniques were already in use as early as 1972 for track signaling applications in model railroading.[13]

Traditional multiplexing

PinsLEDs
10
22
36
412
520
630
742
856
972
1090
11110
12132
13156
14182
15210
16240
20380
24552
32992
401,560
482,256
563,080
644,032
nn2 − n

Display multiplexing is very different from multiplexing used in data transmission, although it has the same basic principles. In display multiplexing, the data lines of the displays are connected in parallel to a common databus on the microcontroller. Then, the displays are turned on and addressed individually. This allows the use of fewer I/O pins than it would normally take to drive the same number of displays directly. Here, each "display" could, for instance, be one calculator digit, not the complete array of digits.

With traditional multiplexing n I/O pins can drive a maximum of (n/2)^2 LEDS.

Tri-state multiplexing (Charlieplexing)

When using Charlieplexing, n drive pins can drive n digits with n − 1 segments. When simplified, it equates to n pins being able to drive n2 − n segments or LEDs.

If the number of LEDs (L) is known, then the number of pins (n) can be found from the equation: , the result being rounded up or down (as necessary), to the nearest whole number.

Example: If L = 57, then √L = 7.549, and 1 + √L = 8.549; the nearest whole number to this is 9, so 9 pins are needed to drive 57 LEDs (9 pins could drive up to 72 LEDs, but 8 pins could drive only 56 LEDs at most).

Origin of the (n2 − n) equation in Charlieplexing
Six conductors allow nine LEDs to be individually controlled in a standard x/y multiplexed array, but 30 LEDs in a "Charlieplexed" array.

Unlike in a traditional x/y multiplexed array, where a sub-set of conductive elements crosses a different sub-set of conductive elements, in a "fully Charlieplexed" multiplexed array, each conductive element crosses every other conductive element.

Six (n) conductive elements in a standard x/y multiplexed array forms a maximum of nine ((n / 2)2) unique intersections (see figure on far left).

The other diagrams also show six (n) conductive elements, but here all six elements cross over themselves, forming a multiplexed array of 36 (n2) intersections. LEDs are shown placed at every intersection. However, each conductor also crosses itself at the diagonal. Horizontal conductor 1 crosses vertical conductor 1, horizontal conductor 2 crosses vertical conductor 2, etc. This means that six of these LEDs are short-circuited (e.g. D1 and D5 are short-circuited). The six (n) diagonal LEDs will, therefore, never light up, because no voltage can ever develop across them, so (n) has to be subtracted from the total. There is no point in installing these LEDs (they are simply included here for illustrative purposes).

This leaves 30 LEDs (n2 n) that can be uniquely addressed and lit up independently.

Conductor "a" crossing conductor "b" is distinguishable from conductor "b" crossing conductor "a" because LED polarity is reversed. For example, when conductor 3 is positive and conductor 2 is negative, current flows through, and lights up LED D8, but when conductor 3 is negative and conductor 2 is positive, current flows through, and lights up LED D9.

These reverse polarity LED pairs are called complementary pairs. This diagram has 15 complementary pairs, allowing 30 LEDs to be lit independently.

n I/O forms a n (n - 1) Charlieplexed "off-set" x/y LED array.

The 6 unusable diagonal LEDs can be conveniently replaced by actual bidirectional shortcuts (so that there's no longer need to setup the interconnection lines grouped on the left and bottom of the diagrams, to drive the bottom input of vertical connectors from the matching left input of horizontal connectors).

By adjusting diagonally the form of horizontal and vertical connectors along the short-circuited main diagonal of the original matrix, this can be easily transformed into an array of 5 × 6 or 6 × 5 LEDs arranged on a regular grid.

A similar pattern could be used for a 10 × 11 matrix that could be used to drive up to 110 keys (including a few indicator LEDs) on a modern PC keyboard, where each key switch includes a small serial diode or LED, so that only 11 pins would be needed to individually control all of them (these individual diodes or LEDs inside each key switch would also avoid all common and undesirable "ghosting" effects, that are hard to eliminate completely when an arbitrary number of keys at any position are pressed at the same time).

Charlieplexing can also be used to significantly reduce the number of controlling pins for much larger matrixes, such as modern digital displays with high resolution. E.g. for a 4K RGB display at 3840 × 2160, this requires more than 8 millions individually addressable pixels, each featuring at least 3 colored LEDs or LCD cells, for a total of nearly 25 millions LEDs or LCD cells. Using a conventional x/y multiplexing would require at least (3840 + 2160 × 3) = 10320 controlling pins and many selection chips for controlling rows and columns all around the panel of LEDs or LCD cells. But with Charlieplexing, this can be reduced to only 63 controlling pins for the selection gate of display columns, plus 46 × 3 controlling pins for the selection and power-activation of RGB display rows, by a single transistor for each row or column (possibly with an extra common shielding ground to limit their mutual coupling); these controlling pins can easily fit around the output pins of one or two controller chips, even if we add the few additional pins needed on the controller for power, ground, clocks and I/O buses, surface-mounted with a high density and low cost on a single-layer PCB, and no need of complex routing and interconnection holes between layers; a dual layer is needed only for the basic Charlieplexing matrix mounted on borders of the panel itself).

Positions in the Charlieplexed matrix are not reduced to be just LEDs or diodes, they can be filled as well by two pins of a transistor (including its gate pin) so that its third pin is used as output to further control other devices, such as the horizontal and vertical selection lines of a large flat display panel (in that case, the two Charlieplexed matrices of transistors controlling and activating the rows or columns of the panel will be smartly arranged all along a border of that panel).

Diagonal arrays

Double folding 6 (n) parallel conductors over each other forms a square array, in the central region, composed of 15 ((n2 − n) / 2) unique intersections.
Folding 6 (n) conductors forms a triangular array of 15 ((n2 − n) / 2) unique intersections.
Six conductive elements form a display cylinder with 30 uniquely addressable LEDS.

A triangular Charlieplexed array of (n2 n) LEDs can be formed simply by folding a group of n parallel conductors at right angles over themselves, and placing a complementary pair of LEDs at each of the resulting unique intersections - see diagram on left. I/O connections can be made at the ends of the conductors, or at the fold positions - forming split conductors.

A square/rectangular diagonal array can be formed by double folding the parallel conductors - see diagram on right. Unsplit I/O conductors enter from the end of the array.

Split and unsplit diagonal conductors can also be formed into a seamless cylindrical array.

The diagram on the right shows a 6 I/O, split Charlieplexed cylindrical display layout, with 30 intersections, each with a uniquely addressable LED. All the I/Os connect to one end of the cylinder (standard x/y arrays would require the horizontal I/Os to enter from the side, or be "bussed" up a seam in one side).

During a scan, the North-West orientated branch of the split occasionally acts as a current source and, at other times the North-East orientated branch acts as a current sink. When not being used to power any LEDS, the split I/O is "turned off" (tristate). This prevents other LEDS from being lit inadvertently [14].

The conductive elements can be formed into a loop, allowing current to flow to the LEDs via two routes - similar to a domestic Ring Main.

Non-Charlieplexed diagonal arrays can also be formed into cylinders, but 6 I/Os would only create 9 unique intersections.

The LEDS could alternatively be arranged as complementary pairs at the intersections - see following section.

These cylinders can be physically transformed into complex 3 dimensional shapes, by a range of different methods - such as blow molding, vacuum forming, etc..

A similar layout is possible for a complementary cylindrical touchscreen.

Complementary drive

Charlieplexing in its simplest form works by using a diode matrix of complementary pairs of LEDs. The simplest possible Charlieplexed matrix would look like this:

Minimal 2-pin configuration for identical LEDs.
2-pin configuration for different LEDs.

By applying a positive voltage to pin X1 and grounding pin X2, LED 1 will light. Since current cannot flow through LEDs in reverse direction at this low voltage, LED2 will remain unlit. If the voltages on pin X1 and pin X2 are reversed, LED 2 will light and LED1 will be unlit.

The Charlieplexing technique does not actually make a larger matrix possible when only using two pins, because two LEDs can be driven by two pins without any matrix connections, and without even using tri-state mode. In this two-LED example, Charlieplexing would save one ground wire, which would be needed in a common 2-pin driver situation.

However, the 2-pin circuit serves as a simple example to show the basic concepts before moving on to larger circuits where Charlieplexing actually shows an advantage.

Expanding: tri-state logic

If the circuit above were to be expanded to accommodate three pins and six LEDs, it would look like this:

3-pin configuration for identical LEDs.
3-pin configuration for different LEDs.

This presents a problem, however. In order for this circuit to act like the previous one, one of the pins must be disconnected before applying charge to the remaining two. If, for example, LED 5 was intended to be lit, X1 must be charged and X3 must be grounded. However, if X2 is also charged, LED 3 would illuminate as well. If X2 was instead grounded, LED1 would illuminate, meaning that LED 5 cannot be lit by itself. This can be solved by utilizing the tri-state logic properties of microcontroller pins. Microcontroller pins generally have three states: "high" (5 V), "low" (0 V) and "input". Input mode puts the pin into a high-impedance state, which, electrically speaking, "disconnects" that pin from the circuit, meaning little or no current will flow through it. This allows the circuit to see any number of pins connected at any time, simply by changing the state of the pin. In order to drive the six-LED matrix above, the two pins corresponding to the LED to be lit are connected to 5 V (I/O pin "high" = binary number 1) and 0 V (I/O pin "low" = binary 0), while the third pin is set in its input state.

In doing so, current leakage out of the third pin is prevented, ensuring that the LED wished to be lit is the only one lit. Because the desired LED reduces the voltage available after the resistor, current will not flow across alternate paths (an alternate 2-LED path exists for every pair of pins in the 3-pin diagram, for example), so long as the voltage drop in the desired LED path is less than the total voltage drop across each string of alternative LEDs. However, in the variant with individual resistors this voltage-regulating effect does not affect the alternative paths so you must ensure that all LEDs used will not light with half the supply voltage applied because this variant does not benefit from the voltage-regulating effect of the desired path LED.

By using tri-state logic, the matrix can theoretically be expanded to any size, as long as pins are available. For n pins, n(n − 1) LEDs can be in the matrix. Any LED can be lit by applying 5 V and 0 V to its corresponding pins and setting all of the other pins connected to the matrix to input mode. Under the same constraints as discussed above up to n − 1 LEDs sharing a common positive or negative path can be lit in parallel.

Expanding

The 3-wire circuit can be rearranged to this near-equivalent matrix (resistors have been relocated).

3-pin configuration arranged in a 3 × 2 display pattern for identical LEDs; any number of LEDs on a single row may be powered at a time.
3-pin configuration arranged in a 3 × 2 display pattern for different LEDs; any number of LEDs on a single row may be powered at a time.

This emphasizes the similarities between ordinary grid multiplex and Charlieplex, and demonstrates the pattern that leads to "the n-squared minus n" rule.

In typical usage on a circuit board the resistors would be physically located at the top of the columns and connected to the input pin. The rows would then be connected directly to the input pin bypassing the resistor.

The first setup in the image on the left is suitable only when identical LEDs are used since a single resistor is used for current-limiting through more than one LED (though not at the same timerather, one resistor limits current through only one LED in a given column at one time). This is contrasted to the second configuration with individual resistors for each LED, as shown in the image on the right. In this second configuration, each LED has a unique resistor paired with it. This makes it possible to mix different kinds of LEDs by providing each with its appropriate resistor value.

In both of these configuration, as shown in both the left and the right image, the relocated resistors make it possible to light multiple LEDs at the same time row-by-row, instead of requiring that they be lit individually. The row current capacity could be boosted by an NPN emitter follower BJT transistor instead of driving the current directly with the typically much weaker I/O pin alone.

Problems with Charlieplexing

Refresh rate

Refresh rate is not a problem if Charlieplexed Active matrix addressing is used with a Charlieplexed LED array.[15]

In common with x/y multiplexing, however, there can be refresh rate issues if passive matrix addressing is used.

Because only a single set of LEDs, all having a common anode or cathode, can be lit simultaneously without turning on unintended LEDs, Charlieplexing requires frequent output changes, through a method known as multiplexing. When multiplexing is done, not all LEDs are lit quite simultaneously, but rather one set of LEDs is lit briefly, then another set, and eventually the cycle repeats. If it is done fast enough, they will appear to all be on, all the time, to the human eye because of persistence of vision. In order for a display to not have any noticeable flicker, the refresh rate for each LED must be greater than 50 Hz.

Suppose 8 tri-state pins are used to control 56 LEDs through Charlieplexing, which is enough for 8 7-segment displays (without decimal points). Typically 7-segment displays are made to have a common cathode, sometimes a common anode, but without loss of generality suppose it is a common cathode. All LEDs in all 8 7-segment displays cannot be turned on simultaneously in any desired combination using Charlieplexing. It is impossible to get 56 bits of information directly from 8 trits (the term for a base-3 character, as the pins are 3-state) of information, as 8 trits fundamentally comprises 8 log23, or about 12.7 bits of information, which falls far short of the 56 bits required to turn all 56 LEDs on or off in any arbitrary combination. Instead, the human eye must be fooled by use of multiplexing.

Only one 7-segment display, one set of 7 LEDs can be active at any time. The way this would be done is for the 8 common cathodes of the 8 displays to each get assigned to its own unique pin among the 8 I/O ports. At any time, one and only one of the 8 controlling I/O pins will be actively low, and thus only the 7-segment display with its common cathode connected to that actively low pin can have any of its LEDs on. That is the active 7-segment display. The anodes of the 7 LED segments within the active 7-segment display can then be turned on in any combination by having the other 7 I/O ports either high or in high-impedance mode, in any combination. They are connected to the remaining 7 pins, but through resistors (the common cathode connection is connected to the pin itself, not through a resistor, because otherwise the current through each individual segment would depend on the number of total segments turned on, as they would all have to share a single resistor). But to show a desired number using all 8 digits, only one 7-segment display can be shown at a time, so all 8 must be cycled through separately, and in a 50th of a second for the entire period of 8. Thus the display must be refreshed at 400 Hz for the period-8 cycle through all 8 segments to make the LEDs flash no slower than 50 times per second. This requires constant interruption of whatever additional processing the controller performs, 400 times per second.

Peak current

Due to the decreased duty cycle, the current requirement of a Charlieplexed display increases much faster than it would with a traditionally multiplexed display. As the display gets larger, the average current flowing through the LED must be (roughly) constant in order for it to maintain constant brightness, thus requiring the peak current to increase proportionally. This causes a number of issues that limit the practical size of a Charlieplexed display.

  • LEDs often have a maximum peak current rating as well as an average current rating.
  • If the microcontroller code crashes, and a one-LED-at-a-time Charlieplex is being used, the single LED left lit is under much higher stress than it would be in a row-at-a-time Charlieplexed display or in a traditionally multiplexed display, increasing the risk of a failure before the fault is spotted.

Requirement for tristate

All the outputs used to drive a Charlieplexed display must be tristate. If the current is low enough to drive the displays directly by the I/O pins of the microcontroller, this is not a problem, but if external tristates must be used, then each tristate will generally require two output lines to control, eliminating most of the advantage of a Charlieplexed display. Since the current from microcontroller pins is typically limited to 20 mA or so, this severely restricts the practical size of a Charlieplexed display. However, it can be done by enabling one segment at a time.[16]

Complexity

Diagonally "wired" Charlieplex arrays are very simple to lay out and scan.

8 I/O projected capacitance touchscreen matrix, with 28 unique intersections.

If used as a multitouch projected capacitance touchscreen (see Figure on left), the first I/O can be set as an output and all the remaining I/Os set as inputs. All these inputs can be sensed simultaneously, if processor resources allow - the input equivalent of Chipiplexing. When output 1 has been "read" by all these inputs, the second I/O can be set as an output and I/Os 1, 3, 4, 5 etc., set as inputs.

n diagonally wired, Charlieplexed LEDs form a regular n (n - 1) array.

This sequence is repeated until the whole screen has been scanned. This process is repeated, ad infinitum, for subsequent scans.[1]

A very simple, diagonal layout can be used to create a regular, scalable Charlieplexed diode array, where n I/O lines control (n - 1)2 diodes - all of which face the same direction (see diagram on right).[1]

This diagram shows n (n - 1) diodes, but the diodes in the last column face alternating directions.


Up until now x/y Charlieplexed matrices were significantly more complicated, both in the required PCB layout and microcontroller programming, than prebuilt standard x/y multiplex matrices. This increased design time. Soldering components could also be more time-consuming. It was suggested that a balance between complexity and pin use could be achieved by Charlieplexing several pre-built multiplexed LED arrays together.[17]

Forward voltage

When using LEDs with different forward voltages, such as when using different color LEDs, some LEDs can light when not desired.

In the diagram above it can be seen that if LED 6 has a 4 V forward voltage, and LEDs 1 and 3 have forward voltages of 2 V or less, they will light when LED 6 is intended to, as their current path is shorter. This issue can easily be avoided by comparing forward voltages of the LEDs used in the matrix and checking for compatibility issues. Or, more simply, using LEDs that all have the same forward voltage.[7][2]

This is also a problem where the LEDs are using individual resistors instead of shared resistors, if there is a path through two LEDs that has less LED drop than the supply voltage these LEDs may also illuminate at unintended times.

LED failure

If a single LED fails, by becoming either open-circuit, short-circuit, or leaky (developing a parasitic parallel resistance, which allows current in both directions), the impact will be catastrophic for the display as a whole. Furthermore, the actual problematic LED may be very difficult to identify, because potentially a large set of LEDs which should not be lit may all come on together, and—without detailed knowledge of the circuit—the relation between which LED is bad and what set of LEDs all come on together cannot be easily established.

An open-circuit diode failure in a partially "Charlieplexed" diode array allows current to pass via an alternative route.

In a standard x/y array, a LED (D1) going open-circuit causes that LED to cease functioning, with no further consequences.

In a partially "Charlieplexed" array, however, if the failed LED (D1) becomes open circuit, the voltage between the LED's 2 electrodes may build up until it finds a path through, at least three other LEDs. If the voltage is high enough, this may cause these other LEDs (such as D2, D3 and D4) to light up unexpectedly.

No deleterious effect is noticed, however, when the polarity is reversed, as D1 would not have conducted under such circumstances anyway, due to it being reverse biased. Current passes through D1's complementary diode (D5) as normal.

If the failed LED becomes an open circuit in a fully "Charlieplexed" array, the voltage between the LED's two electrodes may build up until it finds a path through two other LEDs. There are as many such paths as there are pins used to control the array minus 2; if the LED with anode at node m and cathode at node n fails in this way, it may be that every single pair of LEDs in which one's anode is node m, cathode is p for any value of p (with the exceptions that p cannot be m or n, so there are as many possible choices for p as the number of pins controlling the array minus 2), along with the LED whose anode is p and cathode is n, will all light up.

If there are 8 I/O pins controlling the array, this means that there will be 6 parasitic paths through pairs of 2 LEDs, and 12 LEDs may be unintentionally lit, but fortunately this will only happen when the one bad LED is supposed to come on, which may be a small fraction of the time and will exhibit no deleterious symptoms when the problem LED is not supposed to be lit. If the problem is a short between nodes x and y, then every time any LED U with either x or y as its anode or cathode and some node z as its other electrode is supposed to come on (without loss of generality, suppose U's cathode is connected to x), the LED V with cathode y and anode z will light as well, so any time either node x or y is activated as an anode OR a cathode, two LEDs will come on instead of one. In this case, it lights only one additional LED unintentionally, but it does it far more frequently; not merely when the failed LED is supposed to come on, but when any LED that has a pin in common with the failed LED is supposed to come on.

The problematic elements become especially difficult to identify if there are two or more LEDs at fault. What this means is that unlike most methods in which the loss of a single LED merely causes a single burned-out segment, when Charlieplexing is used, one or two burned-out LEDs, whatever the mode of failure, will almost certainly cause a catastrophic cascade of unintended lightings of the LEDs that still work, very likely rendering the entire device completely and immediately unusable. This must be taken into account when considering the required lifetime and failure characteristics of the device being designed.

LED failure in a diagonal matrix:

Failure of one LED can cause current to be re-routed through other LEDs.

Due to the fact that the layout of a standard vertical/horizontal Charlieplexed matrix is quite complicated, the consequences of LED failure are more easily described using a simple diagonal Charlieplexed matrix.

The diagram shows a 6-input Charlieplexed array where one LED (L1) becomes open circuit.

If one LED goes open circuit, and if the voltage is high enough, then current that should have gone through that LED could theoretically find an alternative route through other LEDs. For example, if LED 1 (L1) goes open circuit, then current could still flow from terminal 3 to terminal 2 via L2 in series with L3. Other routes are via L4/L5, L6/L7 and L8/L9. This could possibly cause these LEDs to flicker.

If LED 1 goes short circuit, then both its terminals will always be at the same potential, and so will those of its inverted complementary LED. Therefore, neither LED will light up, even though one of them may still be fully functional.

If terminal 2 or terminal 3 is negative, then both the red and brown tracks will be negative at the same time. Therefore, some LEDs connected to these tracks could light up un-intentionally when terminals 1, 4, 5 or 6 are positive.

Similarly, if terminal 2 or terminal 3 is positive, then both the red and brown tracks will be positive at the same time. Therefore, some LEDs connected to these tracks could light up un-intentionally when terminals 1, 4, 5 or 6 are negative.

It has been shown that the failure of one LED can cause other consequences.

If a complementary pair of LEDs are not working, then it is most likely that only one of them is shorting, and a meter may be used to test which one it is. Otherwise, if one or more LEDs never light up, then they are probably all faulty and should be replaced. Their replacement will, hopefully, make any spurious artefacts disappear.[1]

Alternative use cases and variants

Input data multiplexing

Charlieplexing can also be used to multiplex digital input signals into a microcontroller. The same diode circuits are used, except a switch is placed in series with each diode. To read whether a switch is open or closed, the microcontroller configures one pin as an input with an internal pull-up resistor. The other pin is configured as an output and set to the low logic level. If the input pin reads low, then the switch is closed, and if the input pin reads high, then the switch is open.[18]

One potential application for this is to read a standard (4 × 3) 12-key numeric keypad using only 4 I/O lines. The traditional row-column scan method requires 4 + 3 = 7 I/O lines. Thus Charlieplexing saves 3 I/O lines; however it adds the expense of 12 diodes, (since the diodes are only free when LEDs are used). A variation of the circuit with only 4 diodes is possible,[18] however this reduces the rollover of the keyboard. The microcontroller can always detect when the data is corrupt, but there is no guarantee it can sense the original key presses, unless only one button is pressed at a time. (However, it is probably possible to arrange the circuit so that if at most any two adjacent buttons are pressed, then no data loss will occur.) The input is only lossless in the 4-diode circuit if only one button is pressed at a time, or if certain problematic multiple key presses are avoided. In the 12-diode circuit, this is not an issue, and there is always a one-to-one correspondence between button presses and input data. However, there are so many diodes that are required to use the method (especially for larger arrays) that there is generally no cost savings over the traditional row-column scan method, unless the cost of a diode is only a fraction of the cost of an I/O pin, where that fraction is one over the number of I/O lines.

Projected capacitance touchscreens and keypads.

Single wire plot for 32 input, diagonally wired, projected capacitance touchscreen film.

These do not use diodes but rely on the change in capacitance between crossing conductive tracks to detect the proximity of one or more fingers through non-conducting materials such as plastic overlays, wood, glass etc., - even double glazing.

These tracks can be made from a wide range of materials, such as printed circuit boards, transparent Indium Tin oxide, insulation coated fine wire, etc.

The technology can range in size from very small, as in "Fingerprint detectors",[19] to very large, as in "Touch Interactive Video Walls". A limit is imposed on the maximum width of an x/y wired touchscreen when the horizontal track resistance gets too great for the product to function properly.

Charlieplexing is ideal for diagonally wired projected capacitance keypads and touchscreens. It almost doubles the number of cross-over points when compared to standard x/y multiplexing, and all I/O tracks come from just one edge.[1]

The left image (above) shows the diagonal wiring arrangement of a 32 I/O Charlieplexed projected capacitance touchscreen, manufactured using 10 micron diameter wire.

Diagonal wiring allows Charlieplexed touchscreen width to increase "indefinitely" without increasing electrode resistance.

The video shows the same touchscreen in action.

There are no LEDs or diodes and, at any one time, only one I/O line is set as a high impedance output, the remaining I/O lines being set as high-impedance inputs or "grounded". This means that power requirements are very small.

The diagram on the left shows the layout for a multi-touch, projected capacitance, Charlieplexed touchscreen that is not restricted in width. That is because conductor lengths are always 1.414 times the height of the touchscreen. This means that the screen can be widened "indefinitely" without increasing conductor resistance.[20]

GuGaplexing

In 2008, Dhananjay V. Gadre devised Gugaplexing, which is like Charlieplexing with multiple drive voltages.[21][22]

Chipiplexing

In 2008, Guillermo Jaquenod's so called Chipiplexing adds emitter followers to boost the strength of the row drive allowing rows wider than a single microcontroller port could drive to be lit simultaneously.[23][24]

Cross-plexing

In 2010, the Austrian chip manufacturer austriamicrosystems AG (named ams AG[nb 1] since 2012, and ams-OSRAM AG since 2020) introduced the multiplexing LED driver IC AS1119,[25][26] followed by the AS1130 in 2011.[27][28]

Also, the analog & mixed signal (AMS)[nb 1] division (named Lumissil Microsystems since 2020) of Integrated Silicon Solution Inc. (ISSI) introduced the IS31FL3731 in 2012[29][30] and the IS31FL3732 in 2015.[31][32][33] They all use a technique they call cross-plexing, a variant of Charlieplexing with automatic detection of open or shorted connections and anti-ghosting measures.[34]

Tucoplexing

In 2019, Micah Elizabeth Scott developed a method to use 3 pins to run 4 LEDs and 4 switches called Tucoplexing.[35]

Pulse-width modulation

Charlieplexing can even be used with pulse-width modulation to control the brightness of 12 LEDs with 4 pins.[36]

Code example

In the following Arduino code example, the circuit[37][38] uses ATtiny 8-pin microcontroller which has 5 I/O pins to create a 7-segment display. Since a 7-segment display only requires control of 7 individual LEDs, we use 4 of the ATtiny I/O pins as Charlieplexed outputs (n (n - 1)), i.e. the 4 pins could be used to control up to 12 individual LEDs (here we just use 7 of them). Leaving the fifth I/O pin to be used as digital or analog input or another output.

// ATtiny code.
// Reads analog (or digital) input from pin 4 and every time the input goes below a set threshold.
// It counts one and displays the increase in count either by activating up one of four LEDs (or transistors)
// or one of twelve Charlieplexed LEDs.

// SET THESE VALUES:
int threshold = 500;
int maxCount = 7;
////////////////////
boolean sensorTriggered = false;
int count = 0;
int sensorValue = 0;
long lastDebounceTime = 0;  // The last time the output pin was toggled.
long debounceDelay = 50;    // The debounce time; increase if the output flickers.
////////////////////////////////////////////////////////////////////////////////
void setup() {
  // Use pull-down for disabled output pins rather than pull-up to reduce internal consumption.
  for (int pin = 0; pin < 4; pin++) {
    pinMode(pin, INPUT), digitalWrite(pin, LOW);
  }
  // Internal pull-up for enabled input pin 4.
  pinMode(4, INPUT), digitalWrite(4, HIGH);
}
////////////////////////////////////////////////////////////////////////////////
void loop() {
  testDigits();
}
void testDigits() {
  charlieLoop();
}
////////////////////////////////////////////////////////////////////////////////
void readSensor() {
  sensorValue = analogRead(2);  // pin4!
  delay(100);
  if (sensorValue < threshold && sensorTriggered == false) {
    sensorTriggered = true;
    count++;
    if (count > maxCount) count = 0;
    charlieLoop();
  }
  if (sensorValue > threshold) sensorTriggered = false;
}
////////////////////////////////////////////////////////////////////////////////
void charlieLoop() {
  count++;

  for (int i = 0; i < 1000; i++) {
    for (int c = 0; c < count; c++) {
      charliePlexPin(c);
    }
  }
  delay(1000);
  if (count > maxCount) count = 0;
}
////////////////////////////////////////////////////////////////////////////////
void charliePlexPin(int myLed){

  // Make sure we don't feed random voltages to the LEDs
  // during the brief time we are changing pin voltages and modes.
  // Use pull-down for disabled output pins rather than pull-up to reduce internal consumption.
  for (int pin = 0; pin < 4; pin++) {
    pinMode(pin, INPUT), digitalWrite(pin, LOW);
  }
  // With 4 pins we could lit up to 12 LEDs, we use only 7 here.
  // Make sure to set pin voltages (by internal pull-up or pull-down)
  // before changing pin modes to output.

#if 1 // Reduced code using a static lookup table.

  typedef struct {
    // Two different pin numbers (between 0 and 3; order is significant),
    // otherwise no led will be lit.
    low, high: int: 2;
  } Pins;

  static Pins pinsLookup[] = {
    {2, 0}, {2, 3}, {1, 3}, {0, 1}, {1, 0}, {0, 2}, {1, 2},
    // Other possible combinations for up to 12 LEDs:
    // {0, 3}, {2, 1}, {3, 0}, {3, 1}, {3, 2},
    // Other unusable combinations that don't lit any LED with a significant voltage and current,
    // unless pull-up or pull-down resistances are very unbalanced:
    // {0, 0}, {1, 1}, {2, 2}, {3, 3}
  };

  if (myLed >=0 && myLed <= sizeof(pinsLookup) / sizeof(Pins)) {
      register Pins &pins = pinsLookup[myLed];
      // Note that the first digitWrite to LOW is commented out,
      // as it is already set above for all output pins.
      /* digitalWrite(pins.low, LOW), */ pinMode(pins.low, OUTPUT);
      digitalWrite(pins.high, HIGH), pinMode(pins.high, OUTPUT);
   }

#else // Equivalent code using a long switch.

  switch(myLed) {
  case 0:
    /* digitalWrite(2, LOW), */ pinMode(2, OUTPUT);
    digitalWrite(0, HIGH), pinMode(0, OUTPUT);
    break;
  case 1:
    /* digitalWrite(2, LOW), */ pinMode(2, OUTPUT);
    digitalWrite(3, HIGH), pinMode(3, OUTPUT);
    break;
  case 2:
    /* digitalWrite(1, LOW), */ pinMode(1, OUTPUT);
    digitalWrite(3, HIGH), pinMode(3, OUTPUT);
    break;
  case 3:
    /* digitalWrite(0, LOW), */ pinMode(0, OUTPUT);
    digitalWrite(1, HIGH), pinMode(1, OUTPUT);
    break;
  case 4:
    /* digitalWrite(1, LOW), */ pinMode(1, OUTPUT);
    digitalWrite(0, HIGH), pinMode(0, OUTPUT);
    break;
  case 5:
    /* digitalWrite(0, LOW), */ pinMode(0, OUTPUT);
    digitalWrite(2, HIGH), pinMode(2, OUTPUT);
    break;
  case 6:
    /* digitalWrite(1, LOW), */ pinMode(1, OUTPUT);
    digitalWrite(2, HIGH), pinMode(2, OUTPUT);
    break;
  }

#endif
}
////////////////////////////////////////////////////////////////////////////////
void spwm(int freq, int pin, int sp) {
  // Call Charlieplexing to set correct pin outs:
  // on:
  digitalWrite(pin, HIGH);
  delayMicroseconds(sp * freq);
  // off:
  digitalWrite(pin, LOW);
  delayMicroseconds(sp * (255 - freq));
}

See also

Notes

  1. The ICs AS1119 and AS1130 were introduced by austriamicrosystems AG (formerly Austria Mikro Systeme), later named ams AG and ams-OSRAM AG. The ICs IS31FL3731 and IS31FL3732 were introduced by the AMS (analog & mixed signal) division (now called Lumissil Microsystems) of the fab-less chip manufacturer Integrated Silicon Solution Inc. (ISSI). Presumably, the fact that both manufacturers of cross-plexing LED driver ICs carry "AMS" in their name is coincidence only.

References

  1. Binstead, Ronald Peter (2017-01-25) [2015-07-21]. "Touch sensor - A Touch Sensitive Device where the Sensing Elements are Oblique to the Edges of the Device". Espacenet.com. Nottingham, UK. Patent GB2540560A. Retrieved 2018-02-22. (NB. Diagonal Charlieplexed touchscreen.)
  2. "Charlieplexing - Reduced Pin-Count LED Display Multiplexing". Maxim Integrated Products, Inc. 2003-02-10. Application Note 1880. Archived from the original on 2016-08-13. Retrieved 2017-06-07. […] This unusual multiplex technique is used by the MAX6950, MAX6951, MAX6954, MAX6955, MAX6958, and MAX6959 LED display drivers. […] Charlie Allen originally championed this technique internally at Maxim, and so the shorthand name "Charlieplexing" came into use to distinguish reduced pin count multiplexing from the traditional method. The first Maxim product to use Charlieplexing is the Maxim MAX6951 LED driver, which drives 8 numeric digits with only 9 pins […] (4 pages)
  3. MAX6950/MAX6951 - Serially Interfaced, +2.7V to +5.5V, 5- and 8-Digit LED Display Drivers (PDF). Revision 1. Sunnyvale, California, USA: Maxim Integrated Products. December 2001. 19-2227. Archived (PDF) from the original on 2021-12-10. Retrieved 2021-12-10. (19 pages)
  4. EDN Staff, ed. (1997-05-08). "EDN's 1996 Innovator / Innovation Competition". EDN. Archived from the original on 2021-12-10. Retrieved 2021-12-10.
  5. Sherman, Len (2016-12-16). "Almost 30 years of the MAX232". BISinfotech. Archived from the original on 2021-12-10. Retrieved 2021-12-10. […] The MAX232's success was as much a tribute to the vision of its definer, Charlie Allen, as it was to the ingenuity of its designer, Dave Bingham. […]
  6. Fox, Brett J. (2021). "What Makes Your Great Engineers Great?". Archived from the original on 2021-12-10. Retrieved 2021-12-10. […] The launch of the MAX232 family is particularly insightful. Charlie Allen, a brilliant, customer focused, applications engineer, noticed that our customers were using a product called the ICL7660, which Dave [Bingham] also designed, to provide the negative power supply for RS-232 line drivers and receivers. So, Charlie approached Dave, and asked Dave if he could design an IC that integrated the functionality of the ICL7660 with an RS-232 line driver and receiver. […]
  7. Lancaster, Don (August 2001). "N-Connectedness" (PDF). Tech Musings. No. 152. Thatcher, Arizona, USA: Synergetics. pp. 152.2–152.5. Archived (PDF) from the original on 2021-12-09. Retrieved 2021-12-09. (4 pages)
  8. Rebic, Jean-Claude (1999-11-19) [1998-11-06]. "Complementary LED drive" (PDF). Pioneer-Standard, USA: Microchip Technology Inc. DS91029A. Application Note TB029. Archived (PDF) from the original on 2021-02-13. Retrieved 2021-12-09. (3+1 pages)
  9. "TIP #2: Input/Output Multiplexing". Microchip Tips 'n Tricks - 8-pin FLASH PIC Microcontrollers - Outperform the Competition (PDF). Chandler, Arizona, USA: Microchip Technology Inc. 2003. p. DS40040B-page 3. DS40040B. Archived from the original (PDF) on 2007-01-28. (2+ii+38+2 pages)
  10. Daniel, Graham (1998-07-19). "loads of flashing LEDs". piclist.com. 060918a. Archived from the original on 2021-12-11. Retrieved 2021-12-11. (NB. With contributions by Paul B. Webster, Mark Willis, Dwayne Reid and Alan King.)
  11. Daniel, Graham (1998-07-20). "12 LED hex file, 12c508". piclist.com. 045923a. Archived from the original on 2021-12-11. Retrieved 2021-12-11.
  12. Malinowski, Christopher W.; Rinderle, Heinz; Siegle, Martin (1982-03-09) [1979-10-16]. "Three-state signaling system" (PDF). Heilbronn, Germany: Licentia Patent-Verwaltungs-G.m.b.H. / Telefunken Electronic GmbH. US Patent 4319227A. Archived (PDF) from the original on 2021-12-09. Retrieved 2021-12-09.
  13. "unknown". Model Railroader. 1972. {{cite magazine}}: Cite uses generic title (help)
  14. "Element arrangement and associated method of manufacture". Retrieved 2023-10-21.
  15. Lapedus, Mark (2019-03-29). "MicroLEDs: The Next Revolution In Displays? Technology offers improved brightness, colors, and lower power, but they're expensive and difficult to manufacture". Manufacturing, Packaging & Materials. SemiconductorEngineering. Sperling Media Group LLC. Archived from the original on 2023-04-25. Retrieved 2023-04-11. (NB. Micro-led array using active matrix.)
  16. Pino, Jose (2009-08-25). "'Almost No Parts' 12/24hrs LED Clock". Jose Pino's Projects & Tidbits. Archived from the original on 2021-10-10. Retrieved 2021-12-10. (NB. Using Charlieplexed 7-segment LED displays.)
  17. Rule, Michael E. (2013-03-19). "Charlieplexing with LED dot matrix modules". Archived from the original on 2021-02-24. Retrieved 2013-03-20.
  18. Joshi, Kartik (2008-04-24). "Novel Switch Interface Scheme Reduces Microprocessor Pin Count". Electronic Design. Archived from the original on 2021-02-24. Retrieved 2021-12-10. (1 page) (NB. Charlieplexing for input data.)
  19. Triggs, Robert (2023-03-25). "How fingerprint scanners work: Optical, capacitive, and ultrasonic explained. Fingerprint scanners are everywhere, but how do they work?". Mobile Technology. AndroidAuthority. Authority Media. Archived from the original on 2023-06-23. Retrieved 2023-06-23.
  20. Binstead, Ronald Peter (2023-03-02) [2022-08-26]. "Element arrangement and associated method of manufacture". WO2023026062A1. Retrieved 2023-03-09. (NB. Example of an infinitely wide touchscreen.)
  21. Gadre, Dhananjay V. (2008). "GuGaplexed Valentine LED Heart". instructables circuits. Archived from the original on 2021-02-28. Retrieved 2021-12-25.
  22. Jepson, Brian (2008-06-23). "Charlieplexing times two". Make:. Make Community LLC. Archived from the original on 2021-02-24. Retrieved 2021-12-10.
  23. Jaquenod, Guillermo (2008-11-27). Rowe, Martin; Granville, Fran (eds.). ""Chipiplexing" efficiently drives multiple LEDs using few microcontroller ports" (PDF). Design Ideas. EDN. La Plata, Argentina. pp. 59–60. Archived from the original (PDF) on 2012-12-18. (2 pages)
  24. Staff writer, ed. (2008-12-09). "Chipiplexing LEDs". Electronics Weekly. Archived from the original on 2021-12-25. Retrieved 2021-12-25.
  25. "austriamicrosystems announces new 144-channel dot matrix LED driver with industry's highest efficiency and smallest size". Company Newsfeed. LEDs Magazine. Vol. 7, no. 8. PennWell Corporation. 2010-08-23. ISSN 2156-633X. Archived from the original on 2022-05-12. Retrieved 2022-05-13. […] Only 18 lines are required to drive all 144 LEDs. This is accomplished with austriamicrosystems' multiplexing technique called cross-plexing. This allows reducing the line count on the PCB as well as fewer pins on the connectors, saving space & costs. […] Other features include […] open and shorted LED error detection […] (NB. Announcement of the AMS AS1119.)
  26. "Application Note - Cross-Plexing - AS1119 - 144 LED Cross-Plexing Driver with 320mA Charge-Pump". 1.00. Unterpremstätten, Austria: austriamicrosystems AG. 2010. Archived from the original on 2022-05-13. Retrieved 2022-05-13. (5+1 pages); "Demo Board Manual - AS1119 - 144 LED, I²C Interfaced, Cross-Plexing Driver with a 320mA Charge-Pump" (PDF). 1.00. Unterpremstätten, Austria: austriamicrosystems AG. 2010. Archived (PDF) from the original on 2022-05-13. Retrieved 2022-05-13. (1+5+1 pages); "Application Note AN02 – SW Manual - AS1119 - 144 LED Cross-Plexing Driver with 320mA Charge-Pump". 1.00. Unterpremstätten, Austria: austriamicrosystems AG/ams AG. 2010. Archived from the original on 2022-05-13. Retrieved 2022-05-13. (6+1 pages)
  27. "austriamicrosystems launches 132 LED driver featuring industry's highest efficiency and smallest size". Company Newsfeed. LEDs Magazine. Vol. 8, no. 10. PennWell Corporation. 2011-10-04. ISSN 2156-633X. Archived from the original on 2022-05-13. Retrieved 2022-05-13. […] Only 12 lines are required to drive all 132 LEDs. This is accomplished with austriamicrosystems' multiplexing technique called cross-plexing. It reduces line count on the PCB as well as pins on the connectors, saving space & costs. Other features include […] open and shorted LED error detection […] (NB. Announcement of the AMS AS1130.)
  28. "AS1130 - 132-LED Cross-Plexing Driver with Scrolling Function" (PDF). 2.01. Unterpremstätten, Austria: ams AG. 2016-10-12 [2016-09-21]. Archived (PDF) from the original on 2021-08-14. Retrieved 2022-05-13. (66+1 pages); "Demo Kit Manual - AS1130 - Standard Board - AS1130-WL_DK_ST". 2.00. Unterpremstätten, Austria: ams AG. 2014-11-14 [2011-10-11]. Archived from the original on 2022-05-13. Retrieved 2022-05-13. (32 pages); "Application Note: 4 pin RGBs in a Cross-Plexing Matrix - AS1130 - 132 LED, I²C Interfaced, Cross-Plexing Driver with scrolling Function". 1.00. Unterpremstätten, Austria: austriamicrosystems AG. 2012. Archived from the original on 2022-05-13. Retrieved 2022-05-13. (6+1 pages)
  29. "IS31FL3731 - Audio Modulated Matrix LED Driver" (PDF). Rev. F. Lumissil Microsystems/Integrated Silicon Solution Inc. (ISSI). 2019-11-04 [2012-03-14]. Archived (PDF) from the original on 2022-05-12. Retrieved 2022-05-13. (24+1 pages)
  30. "IS31FL3731C - Audio Modulated Matrix LED Driver" (PDF). Rev. B. Integrated Silicon Solution Inc. (ISSI). 2014-04-01. Archived (PDF) from the original on 2022-05-13. Retrieved 2022-05-13. (22+1 pages)
  31. "ISSI Expands FxLED Family with Audio Modulated LED Driver to drive 144 LEDs - IS31FL3732 supports special effect LED functions for automotive, gaming, white goods and IoT platforms" (PDF). San Jose, California, USA: Integrated Silicon Solution Inc. (ISSI). 2015-02-24. Archived (PDF) from the original on 2022-05-16. Retrieved 2022-05-16. (2 pages)
  32. "IS31FL3732 - Audio Modulated Matrix LED Driver" (PDF). Rev. D. Lumissil Microsystems/Integrated Silicon Solution Inc. (ISSI). 2017-07-04 [2015-09-06]. Archived (PDF) from the original on 2022-05-13. Retrieved 2022-05-13. (27+1 pages)
  33. "IS31FL3732A - Audio Modulated Matrix LED Driver" (PDF). Rev. C. Lumissil Microsystems/Integrated Silicon Solution Inc. (ISSI). 2017-07-04 [2016-11-03]. Archived (PDF) from the original on 2022-05-12. Retrieved 2022-05-13. (27+1 pages)
  34. Rust, Peter (2013-04-10). "LED-Displays - Matrixtreiber-Topologien unter der Lupe" [LED displays - Matrix driver topologies in focus]. elektroniknet.de (in German). WEKA FACHMEDIEN GmbH. Archived from the original on 2022-05-12. Retrieved 2022-05-13. […] Die möglichen Ghosting-Effekte und Probleme mit offenen LEDs haben die Verbreitung der Charlieplexing-Topologie in der Vergangenheit stark gebremst. Eine »Crossplexing« genannte Verbesserung des Verfahrens verspricht nun, die Nachteile des bisherigen Verfahrens zu eliminieren […] Die Kurzschluss- und Defekterkennung des ICs beruht […] auf der Vorwärtsspannung der in der Matrix verwendeten LEDs. Das Bauelement bestimmt eine optimale Spannungsschwelle für Defektsituationen und konfiguriert sie automatisch. Die Kenntnis der Position eines Kurzschlusses oder Defekts eliminiert natürlich noch nicht die Ghosting-Effekte. Wird jedoch eine Unterbrechung festgestellt, kann das System die Koordinaten des Defekts abspeichern. […] Jedes Mal, wenn der Treiber angewiesen wird, diese LED anzusteuern, wird diese Instruktion ignoriert. Diese Maßnahme vermeidet das unbeabsichtigte Aufleuchten von LEDs im Rest des Punktmatrixdisplays. […]
  35. Scharfglass, Kerry (2019-03-23). "Tucoplexing: A New Charliplex for Buttons and Switches". Hackaday. Archived from the original on 2021-12-10. Retrieved 2021-12-10.
  36. Johnson-Davies, David (2021-10-19) [2019-02-19]. "Twelve PWM outputs from an ATtiny85". Technoblogy. Archived from the original on 2021-12-10. Retrieved 2021-12-10.
  37. "ATtiny - Charlieplexed 7-Segment Display and 1 Switch or Sensor". 2017. Archived from the original on 2021-05-11. Retrieved 2021-12-10.
  38. Satomi, Mika; Perner-Wilson, Hannah (2015) [2012]. "Circuits and Code - ATtiny: 7-Segment Display". How to get what you want. Archived from the original on 2021-04-18. Retrieved 2017-11-13.

Further reading

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.