Workbench journal

HP Bubble Display Clock

Using an ESP32 to create a WiFi enabled smart clock, weather, and date device all while reviving these lovely little vintage HP displays.

Just a quick post here to show how I designed and created a little clock device that uses up the many 8-digit HP bubble displays I bought for a project long ago. I had originally used one to integrate with my RC2014 MircoComputer and worked out well. You can check that video out here.

To be sure, I am not altogether certain these exact displays are HP manufacturing, I see the HP ones documented in much smaller form factor and 4-digit mostly on the web when I look around. But I found these 8-digit same-technology displays on eBay some time back so here we are.

Every min: Time from 0 to 44 sec. At 45 sec shows date. At 50 sec shows temp in city.

I used Fusion 360 to design the device organically. I wanted also to make the device battery powered just because I am always trying to practice more with ion-lithium integration and power regulation in my projects.

The design of the circuit is very simple and uses two 74HC595 serial registers, daisy chained for 16 bit input, to control the 8 “segment” anodes and 8 “digit” cathodes of the device. It is vital to use either HC or HCT series 595(s) due to the current requirements of the segments.

Two 74HC595(s) and an ESP32 is all it takes to run this device other than power

A long while back I had to manually work out the pinouts of this particular 8-digit bubble display as there is no documentation I could find.

Working out the bubble display pinouts

I used a sliding circuit board module design because I felt it easiest to assemble and— should it ever be necessary— repair. A rare few things are designed to be reparable anymore!

Other such design features include some simple mid-century-modern-esque fluting on the sides for pure aesthetic and a hole around the rear for charging via USB. The esp32 does draw quite a bit of current when constantly polling the web for time etc. But I’ve used this setup in a design before and you can get a good 2-4 hour out of the device with an 18550 battery.

Very nice fitting modules. Thanks Fusion360 and Bambu 3d printers!

Below is the code that runs the device. I redacted my API keys and location but you can see where they would go. The clock is designed for American eyes ergo imperial units and mm/dd/yy date format. To the engineering world, I am terribly sorry for this— I ask God’s forgiveness every day.

Multiplexing was used which does affect overall brightness of the digits. But in order to make the displays usable at all with as few pins/resources as possible this was required. I tried to compensate for the lower brightness with very low current limiting resistors on the segment anodes (22 ohms).

In very bright daylight the device does get washed out and lowers visibility. But this device is planned to live in a moody, low-light indoor setting near the vinyl turn table for the *vibes*.

Thanks for reading!

/*------------------------------------------------------------------
  Bubble-Clock with Wi-Fi portal, TimeZoneDB & OpenWeatherMap data
  ESP32-WROOM-32 + HP 8-digit bubble (2×74HC595)
  — persistent portal params via NVS; exits portal after Save
------------------------------------------------------------------*/
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiManager.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <Preferences.h>

/* GPIO assignments */
constexpr uint8_t DATA_PIN   = 25;
constexpr uint8_t CLOCK_PIN  = 26;
constexpr uint8_t LATCH_PIN  = 27;

/* BASIC bubble-font (41 entries) */
static const uint8_t FONT[41] = {
  0,128, 63,  6, 91, 79,102,109,125, 7,
127,111, 95,124, 57, 94,121,113,111,116,
48, 30,117, 56, 21, 55, 63,115,103, 49,
109,120, 62, 62, 42,118,110, 91, 64, 83,
 2
};

/* ASCII→7-seg */
static inline uint8_t asciiToSeg(char c){
  int16_t C = uint8_t(c);
  if      (C==45) C+=78;
  else if (C==63) C+=61;
  else if (C==39) C+=86;
  else if (C==44) C+=2;
  if (C>96)  C-=32;
  if (C>64)  C-=7;
  if (C==46) C+=1;
  else if (C==32) C+=14;
  C -= 46;
  return (C<0||C>40)?0:FONT[C];
}

/* Display buffer & driver */
uint8_t dispBuf[8];

static inline void latch595(){ digitalWrite(LATCH_PIN, HIGH); digitalWrite(LATCH_PIN, LOW); }
static inline void send16(uint8_t cath, uint8_t seg){
  shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, cath);
  shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, seg);
  latch595();
}
static inline void refreshDisplay(){
  static uint8_t d = 0;
  uint8_t hw = 7 - d;
  uint8_t cath = uint8_t(~(1U << hw));
  send16(cath, dispBuf[d]);
  d = (d + 1) & 7;
}
static inline void displayText(const char* s){
  for(uint8_t i=0;i<8;++i){
    dispBuf[i] = (s[i]=='*') ? 0b01100011 : asciiToSeg(s[i]);
  }
}

/* ------------------ Persistent config (NVS) ------------------ */
char bufApiKey[48];   // TimeZoneDB key
char bufZone[48];     // e.g. "America/New_York"
char bufOwmKey[48];   // OpenWeatherMap key
char bufOwmCity[48];  // e.g. "New York,US"

