Firmware replacement for STC15F mcu-based DIY Clock Kit (available from banggood, aliexpress, et al.) Uses sdcc to build and stcgal to flash firmware on to STC15F204EA series microcontroller.
- time display/set (12/24 hour modes as compile-time option)
- display seconds
- date display/set in MM/DD or DD/MM format (compile-time option)
- display auto-dim
- temperature display in °C or °F (compile-time option)
- alarm
- chime for selected hours
- clock synchronization with GPS, additional hardware required
- DIY LED Clock kit, based on STC15F204EA and DS1302, e.g. Banggood SKU 972289
- connected to PC via cheap USB-UART adapter, e.g. CP2102, CH340G. Banggood: CP2102 USB-UART adapter
- GPS-receiver, with its Tx connected to P3.7 Banggood: GPS Module
- linux or mac (windows untested, but should work)
- sdcc installed and in the path
- stcgal (or optionally stc-isp). Note you can either do "git clone --recursive ..." when you check this repo out, or do "git submodule update --init --recursive" in order to fetch stcgal.
make clean
make
make flash
-
override default serial port:
STCGALPORT=/dev/ttyUSB0 make flash
-
add other options:
STCGALOPTS="-l 9600 -b 9600" make flash
-
a lot of compile-time options, see config.h; e.g.:
COMPILEOPT='-D CFG_HOUR_MODE=12' make
You can not enable all options at once - there is not enough space on the flash.
If compiled with default options, pressing of S1 (the upper one) on start screen will cycle in: set hour -> set minute -> set alarm hour -> set alarm minute -> alarm on/off -> chime start hour -> chime stop hour -> chime on/off
Use S2 (the lower one) to change corresponding value.
Pressing of S2 on the start screen will cycle in: temperature -> date -> weekday -> seconds
To go to change mode, press S1 on corresponding screen.
On the start screen the last dot shows state if alarm (on/off).
If DCF77 is enabled, the first dot on the start screen shows its state:
- off - no signal
- blinking - collecting data
- on - clock is synchronized
Some of the code assumes 11.0592 MHz internal RC system clock (set by stc-isp or stcgal).
This code is provided as-is, with NO guarantees or liabilities. As the original firmware loaded on an STC MCU cannot be downloaded or backed up, it cannot be restored. If you are not comfortable with experimenting, I suggest obtaining another blank STC MCU and using this to test, so that you can move back to original firmware, if desired.
stc15f204ea english datasheet: http://www.stcmcu.com/datasheet/stc/stc-ad-pdf/stc15f204ea-series-english.pdf
original firmware operation flow state diagram kit instructions w/ schematic