I've purchased a mixed bag of random 7-segment displays and am trying to use a three digit 7-segment display marked as a "ELT-512HDB G C0019). For this I found the a datasheet with the pin diagram: https://www.digchip.com/datasheets/parts/datasheet/158/ELT-512HDB-pdf.php

From what I've gathered, I have eight cathodes per digit plus the dot and one anode for each 7-segment.

I'm quite new to electronics in general, so I struggle to understand how I can correctly display values on all three digits.

One digit is understandable. I have to identify which cathode represents which segment and then power the corresponding cathodes with 5V and connect the anode for the digit.

Do I have to set the regarding configuration for each digit and cycle through all of them in extremely quick succession? Is that achievable with a Raspberry Pi or an ESP32?


3 Answers 3


This task of yours is pretty much MCU-101. Almost everyone who has done anything with an MCU will have tackled this problem early in their learning period. It's classic and dates back 50 years or more. But people of all ages have faced this, so you'll get lots and lots of replies -- everyone of every age has had to do this at least once in their lives. And there are many web pages on the topic. More than enough to fill out a lifetime of reading, I suspect.

But perhaps the most solid book on the topic that dates back to about 1980 or so is from Hewlett-Packard and is called, "Optoelectronics: Fiber-Optics Applications Manual", 2nd edition. If you can find a copy, I'd highly recommend getting it as a reference text. It covers everything from louvers to polarization to longevity and includes scanning/multiplexing and/or direct drive.

Today, there are dozens of suppliers of hundreds of LED driver ICs. It's a real pain to manage hundreds or thousands of LED segments. Everyone knows it is and IC manufacturers have come out in droves to help out.

You will need (or want) to limit the current in each LED. That's either a resistor or else a current source/sink circuit. That by itself is a pain.

So you have a few approaches:

  1. Buy an IC for it. Some of the ICs will do all of the needed work to run some number of 7-segment displays for you. You can download the LED details you want into the IC and just let it run around in circles for you. They often include details like: LED shorted or LED open status, programmable or settable LED current limit, and so on.
  2. Multiplex your displays in software. Here you can run the displays one at a time, real fast, so that it appears that they are all on. However, you will need to run them at higher current so that their brightness "appears" about right. So this means a higher current and you need to check the datasheets to make sure they can handle the boost.
  3. Run out lots and lots of I/O pins so as to completely cover all the LED segments. This means an MCU with gobs of I/O pins. But if you have them available, then you do not need to multiplex and you can just use very simple software means.

You can get fancy. Sometimes you can work out details where not all of the LEDs have to be completely controllable, independent from each other. In other words, perhaps there are some "dependencies" that you can exploit. You may have two LEDs that are both on or both off but never any other case. You can make simplifications like that and get by with less. You can wire up LEDs in opposite polarity and run one, or the other, but not both at once using just two I/O pins. You should look up the ugly term, Charlieplexing, and find out more about various distinct arrangements that can actually be rather different from each other but are lumped under that term just the same.

Master this area and you've got half the battle won.

When I teach MCUs to students there are two starting subjects:

  1. Switch inputs: monitoring and debouncing dozens of inputs at once, including long-hold and short-hold times to differentiate various modes.
  2. LED outputs: displaying, multiplexing, and varying under software control the apparent brightness.

When a student has mastered both, I can pretty much release them into the wild and they will get along pretty well.

  • \$\begingroup\$ Thank you for this elaborate answer and background knowledge! I see I have a lot to learn :) \$\endgroup\$ Feb 2, 2021 at 11:47

Yes you’ve got the idea - for each digit you’ll set the anode high and pull the required cathodes low, then set the anode for the next digit and pull the cathodes for that digit and so on. You’ll need a current-limiting resistor of about 1k ohms for each cathode. The LEDs should be ok with a reverse voltage of 5V so you can leave all the micro pins set to be outputs and drive them high or low, or swap between input and output. You’ll want to scan each digit at least 10 times per second but 100 times per second will give much less flicker.


Yes, your understanding is correct, the digits are time-multiplexed.

It should be achievable with RPi or ESP32, but frankly the processors have also better things to do than to manully multiplex the digits in software. Every time there is another program or task or interrupt happening, the scanning is interrupted and it might look disturbing.

It would be best to use a chip that is meant to drive multiplexed 7-segment displays between the display and microcontroller, or program a low-end MCU to do such a task.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.