// First-boot display defaults (not written unless user saves)
static const char* DEF_API  = "YOUR*TIMEZONEDB*APIKEY*HERE";
static const char* DEF_ZONE = "America/New_York";
static const char* DEF_OWM  = "YOUR*OWM*APIKEY*HERE";
static const char* DEF_CITY = "New York,US";

Preferences prefs;
static const char* NVS_NS = "bubblecfg";

static inline void copyStringToBuf(const String& src, char* dst, size_t n){
  size_t len = min(n-1, (size_t)src.length());
  memcpy(dst, src.c_str(), len);
  dst[len] = '\0';
}

static void loadConfig(){
  prefs.begin(NVS_NS, true);
  auto getOr = [&](const char* key, const char* dflt, char* out, size_t n){
    String v = prefs.isKey(key) ? prefs.getString(key) : String(dflt);
    copyStringToBuf(v, out, n);
  };
  getOr("tzdb_key",  DEF_API,  bufApiKey,  sizeof(bufApiKey));
  getOr("tzdb_zone", DEF_ZONE, bufZone,    sizeof(bufZone));
  getOr("owm_key",   DEF_OWM,  bufOwmKey,  sizeof(bufOwmKey));
  getOr("owm_city",  DEF_CITY, bufOwmCity, sizeof(bufOwmCity));
  prefs.end();
}

static void saveConfig(){
  prefs.begin(NVS_NS, false);
  prefs.putString("tzdb_key",  bufApiKey);
  prefs.putString("tzdb_zone", bufZone);
  prefs.putString("owm_key",   bufOwmKey);
  prefs.putString("owm_city",  bufOwmCity);
  prefs.end();
}

/* ------------------ Time & weather state ------------------ */
uint16_t baseYear;
uint8_t  baseMonth, baseDay, baseH, baseM, baseS;
unsigned long lastTimeFetch = 0;

static bool fetchTime(){
  if(!strlen(bufApiKey) || !strlen(bufZone)) return false;
  String url = String("http://api.timezonedb.com/v2.1/get-time-zone?key=")
             + bufApiKey + "&format=json&by=zone&zone=" + bufZone;
  HTTPClient http; http.begin(url);
  if(http.GET()!=200){ http.end(); return false; }
  StaticJsonDocument<1024> doc;
  DeserializationError e = deserializeJson(doc, http.getString());
  http.end();
  if(e) return false;
  String f = doc["formatted"] | "";
  if(f.length()<19) return false;
  baseYear  = f.substring(0,4).toInt();
  baseMonth = f.substring(5,7).toInt();
  baseDay   = f.substring(8,10).toInt();
  baseH     = f.substring(11,13).toInt();
  baseM     = f.substring(14,16).toInt();
  baseS     = f.substring(17,19).toInt();
  lastTimeFetch = millis();
  return true;
}

float ambientF = 0;
unsigned long lastWxFetch = 0;

static bool fetchWeather(){
  if(!strlen(bufOwmKey) || !strlen(bufOwmCity)) return false;
  String url = String("http://api.openweathermap.org/data/2.5/weather?q=")
             + bufOwmCity + "&appid=" + bufOwmKey + "&units=imperial";
  HTTPClient http; http.begin(url);
  if(http.GET()!=200){ http.end(); return false; }
  StaticJsonDocument<1536> doc;
  DeserializationError e = deserializeJson(doc, http.getString());
  http.end();
  if(e) return false;
  ambientF    = doc["main"]["temp"] | 0.0f;
  lastWxFetch = millis();
  return true;
}

/* ------------------ Setup ------------------ */
void setup(){
  pinMode(DATA_PIN,OUTPUT);
  pinMode(CLOCK_PIN,OUTPUT);
  pinMode(LATCH_PIN,OUTPUT);

  loadConfig(); // fill buf* from NVS or display defaults

  WiFiManager wm;
  // Build params AFTER loadConfig so portal shows saved values
  WiFiManagerParameter pApiKey ("tzdb_key",  "TimeZoneDB Key",  bufApiKey,  sizeof(bufApiKey));
  WiFiManagerParameter pZone   ("tzdb_zone", "TimeZoneDB Zone", bufZone,    sizeof(bufZone));
  WiFiManagerParameter pOwmKey ("owm_key",   "OWM Key",         bufOwmKey,  sizeof(bufOwmKey));
  WiFiManagerParameter pOwmCity("owm_city",  "OWM City",        bufOwmCity, sizeof(bufOwmCity));
  wm.addParameter(&pApiKey);
  wm.addParameter(&pZone);
  wm.addParameter(&pOwmKey);
  wm.addParameter(&pOwmCity);

  bool portalSaved = false;
  wm.setSaveParamsCallback([&](){ portalSaved = true; });
  wm.setBreakAfterConfig(true);      // return immediately after Save
  wm.setConfigPortalTimeout(180);    // optional safety timeout

  // Try to connect for ~10s while showing countdown
  WiFi.begin();
  for(int t=10; t>=0; --t){
    char tmp[9]; snprintf(tmp, sizeof(tmp), "CONN-%02d", t);
    displayText(tmp);
    unsigned long t0 = millis();
    while(millis()-t0 < 1000) refreshDisplay();
    if(WiFi.status()==WL_CONNECTED){
      unsigned long end = millis()+2000;
      while(millis()<end){ displayText("GOOD    "); refreshDisplay(); }
      break;
    }
  }

  // If not connected → portal
  if(WiFi.status()!=WL_CONNECTED){
    unsigned long end = millis()+2000;
    while(millis()<end){ displayText("CONFIG  "); refreshDisplay(); }
    wm.startConfigPortal("BubbleClockConfig"); // returns on Save/timeout
  }

  // Only persist if user actually pressed Save; do not overwrite with blanks
  if(portalSaved){
    auto copyIfSet = [](char* dst, size_t n, const char* src){
      if(src && src[0]){ strncpy(dst, src, n-1); dst[n-1]='\0'; }
    };
    copyIfSet(bufApiKey,  sizeof(bufApiKey),  pApiKey.getValue());
    copyIfSet(bufZone,    sizeof(bufZone),    pZone.getValue());
    copyIfSet(bufOwmKey,  sizeof(bufOwmKey),  pOwmKey.getValue());
    copyIfSet(bufOwmCity, sizeof(bufOwmCity), pOwmCity.getValue());
    saveConfig();
  }

  fetchTime();
  fetchWeather();
}

