Generalized 7 segment LED display driver

This is a set of patches for driving common-cathode 7 segment LED numerical display of arbitrary size from a “String” input; strings containing ASCII characters are also supported and will be more-or-less displayed within the limits of a 7 segment display.

Anode lines to all segments of each digit of the digits in the display are connected to the same ports via current-limiting resistors. Cathode port selection is implemented as a variadic patch node where you drag out the box and add as many output port numbers as digits you have and connect each segment’s cathode to those. The digits are multiplexed and scanned at user-defined frequency to reduce pin count.

Longer sequences of numerals or characters are also supported, if the size of the input text exceeds the number of physical characters in the display the text will be scrolled, like one of those LED message boards.

This is a first draft, video clip of it in action will follow along with revisions to follow but it should be more-or-less usable as is currently, I have a 2 digit red LED display up and running on a breadboard scrolling pretty nice right now!

7SegmentLED.xodball (25.0 KB)

4 Likes

It looks great, thanks for sharing :clap: :clap:

1 Like

Thanks, I tried a couple implementations, it still uses a bit more program memory than I’d like, if one doesn’t need to output “l33tspeek”-looking text to the display it can easily be reduced. Have to store the segment-mapping somewhere :slight_smile:

First little problem I’ve noticed that I’m going to try to patch up this week is that there are some small glitches in the display when it’s being sent the output of a counter from a “clock” and just counting up digits, and the behavior on my 2 digit display once the count exceeds the display width and it starts trying to “scroll” three digits to fit a 2 digit display is rather odd.

Pretty sure this is related to the input from the “UPD” node to update the display text, and the Timeout call to update the digit scan being unsynchronized so I’ll have to change the code a bit to synchronize them somehow. Just clearing the current interval timer and starting over when the “UPD” input is fired and the display buffer changed may be enough.

Revision 2 is ready, the first had a number of problems that have been fixed up now, including the glitching display issue. I changed the output nodes to output a pulse when the content of the display buffer changes plus a Text output of what it holds at a given time; this seems more useful for interfacing with other patch nodes than the generic “Done” pulse output when a transaction finishes it had before, you can have an “equals” node set to trigger when a given substring is detected and cause the display to do something else (I’ve done this in the example patch.) I’ve altered and cleaned up the character set a bit currently every letter of the alphablet should be more-or-less representable except for “X” so ah, just don’t use that one. :wink:

XOD 7 segment LED display patch in action

7SegmentLED_rev_2_11-22-18.xodball (39.4 KB)

4 Likes

I’m not good at C++, I can’t check the correctness of the code. An error occurs during compilation.
Uploading: 20230416_213057.jpg…

Thanks for sharing, I definitely implementing this.