Skip to content

Custom firmware for chinese 4 digit wall clock (BAIYANGSHU 1902 WIFI CLOCK)

Notifications You must be signed in to change notification settings

halacs/wallclock

Repository files navigation

ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!

You can find my blog post about this project here.

Summary

It is worth to change factory firmware on your clock under the name of "Baiyangshu 1902 Wifi Clock K2 02" if the always on Wifi access point bothers you too or the missing automatic day light saving capability or if you just simply want to use an open-source software you can extend with any features whenever you need something new.

Features of Halacs's firmware

  • Web user interface.
  • Wifi AP turns off after configuration.
  • NTP time synchronization. Server can be set via web UI.
  • Backup battery backed time source if NTP fails.
  • Optional blinking second LEDs.
  • Optional leading zeros.
  • Displaying numbers in a clever way.
  • Static brightness control.
  • Time zone management with automatic DST support.
  • OTA of Arduino IDE. Password is the same as the name of the AP.
  • Automatic brightness controll.
  • Syslog capabilities.
  • Drop down choice as time zone selector (instead of the current simple tex box)
  • Find out why firmware update via the web UI doesn't work.
  • Password protected web UI.
  • MQTT client capabilities

The Device

Hardware

The PCB is nice and clean, simple to program. Full schematic can be found here.

An ESP12-F microcontroller controls the display via a serial-to-paralel shift register array consists of four 74HC595D chip. Each segment made of 4 parallel LEDs. Second LEDs are also controlled from the array.

There is a DS3231SM Real Time Clock (RTC) chip managed via I2C. It has a temperature sensor with +/- 3 C precision. Original firmware offers displaying temperature but it never mentions the precision of the sensor which was originally designed to keep the clock precise within the RTC chip. No other temperature sensore on the PCB.

Display brightness can be set by PWM via the Output Enable (OE) pin of the shift registers. There is an environment light sensor too connected to the ADC pin of the ESP. It can help to set the right brightness if static one is not fit for your needs.

There is an unplaced connector with 6 pins for programming:

  1. FLASH
  2. RST
  3. GND
  4. RDX0
  5. TXD0
  6. +5V

Sixth pin is the closest one to the ESP12-F microcontroller.

After flashing your clock, at the first boot, WiFi AP turns on under the name of halclock.... . SSID is fixed but the second part depends on the MAC address of the microcontroller. There has a hardcoded magic password: password. AP also turns on if WiFi client connection fails.

main

Halacs's firmware

My development environment

  • Ubuntu 22.04.4 LTS (jammy)
  • Arduino IDE 2.3.2
  • Wemos D1 mini as development test board

Landing page

main

Clock

clock

Wifi

wifi

Factory firmware

My factory firmware is available here.

It was extracted the way as shown on the below screenshot.

main

Landing page

main

Clock Base Setup

clock

Light Pwm Setup

brightness

Auto Power Setup

auto

NTP Server Setup

ntp

WIFI Connect Setup

wifi

Load Factory Default

loadfactorydefault

Entropy analysis

entropy

Contribution

Feel free to open pull request against my repository.

When you do so please describe the change itself (e.g. feature you implemented) and the way how you have tested your changes.

Try to follow industry best practices :)

About

Custom firmware for chinese 4 digit wall clock (BAIYANGSHU 1902 WIFI CLOCK)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published