/* ------------------ Loop ------------------ */
void loop(){
  unsigned long now = millis();
  if(now - lastTimeFetch > 300000UL) (void)fetchTime();
  if(now - lastWxFetch  > 1800000UL) (void)fetchWeather();

  unsigned long elapsed  = (now - lastTimeFetch)/1000UL;
  unsigned long totalSec = baseH*3600UL + baseM*60UL + baseS + elapsed;
  uint8_t h = (totalSec/3600UL)%24, m = (totalSec/60UL)%60, s = totalSec%60;

  enum { SHOW_TIME, SHOW_DATE, SHOW_TEMP };
  uint8_t mode = (s < 45 ? SHOW_TIME : (s < 50 ? SHOW_DATE : SHOW_TEMP));

  static int8_t lastMode = -1, lastSec = -1;
  if(mode==SHOW_TIME){
    if(mode!=lastMode || s!=lastSec){
      int h12 = h%12; if(!h12) h12=12;
      char txt[9]; snprintf(txt, sizeof(txt), "%02d.%02d.%02d", h12, m, s);
      displayText(txt);
      if(h>=12) dispBuf[7] |= 0x80;  // PM dot
      lastSec = s;
    }
  }else if(mode==SHOW_DATE){
    if(mode!=lastMode){
      int yy = baseYear % 100;
      char txt[9]; snprintf(txt, sizeof(txt), "%02d-%02d-%02d", baseMonth, baseDay, yy);
      displayText(txt);
    }
  }else{ // SHOW_TEMP
    if(mode!=lastMode){
      int ti = int(ambientF + 0.5f);
      char txt[9]; snprintf(txt, sizeof(txt), " %3d*F  ", ti);
      displayText(txt);
    }
  }
  lastMode = mode;

  // ~1 kHz frame (16 kHz/digit)
  static unsigned long tDisp = 0;
  if(micros() - tDisp >= 62){ refreshDisplay(); tDisp = micros(); }
}

/* ------------------ Optional factory reset helper ------------------ */
/*
void factoryReset(){
  prefs.begin(NVS_NS, false);
  prefs.clear();
  prefs.end();
}
*/
, , ,

6 responses to “HP Bubble Display Clock”

  1. […] Among them were HP’s bubble displays, assemblies of miniature LEDs on a PCB, topped with plastic bubble lenses. If you had a calculator in the 1970s it probably had one, but in the present, [Joshua Coleman] has incorporated one into a pleasingly retro digital clock. […]

  2. […] Entre eles estavam as exibições de bolhas da HP, conjuntos de LEDs em miniatura em um PCB, coberto com lentes plásticas. Se você tivesse uma calculadora na década de 1970, provavelmente tinha uma, mas no presente, [Joshua Coleman] incorporou um em um relógio digital agradavelmente retrô. […]

  3. […] Among them were HP’s bubble displays, assemblies of miniature LEDs on a PCB, topped with plastic bubble lenses. If you had a calculator in the 1970s it probably had one, but in the present, [Joshua Coleman] has incorporated one into a pleasingly retro digital clock. […]

  4. […] Among them were HP’s bubble displays, assemblies of miniature LEDs on a PCB, topped with plastic bubble lenses. If you had a calculator in the 1970s it probably had one, but in the present, [Joshua Coleman] has incorporated one into a pleasingly retro digital clock. […]

  5. […] spotted by Hackaday, this cool project was the idea of Joshua Coleman. Joshua had a few HP bubble displays sitting around after a different project, and instead of […]

  6. […] lo trillado por Hackadayeste esquema maravilloso fue la idea de Joshua Coleman. Joshua tenía algunas pantallas de burbujas HP sentadas luego de un esquema diferente, y en […]

Leave a Reply