Friday, August 14, 2020

Alternative displays for HDSP or WiFiChron clocks

So you would like to build your own HDSP clock or WiFiChron clock but you find the HDSP-2534 display too small or too expensive. Why not just replace it with a bigger 8-character display, like the 1-inch 8 x 16-segment or two cascaded Adafruit 0.54" 4 x 14-segment backpacks? We have you covered, in software. Both these displays are now supported, as extension classes of the DAL (Display Abstraction Layer), together with the 128x64 I2C OLED and the HT1632-based 32x8 LED matrix display (used to be from Sure  Electronics). Support could be further extended to LCD displays (think big font on 40x4), MAX6955 with 8 x 16 segment etc., basically anything that can show 8 alphanumeric characters (numbers only, like regular Nixie tubes, would not suffice).

Below are some examples.

Two Adafruit 4-character backpacks are connected on I2C, addresses 0x70 (default) and 0x71, handled by class DisplayAda14seg, which in turn uses the Adafruit_LEDBackpack library.

To enable this display, uncomment the line (in DAL.h, comment out the rest):
#define DISPLAY_ADA_14SEG  // 2 x Adafruit 4x14seg displays;

Functionality for the 8x32 (or 16x32) LED matrix display is implemented in class DisplayHT1632, which is based on code recycled from Wise Clock 4. To enable this display, simply uncomment the line (in DAL.h, comment out the others):
#define DISPLAY_HT1632	 // Sure 8x32 LED matrix controlled by HT1632;

To accommodate the 8 characters on a 32-pixel line, fontTiny had to be used (each character is 4 pixels wide).

Note the connections for the HT1632 display (in DisplayHT1632.cpp):
#define HT1632_DATA 4 // Data pin (pin 7 of display connector)
#define HT1632_CS         3      // Chip Select (pin 1 of display connnector)
#define HT1632_WRCLK 2 // Write clock pin (pin 5 of display connector)
#define HT1632_CLK 5 // clock pin (pin 2 of display connector)

Other possible definitions in DAL.h are:
// Define the display you wish to use here.
// Comment out the ones not used.

//#define DISPLAY_HDSP2534	// original HDSP-2534 display in HDSP clock;
//#define DISPLAY_HUB08		// TODO: 8x32 LED matrix display with cascading shift registers (?)
//#define DISPLAY_DL1414	// 2 x DL1414; tested June 23, 2018 (
//#define DISPLAY_HT16K33	// my 8x16-segment driven by HK16K33, tested Jul 26, 2020;
//#define DISPLAY_OLED		// I2C OLED; tested
  #define DISPLAY_HT1632	// Sure 8x32 LED matrix controlled by HT1632; tested Aug 14, 2020;
//#define DISPLAY_MAX6955	// TODO: 8x16 segment driven by MAX6955
//#define DISPLAY_LCD1602	// TODO: classic LCD 16x2 (or better 40x4, with big font);
//#define DISPLAY_ADA_14SEG	// 2 x Adafruit 4x14seg displays, wired on 0x70 and 0x71 I2C addresses; tested Jul 26, 2020;

// show time on the 60-pixel Adafruit Neopixel ring;
//#define _ADD_NEOPIXEL_

And so on.