Skip to content

binary_clock

Iain Prior edited this page Mar 25, 2024 · 2 revisions

The binary_clock module is designed to display the time in a binary format. It loads a UI on a touchscreen.

UI

The UI looks like this:

20240307_164201

The user can tap the screen to show and hide the decimal representation of the time that is shown underneath.

Time source

The time is sourced from the internal clock: localTime = time.localtime(time.time() + self.UTC_OFFSET)

This module relies on the ntptime micropython module to set the internal clock correctly. It syncs time on boot from the "0.nz.pool.ntp.org" ntp server (Hardcoded)

Time Zone Support

The UTC_OFFSET is used to adjust the time to the local time zone. It is currently hardcoded.

UTC_BASE_OFFSET = 12 * 60 * 60
UTC_OFFSET = 12 * 60 * 60

Daylight Savings Time

This module has very primitive (date based) support for daylight savings time. It is currently hardcoded.

    if (doy < 92 or doy > 268): # 2 April, 25 Sept
        self.UTC_OFFSET = self.UTC_BASE_OFFSET + 3600

Hardware / Pinout

The hardware I used when developing this module was this screen, designed for the D1 Mini: https://www.aliexpress.com/item/32919729730.html

"TFT 2.4 Touch Shield V1.0.0 for LOLIN (WEMOS) D1 mini 2.4" inch 320X240 SPI Touch Screen ILI9341 XPT2046"

I used a S2 Mini as the main controller: https://www.wemos.cc/en/latest/s2/s2_mini.html

I 3d printed a case to hold the screen: Thingiverse Link

310735729-ee49e668-32dc-4cbf-a6f7-31d6b1ebdeca

Configuration

At the moment there are no config options for this module. All the pins are hardcoded.

Telemetry provided

This module provides no telemtry data for other modules to use.

Telemetry consumed

This module consumes no telemetry from other modules.

Commands provided

This module does not provide any commands to other modules.

Commands consumed

This module responds to touch commands. If the screen is touched, it toggles the display of the time in decimal format.

Commands:

  • /touch - This command toggles the display of the time in decimal format.
Clone this wiki locally