3. 14-Segment Alphanumeric LED and ATtiny Microcontroller

(article continued from previous page)

Although this project refers to the All Electronics (CAT# DSY-1) multifunction LED display, the LED font is applicable to other alphanumeric displays as well. And, the serial-to-parallel code created for the ST2225A should be fairly close to other similar devices, such as the PS035, PS045M, M5480, M5481, MM5480, and SDA2131-2.

Alphanumeric LED Font

The bits sent to the Lite-On LTM-Y2K19JF-03 multifunction display control individual LED segments. That is, you can’t simply send the numeric value 8 and expect to see a visual '8' symbol appear on a 7-segment numeric display. Instead, you must send 127 (which is 1111111 in bits) because the image of a number '8' requires all of the numeric LED segments be turned on.

It would be nasty to hardcode LED segment values in every string or number that you want to display. Instead, store a const array with all of the segment bit values and have a subroutine look up each character to translate it when it is drawn on the display.

The LED segment bit codes for '0' to '9' on a 7-segment numeric LED aren’t hard to calculate by hand. But, figuring out 96 ASCII characters for a 14-segment alphanumeric LED is a job for an automated tool.

Using Microsoft Excel to convert an LED character bitmap (the letter 'M' in this case) into a 14-segment alphanumeric LED bit code.

Using Microsoft Excel to convert an LED character bitmap (the letter ‘M’ in this case) into a 14-segment alphanumeric LED bit code.

A spreadsheet can be created in Microsoft Excel to translate 'x' marks into '0'/'1' bits by using an IF command for each segment:

=IF(W414="x", "1", "0")

Then, a CONCATENATE command can combine those '0'/'1' bits into a 16-bit value (unsigned short) that can be copied and pasted into C.

=CONCATENATE("0b","00",AF413,AG415,AF417,AH416,AJ417,etc)

After perfecting the formula for converting one character, those spreadsheet rows can be copied 96 times so that the entire LED font can be stored in a single spreadsheet. This makes it easy to alter the font and have it instantaneously generated into a C array.

A 14-segment alphanumeric LED font.

A 14-segment alphanumeric LED font.

As you can see, most 14-segment LED characters are fairly recognizable. However, some of the symbols and lower case letters are slightly cryptic. Also, because the LTM-Y2K19JF-03 lacks decimal points, the period and exclamation mark suffer.

Driving an LED Display with an Atmel AVR ATtiny

All of the code required to use the Lite-On LTM-Y2K19JF-03 (and theoretically any simpler display driven by an ST2225A chip) fits into less than 2K and requires only 2 pins.

With only a 1 MHz internal CPU oscillator, the complete LED display refresh rate is 276 Hz with absolutely no noticeable flicker. This rate is overkill, and the processor could spend time doing other things and still provide a nice 100 Hz refresh. Or, the internal CPU oscillator could be bumped to 8 MHz to provide even more processing capacity between 36-bit bursts.

An Atmel ATtiny85 microcontroller on a solderless breadboard for running a multifunction LED display.

An Atmel ATtiny85 microcontroller on a solderless breadboard for running a multifunction LED display.

This photograph of a solderless breadboard shows how easy it is to hook up the Atmel ATtiny chip (or any other microcontroller) to the multifunction LED display. It only needs a 5V power supply, a 0.1 µF capacitor for smooth operation, and two pins (clock and data).

This setup also includes a test pushbutton to scroll through the character set. The ATtiny chip uses its built-in pull-up resistor so that the input pin normally has a high value. When the pushbutton is pressed, the pin is grounded and the microcontroller can detect the button press. The software includes a debounce routine to ignore noise spikes during button contact and release.

Although I used an ATtiny85, this code fits and runs on an ATtiny25 or ATtiny45 as well.

Atmel Source Code, Excel Spreadsheet, and LED Segment Layout

Hopefully this article provided enough information for you to successfully use these $1 LED displays. However, if you’d like to save yourself some time, I have original source files available for your own personal use (subject to legal details).

For $10 through PayPal, I will email you a zip file containing: