Skip to content

World-time clock combined with meteo station. All in Rust.

Notifications You must be signed in to change notification settings

gergelyk/retro-clock

Repository files navigation

Retro Clock

Prototype of a clock combined with meteo station.

Features

🕑 Local Time

  • Auto-detect timezone
  • Synchronize to NTP server

🌐 Word Time

  • User-defined aliases for time zones
  • Configurable through web UI

🌦 Current Weather

  • Provide live data from dozens of Catalan meteo stations
  • Configurable through web UI

🔭 Weather Forecast

  • Auto-detect coordinates
  • Forecast for current and the following day

💡 Adaptive Illumination

  • Brightness automatically adjusted to the ambient
  • Controls indicators and LCD background light

🛜︎ Configuration Over WiFi

  • Self-hosted Web UI
  • Domain in the local network provided by mDNS
  • Access Point mode for initial configuration

🕹 Simple Controls

  • Busy & error indicators
  • Device controlled by a single button
  • Buzzer imitating clicking sound

🦺 Failure Resistance

  • Restore WiFi connection after it's lost
  • Switch to battery and energy-safe mode when power is gone

🔒 Data Safety

  • Support HTTPS/TLS with safely distributed root CA certificate
  • Password protected Web UI with JWT-based session

Implementation

Project consists of two parts:

Embedded Application

Weather Web Service

Located in this repository

Located in: weather-data-aggregator

Everything built entirely in Rust! Including host-based simulator and development script ./dev.rs.

Hardware built from WEMOS S3 Mini, popular HD44780 display and some other parts.

System Overview

Documentation

Setup

  • Install toolchains/targets as described in retro-clock-esp and retro-clock-webui.

  • Install the tools below. Some of them is used only be selected commands of ./dev.rs and can be skiped if not needed:

    General tools:
    (possibly already in your system)

    For Web UI development:


    For intertacting with ESP32:

  • Optionally install and start mDNS client, e.g. avahi. It is useful for resolving retro-clock.local domain. If you are under Ubuntu, it's probably done already.

  • Setup environment (unless already done):

    # Certificate for TLS for HTTP server in `retro-clock-esp/certs`
    ../dev.rs new cert
    
    # Set env vars in `.env`, this includes secrets
    ./dev.rs new env

    .env file is automatically loaded by ./dev.rs script whenever it is invoked. .env doesn't need to be sourced, unless you work in the individual sub-directories without ./dev.rs.

Building & Running

  • Invoke one of the commands below:

    # Host-based simulation limited to core functionality with Web UI served locally
    ./dev.rs run sim
    
    # Application run in ESP32 target with Web UI served from the device
    ./dev.rs run esp
    
    # Application run in ESP32 target with Web UI served from the host
    ./dev.rs run mix
  • Web browser will be opened at corresponding Web UI URL.

  • For more details on ESP32 usage refer to retro-clock-esp.

Development

After each change:

  • Fix formating and linting issues:

    ./dev.rs fmt
    ./dev.rs cmd clippy
  • Run the application and check heap usage while interacting with the app:

    ./dev.rs run esp -s
    ./dev.rs plot heap
  • Use Bruno as an alternative to the Web UI for interacting with the device or simulator. For more details see Bruno Usage.

Releasing & Deploying

  • Make sure that .env doesn't contain any temporary data. It's best to generate a new one: ./dev.rs new env
  • Build the application in release mode and upload to ESP32 target:
    ./dev.rs run esp --release
  • For more details on ESP32 usage refer to retro-clock-esp.

About

World-time clock combined with meteo station. All in Rust.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages