Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

MatrixClock 2.2.11

An Electric Imp imp001-based digital clock using four Adafruit 8x8 LED matrix displays based on the Holtek HT16K33 controller, embedded in a custom laser-cut acrylic case.


The Matrix Clock in use



The Matrix Clock circuit design

The circuit shown is idealised. Power comes from the imp breakout board’s USB port (VIN). In practice, you will want to re-position the imp relative to the LED matrices, and I added to barrel jack power ports in parallel and positioned so that you can run a cable into the top of the clock or up to its base, depending on where you plan to site the clock. The jacks were wired directly to the GND and power rails, and from there to the imp board’s P+ and P- panels. The jumper on the board was adjusted accordingly.


If you use the laser-cut casing, make sure you first place the faceplate face down, fit the LED matrices into the cut-out correctly, and then use a glue gun to fill the gaps between the faceplate and the matrices’ circuitboards, which overhang the LEDs by approximately 5mm. This will hold them in place while you assemble the circuit — you can then slot LEDs into the board, add the side plates and finally glue on the backplate.


You’ll need to visit Electric Imp to sign up for a free developer account. You will be asked to confirm your email address.

Visit Electric Imp’s Getting Started Guide to learn how to configure your imp001 to access your local WiFi network, and how to enter code into impCentral and run it on your device.

The application code makes use of a number of components not all of which are included in the device and agent code listings. You can spot these external components by looking for the #import statements by which they are referenced. You can use a tool like Squinter or impt to ‘compile’ these parts into complete device and agent code, and upload it to the Electric Imp impCloud™. Alternatively, you can simply copy and paste the contents of the files names in the #import statements into the main code blocks, then copy and paste this code into impCentral™, Electric Imp’s online IDE.

Not all of the required components are included in this repository: they are not specific to this application. Only the files matrixclock_ui.html and HT16K33MatrixCustom.class.nut are included here. The other components can be found in these repositories:


UK/US Usage

The Matrix Clock device code is currently hardwired for UK usage: it adjusts to British Summer Time (BST) and back to Greenwich Mean Time (GMT) as appropriate. To do so, it makes use of my Utilities library and its bstCheck() function. This call can be replaced with the dstCheck() function if you wish to use a Matrix Clock in the US. This change will cause the clock to adjust to US Daylight Savings Time. The code can readily be adapted to match other territories’ daylight savings periods.

Control UI

The Matrix Clock can be controlled by accessing its agent URL:

The Matrix Clock web-based UI

Night Mode

Version 2.1.0 introduces a new option: night mode. Using night mode, which is enabled or disabled through the web UI, the clock will power down its display overnight. This can be useful if you don't like the clock filling the room with light at night. Even with the LED brightness set to minimum, it will generate a lot of illumination in a darkened room. You may find this unappealing, especially if the clock is placed in a bedroom, and night mode allows you to deal with this without having to manually turn off the display at nighttime.

When you enable night mode in the UI, the clock turns off the display automatically at a time you specify. It then turns on the display at a subsequent time. You set these times — respectively, night start and end — in the UI using 24-hour clock values. The default values are: start 22:30, end 07:00.

You can still turn the clock display on (or off) during unlit (or lit) periods using the UIs ‘Turn Display On/Off’ button.


You can use the file clock.svg to produce a simple laser-cut case/mounting frame for the Matrix Clock.

Matrix Clock

Release Notes

  • 2.2.11 18 November 2021
    • Bug fixes.
  • 2.2.10 06 August 2020
    • CSS improvements fo web UI.
  • 2.2.9 21 May 2020
    • Update JQuery to 3.5.x.
    • update Bootstrap to 4.5.x.
    • Update included repo names.
  • 2.2.8 26 February 2020
    • Support HT16K33Matrix 3.0.0, Bootstrap 4.4.1.
    • Discover displays on the I2C bus and use the detected addresses.
      • Deals with alternatively wired hardware, provided the display’s LED are addressed in left-to-right ascending order.
      • Include fallback configuration in case there is an error.
  • 2.2.7 18 December 2019
    • Support Rocky 3.0.0.
  • 2.2.6 22 October 2019
    • Fix incorrectly named variables in clearAlarm() and stopAlarm().
    • Alarm table CSS fixes and minor changes.
  • 2.2.5 5 September 2019
    • Support polite deployments
    • Update Jquery to 3.4.1, Boostrap to 4.3.1, Simpleslack to 1.0.1, Bootmessage to 2.2.2
  • 2.2.4 18 April 2019
    • Update JQuery to 3.4.0
  • 2.2.3 6 March 2019
    • Add low, mid and high brightness icons to the web UI
    • Update dependencies: HT16K33MatrixCustom/HT16K33Matrix 2.0.0
  • 2.2.2 18 February 2019
    • Sync device and agent code with Clock
    • Add API debugging
    • Remove redundant agent-side result checks
  • 2.2.1 30 January 2019
    • Refresh web UI logo
  • 2.2.0 19 December 2018
    • Add visual alarms
  • 2.1.0 3 December 2018
    • Add an option to automatically turn off the clock display overnight
    • Add an option to switch display between black on green and green on black
    • Improve UI layout
    • Update matrix LED class
  • 2.0.0 1 November 2018
    • Update dependencies
    • Restructure API to use JSON
    • Improved Apple Watch Controller support
    • Improved error handling
    • Improved settings handling
    • Improved web UI code
  • 1.6.0 11 September 2018
    • Add Advanced Settings area to UI; move Reset button into it; add Debug checkbox
  • 1.5.0 7 June 2018
  • 1.4.0
    • Bring dependencies up to date
  • 1.3.0
    • Add support for world time display, including web UI controls
    • Add favicon and iOS home page icon
  • 1.2.0
    • Add web UI controls
  • 1.1.0
    • Initial public release


The design and software for Matrix Clock are made available under the MIT Licence.

Copyright © 2021, Tony Smith


Retro style matrix LED clock based on the Electric Imp Platform







No packages published