WiFiChron support for 16-segment LED display

This is the second time I am writing this post. First time it just disappeared after almost 2 hours of editing. I started the post by saying that whenever I want to have some electronics fun, I open one of my drawers. Nice story line, but I am too frustrated now to recreate it from memory. (The lesson I learned is that I should write it first as a document, save locally, then copy and paste into a blog post.)

So I will keep it short and dry.

Some time ago, I designed this "4-character 16-segment 1-inch LED" board (pictured below), briefly mentioned here. I abandoned it, after a couple of failed tries, while writing the character definitions. Since then I discovered the Adafruit 4-char alphanumeric LED backpack, which comes with nice software support as well.

For WiFiChron, two cascaded modules make an 8-character display functionally similar to HDSP-2534, but bigger and more visible. With the "Display Abstraction Layer" already in place, software support should be easy to integrate, since controlling it with the HT16K33 breakout allows the re-use of the above mentioned Adafruit LED backpack library. For maximum compatibility, I followed the same wiring, then connected the two extra segments, A2 and D2, to pin 10 (not connected for the 14-segment backpack) and pin 11 (connected to the DP), respectively.

I added a new class, Alphanum8x16, to the original files (Adafruit_LEDBackpack.h and cpp) to cover the extra segments:

class Alphanum8x16 : public Adafruit_AlphaNum4
  void writeDigitAscii(uint8_t n, uint8_t ascii);

void Alphanum8x16::writeDigitAscii(uint8_t n, uint8_t a)
  uint16_t font = pgm_read_word(alphafonttable+a);
  displaybuffer[n] = font;

  // this is the Adafruit mapping of digits to segments:
  // 0 DP N M L K J H G2 G1 F E D C B A
  // this is the 16 seg mapping of digits to segments:
  // A2 D2 N M L K J H G2 G1 F E D1 C B A1
  // bits:
  // 1  1  1 ...                 ...  1 0
  // 5  4  3        ....              1 0
  // Note: DP is not connected/controlled for the 16 seg;

  // if A1 (bit 0) is on, set A2 (bit 15) as well;
  if (font & 1)
    displaybuffer[n] |= 0x8000;

  // if D1 (bit 3) is on, set D2 (bit 14) as well;
  if (font & 8)
    displaybuffer[n] |= 0x4000;

I will post some photos later.

[original story: Wise time with Arduino]

Wise time with Arduino 14 Apr 02:15