I am a total electronics noob trying to build a simple circuit for a jukebox that I'm making using a Raspberry Pi and an old jukebox wallbox. I'm a computer systems engineer by trade. And it's my first time asking a question on SE, So please go easy :)

I am integrating a Raspberry Pi with a 3 digit LED display. Each of the numbers uses a single ground across all 7 segments, and each segment is tied together on the numbers. (IE, the top segment is a common input across all three digits, and if I wanted to light it up on the first digit only I would connect the ground on the first digit only.) The Pi is capable of lighting up all 7 segments at a time on a single digit using GPIO, but that would be too much current to sink with a single ground GPIO on the Pi. I saw somewhere a recommendation that a ULN2803 could be used for switching common connections. By taking a GPIO high on the Pi it would connect the corresponding pin on the ULN2803 to common, completing the circuit. Basically acting as a solid state relay. So I got a small breadboard and some ULN2803APG and tried building the circuit with an LED. I have common from the breadboard bus connected to pin 9, and common from the LED going to pin 18, and the LED connected to the + bus. My understanding of how this should work is that when I take ULN2803 pin 1 high by connecting it to the power supply positive lead the LED should light because the ULN2803 is connecting the negative lead. But that doesn't happen. If I move the LED connection from ULN2803 pin 18 to common the LED will light, so I know the LED is good. But I have no idea why this isn't working. Do I have the wrong idea of how this should work? Or do I have the wrong ULN2803? Or am I too low voltage? Or am I doing something else wrong here?

For a ULN2803 pinout I'll reference this drawing: https://components101.com/asset/sites/default/files/component_pin/ULN2803-IC-Pinout.png

Hopefully I've explained everything well enough. The LED and keyboard work the same way with common grounds so I have to figure this out to be able to integrate with them. Altering them is out of the question, nothing good will come from trying to alter 40 year old PCB. Thanks for your help.

Here's my breadboard circut:
enter image description here

The eventual LED matrix that I need to integrate with: enter image description here

EDIT-- So I was partially mistaken... the LED does light, but it's so faint that unless you're looking straight on at it (IE, not from the side) you can't see it. Not sure what that means.

  • 6
    \$\begingroup\$ Would you be able to draw a diagram to explain how you wired it? While text might be unambiguous, it can get unwieldy and error-prone to describe a circuit connection-by-connection. \$\endgroup\$
    – nanofarad
    Commented Apr 12, 2021 at 2:14
  • \$\begingroup\$ I added images for both my breadboard and the LED board. \$\endgroup\$ Commented Apr 13, 2021 at 2:02
  • \$\begingroup\$ BTW, I am planning on driving each segment using a GPIO on the Pi. It has enough output on GPIO that I can light an entire digit at once using 7 GPIO, it just can't sink that much on a single GPIO. That's why I have to switch the low side \$\endgroup\$ Commented Apr 13, 2021 at 2:05
  • \$\begingroup\$ Your schematic is very good, because it explains almost everything. There si a couple of confusions: (1) You say you have "a 3 digit LED display", which might mislead readers that you have just one 3 digit LED display module which internally glued three 1 digit LED modules and might have special control/sync signals. Actually, to be precise, you have "Three independent 1-digit LED module', to continue, ... \$\endgroup\$
    – tlfong01
    Commented Apr 13, 2021 at 2:30

3 Answers 3


Sounds like a fun project!

You are right that it's a good idea to not drive the LEDs directly from the GPIO pins of the CPU. Yes, a ULN2803 works as 8 separate controllable switches between respective output pin and ground. (Input high means output is shorted to ground, input low means output is floating.)

The breadboard test you describe sounds like it ought to work (If I understand it correctly). It is unclear to me where the problem is. I think the next step would be for you to draw a schematic so we can see that we are talking about the same setup. (I also assume you have a resistor in series with the LED.)

However, once you get the ULN2803 setup working you will find that it doesn't solve all your problems (as others have pointed out).

