web analytics

Driving 4×7 LED with 4 resistors only (kinda Charlieplexing)

Aka cheap LED driver

Traditional way of connecting 4 digits x 7segment display to microprocessor suggest using 4 transistors and 12 resistors:
4x7LED

Would You be interested in shrinking everything down to LED display and 4 resistors ONLY ?

Then continue reading.

Assuming one LED segment (digit’s stick) drives 20mA current this setup can take up to 160mA of power (7segments+dot)*20 if we will use multiplexing (turning just one digit at a time, then next, then next,… an doing it very very fast). Even this trick takes too much power for portable devices running on batteries.

Now I’will try to illustrate traditional multiplexing vs. proposed kinda charlieplexing:

In multiplexing each digit lights-on then turns-off, then next lights-on, and so on:
multiplexing

In charlieplexing each segment of digit lights-on then turns-off, then next lights-on, and so on:
charlieplexing

As You see this way we never exceed 20mA – because at every moment only one segment is active. This reduces power consumption and eliminates need of transistors – maximum current limit of digital pins Arduino boards – 40mA.

Plain 4×7 LED modules
sku_268146_1

They come in two flavours – common cathode(upper diagram) and common anode(lower diagram):
lm5Uw

Pinout diagram:
4x7LED2

As You see, it is enough to put a resistor on each digit common pin (12, 9, 8 or 6) and we have limited current to desired value. I used 5V logic and 220ohm resistors, I = U/R = 5/220 = 23mA.

First prototype was mini breadboard on top of Arduino UNO:

P1080876sm2

The schematic:
4x7LED_berryjam

Next thing is code

This code was written for common anode version, if You have common cathode just swap “0” and “1” in program code. I intentionally separated first digit (meters) from centimeters, so my second digit in this program is always off (digit value = 10). Everything else is pretty straightforward, but if You have questions ask them in comments.

I needed additional functions like segment blinking, “Err ” and “- – – -” (no signal) symbols. You can add any imaginable functionality to it. After several tests I made second working prototype I’ll be using later in other projects:

P1080893-2sm

This Arduino Pro Mini has additional i2c control code inside (I have whole article about it) and acting like specialized LED driver IC, but is completely customizable and even cheaper (just 2.5$ if You buy it from ebay). Total cost of this i2c LED display is about 5$.

Short proof video:

Support

If I helped You, please help me. Thank You!

  • 2 Comments
    1. Pingback: Multiplexing vs Charlieplexing | All Things Tech

    2. Tek December 14, 2015 at 19:48

      So,…does this code describe a multiplexed setup, and if not, would you mind posting a multiplexed version to show how they code is different in each setup?

      Thanks so much for posting this! It has been *very* useful for learning this topic – *ESPECIALLY* the graphics made it *much* easier to understand the differences.

    Leave a Comment