FeatherClock

A compact MicroPython clock project

Latest Release: 1.3.0

 

About FeatherClock

FeatherClock is a project for the Adafruit Feather HUZZAH ESP8266 or the ESP32-based Adafruit Feather HUZZAH32, both running running MicroPython.

The HT16K33 Matrix Featherwing library in use

It is an attempt to replicate my Electric Imp clock project. It uses the Adafruit FeatherWing four-digit, seven-segment LED add-on, or the equivalent 16 x 8 matrix LED add-on.

Currently, the clock has no remote control, which the Electric Imp Platform makes very easy to implement, but is rather less so here. You can set preferences, though. Adding a web UI, served locally or remotely, lies in a future phase of the project.

The project makes use of the HT16K33-Python library.


Installation and Setup

  1. Install pyboard.py from GitHub.
  2. Install esptool.py using brew install esptool
  3. Running macOS Big Sur on Intel? You also need to do this:
    1. nano /usr/local/bin/esptool.py
    2. Comment out lines 56 to 61 inclusive
    3. Save the file
  4. Connect your assembled Feather Clock (Feather plus LED add-on).
  5. ls /dev/cu*
    1. Note the Feather’s device file path.
  6. Download the latest version of MicroPython. It will be a file named something like esp32-20210902-v1.17.bin.
  7. Update MicroPython:
    • For ESP32:
      1. esptool.py --chip esp32 --port <FEATHER_DEVICE_PATH> erase_flash
      2. esptool.py --chip esp32 --port <FEATHER_DEVICE_PATH> --baud 460800 write_flash -z 0x1000 esp32-20210902-v1.17.bin
    • For ESP8266:
      1. esptool.py --port <FEATHER_DEVICE_PATH> erase_flash
      2. esptool.py --port <FEATHER_DEVICE_PATH> --baud 460800 write_flash --flash_size=detect 0 esp8266-20210902-v1.17.bin
  8. cd featherclock
  9. Run ./install.sh <FEATHER_DEVICE_PATH>
  10. Press Enter to continue or Q to quit.
  11. Enter your WiFi SSID.
  12. Enter your WiFi password.
  13. After the code has copied, power-cycle your Feather Clock or press the RESET button.

Clock Settings

For now, the clock’s settings are applied by sending over a prefs.json file with any or all of the following values:

{ "mode":   <true/false>,   # 24-hour (true) or 12-hour (false)
  "colon":  <true/false>,   # Show a colon between the hours and minutes readouts
  "flash":  <true/false>,   # Flash the colon symbol, if it's shown
  "bright": 10,             # Display brightness from 1 (dim) to 15 (bright)
  "bst":    <true/false> }  # Auto-adjust for Daylight Saving Time

Having installed pyboard.py as above, you send over prefs file using:

pyboard.py -d <FEATHER_DEVICE_PATH> -f cp prefs.json :prefs.json

The install.sh script also copies this over.

To get <FEATHER_DEVICE_PATH>, you can add my Z Shell function dlist() to your .zshrc file. After restarting your terminal, you can run:

pyboard.py -d $(dlist) -f cp prefs.json :prefs.json

Source Code

You can view FeatherClock’s source code at GitHub.


Release Notes

  • 1.2.3 24 January 2023
    • Add experimental Trinkey RP2040 version.
    • Better resilience to WiFi connection loss.
    • Better log file management.
    • Update to latest HT16K33 drivers.
    • Archive ESP8266 version.
  • 1.2.3 23 February 2022
    • Add better help in install.sh.
    • Device-side errors now issued to log file.
    • Correct pyboard instructions.
  • 1.2.2 5 February 2022
    • Style install script errors.
    • Update esptool.py installation instructions.
    • Add dlist() link.
    • No application code changes.
  • 1.2.1 13 September 2021
    • Clarify installation instructions for ESP32 and ESP8266 boards.
    • Update install script.
    • No application code changes.
  • 1.2.0 26 August 2021
    • Fix for post time-check pauses.
    • Update install.sh to use MicroPython’s pyboard.py.
    • Update install.sh to copy prefs.json over if it is present in the working directory.
  • 1.1.0 3 December 2020
    • Revised code.
    • Added matrix display version.
  • 1.0.10 19 November 2020
    • Adds Feather Huzzah 32 version.
  • 1.0.9 29 September 2020
    • Improved RTC time checks.
    • Improved installation script.
  • 1.0.8 6 September 2019
    • Add installation script.
  • 1.0.7 25 April 2019
    • Added the loading of an on-device preferences file (prefs.json).
  • 1.0.6 13 April 2019
    • Added app preferences structure.
  • 1.0.5 10 April 2019
    • Corrected the months used for BST checking.
  • 1.0.4 9 April 2019
    • Various linting-suggested code improvements.
  • 1.0.3 8 April 2019
    • Improved RTC updates by making NTP checks.
  • 1.0.2 5 April 2019
    • Added regular RTC updates.
  • 1.0.1 4 April 2019
    • Added disconnection indicator to display.
    • Corrected constant usage.
  • 1.0.0 3 April 2019
    • Initial release.

Related Software


smittytonesmittytone
Site and software copyright © 2024, Tony Smith