The display you are describing is an LED matrix: one anode connection (+) for each segment and one cathode connection (-) for each digit. In a sense, the LED matrix is both "common cathode" and "common anode". (I think those terms are most often used to describe non-matrix displays where all anodes or cathodes are accessible individually.)

In a LED matrix like this typically only a single digit is lit at a time. If the digits are cycled rapidly enough, then persistence of vision makes all the digit appear as on at the same time.

Since you need to control both the anodes (segments) and the cathodes (digits), you need both a "high side switch" and a "low side switch". ULN2803 does nly the low-side part, but you can use a high-side counterpart IC (eg. UDN2901).

A different alternative is to use a LED matrix driver. It combines the high-side and low-side drivers, as well as intensity control. You usually talk to the matrix driver using a serial protocol (SPI).

Accidentally, I have been using such a driver myself in the last days for one of my projects. I ended up using AS1107W. It accepts 3.3 logic levels and can control up to 8 digits (7 segments + decimal point). The AS1106/AS1107 is pin compatible with another well known device, namely MAX7219/MAX7221. However, the MAX pars are 5V only.

The AS1107W might be hard to get hold of. You might be able to find some here: https://www.findchips.com/search/AS1107

  • \$\begingroup\$ If all pins of each segment are individually available, the MAX6950 works at 2.7–5.5 V. \$\endgroup\$ Commented Apr 12, 2021 at 19:10
  • \$\begingroup\$ I was planning on driving the high side directly from a GPIO on the Pi and using 3 more GPIO to switch the ground using the ULN2803 as the Pi can't sink that much on a single GPIO. That's what I'm trying to do anyway. \$\endgroup\$ Commented Apr 13, 2021 at 2:10
  • \$\begingroup\$ I added some diagrams of the current circuit and the LED panel. \$\endgroup\$ Commented Apr 13, 2021 at 2:21

Ah, ULN2803 is a 8-channel (low side switching) sink driver, for common anode LEDs.

For common cathode LEDs, you need the complement/mirror: UDN2981 (high side switching) 8-channel source drivers.

The following schematic might help to tell the difference between high side and low side switching.

h/l side switching


Appendix A - 7-segment LED Circuit Design v0.1

7 seg led cct v0.1

Appendix B - Using software switchable PSUs to replace UDN2981

Idea: one switchable PSU per LED.

switch psu

  • 2
    \$\begingroup\$ +1 for a direct answer with only one relevant link and diagram. \$\endgroup\$
    – Transistor
    Commented Apr 12, 2021 at 8:14
  • \$\begingroup\$ I don't think this answers the question. As I interpret it, the asker is switching both sides in a multiplexed arrangement, and the side where he wants to use the ULN, is the low side (so it looks more like common anode). \$\endgroup\$ Commented Apr 12, 2021 at 12:02
  • \$\begingroup\$ @user253751He mentions CA & CC driver ICS. \$\endgroup\$
    – Russell McMahon
    Commented Apr 12, 2021 at 13:14
  • 1
    \$\begingroup\$ #tlfong01, I cannot use another LED matrix. I am integrating this into something that has one inbuild that I cannot replace. I need to integrate with what's there. I can design a circuit to drive it, but I cannot replace it without a ton of effort. \$\endgroup\$ Commented Apr 14, 2021 at 17:25
  • 1
    \$\begingroup\$ The UDN2981A seems to be obsolete and unavailable. It's an excellent suggestion though. Any idea for a replacement? \$\endgroup\$ Commented Apr 14, 2021 at 17:29

For CA or Common Anode (+) digit drivers you need high side drivers for digits and low side current limited drivers for segments. like Pch FET or PNP for the high side and NPN or Nch for the low side.

The ULN series are Low side Darlingtons switches that rise 1.2V above ground. Common is often tied to V+ for flyback suppression of inductive loads, which suggests you are using CA LEDs.

For CC, Common Cathode (-) digits its just the reverse, low cathode digit driver-side and plus side current limited segments.

There are tons of examples on this site.


Your Answer

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

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