Multiplexing 7-Segment Display with Raspberry Pi

When working with multiple 7-Segment displays a multiplexing scheme is required in order to simplify the design and save Raspberry Pi I/O pins. Such implementations shown in this design. As can be seen from a schematic diagram 2 7-Segment displays are controlled by Raspberry Pi. All segments are connected in parallel with current limiting transistors to Raspberry Pi board.

Multiplexing 7-Segment display with Raspberry Pi Schematic

By switching repeatedly ON and OFF left and right 7-Segments fast enough via BS170 transistor both digits appear to be constantly visible. This implementation can easily be extended to include more digits without adding to much complexity to the circuit. If you decide to modify the attached Python code do not increase too much the delay between enabling each digit. 50ms is the max that still produces an acceptable result. Above it will cause the display to flicker. I’ve added a simple 0-99 counter to show how the multiplexing works. 1 sec time base is also derived from multiplexing function. Showing 2 digits takes 20ms so if you count 50 of these cycles you’ll get 1 sec for the counter.
Multiplexing-7-Segment-display-with-Raspberry-Pi-Board