{"id":15102129,"url":"https://github.com/zerog2k/stc_diyclock","last_synced_at":"2025-09-27T00:30:54.813Z","repository":{"id":3370381,"uuid":"49234476","full_name":"zerog2k/stc_diyclock","owner":"zerog2k","description":"STC DIY Clock redux (STC15F204EA, STC15W404AS, STC15W408AS)","archived":true,"fork":false,"pushed_at":"2023-03-22T15:46:08.000Z","size":4524,"stargazers_count":173,"open_issues_count":16,"forks_count":66,"subscribers_count":29,"default_branch":"main","last_synced_at":"2024-09-21T06:32:46.744Z","etag":null,"topics":["8051","aliexpress","banggood","clock","diy-clock-kit","ds1302","platformio","sdcc","stc-isp"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerog2k.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-01-07T22:24:04.000Z","updated_at":"2024-09-17T03:20:31.000Z","dependencies_parsed_at":"2023-01-11T16:16:44.513Z","dependency_job_id":null,"html_url":"https://github.com/zerog2k/stc_diyclock","commit_stats":{"total_commits":190,"total_committers":15,"mean_commits":"12.666666666666666","dds":0.7157894736842105,"last_synced_commit":"beb3b5139fe64a4b8bfc9a24539ed5c0cc8c5fe3"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerog2k%2Fstc_diyclock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerog2k%2Fstc_diyclock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerog2k%2Fstc_diyclock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerog2k%2Fstc_diyclock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerog2k","download_url":"https://codeload.github.com/zerog2k/stc_diyclock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219871827,"owners_count":16554457,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["8051","aliexpress","banggood","clock","diy-clock-kit","ds1302","platformio","sdcc","stc-isp"],"created_at":"2024-09-25T18:47:25.610Z","updated_at":"2025-09-27T00:30:54.202Z","avatar_url":"https://github.com/zerog2k.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# STC DIY Clock Kit firmware\n\nFirmware replacement for STC15F mcu-based DIY Clock Kit (available from banggood [see below for link], aliexpress, et al.) Uses [sdcc](http://sdcc.sf.net) to build and [stcgal](https://github.com/grigorig/stcgal) to flash firmware on to STC15F204EA (and STC15W408AS) series microcontroller.\n\n![Image of Banggood SKU972289](http://img.banggood.com/thumb/large/2014/xiemeijuan/03/SKU203096/A3.jpg?p=WX0407753399201409DA)\n\n[link to Banggood product page for SKU 972289](http://www.banggood.com/DIY-4-Digit-LED-Electronic-Clock-Kit-Temperature-Light-Control-Version-p-972289.html?p=WX0407753399201409DA)\n\n## features\n* time display/set (12/24 hour modes)\n* date display/set (with reversible MM/YY, YY/MM display)\n* day of week\n* year\n* seconds display/reset\n* display auto-dim\n* temperature display in C or F (with user-defined offset adjustment)\n* alarm with snooze\n* hourly chime\n\n## Experimental support\n* time sync to GPS receiver outputting serial NMEA data\n  * on `gps` branch: https://github.com/zerog2k/stc_diyclock/tree/gps\n  * for STC15W408AS or STC15W404AS (sorry no STC15F204EA, not enough ram/code, no hw uart)\n  * very experimental at this point (help wanted to polish this)\n\n**note this project in development and a work-in-progress**\n*Pull requests are welcome.*\n\n## TODOs\n* time sync to WWVB radio receiver module (for STC15W408AS)\n\n## hardware\n\n* DIY LED Clock kit, based on STC15F204EA and DS1302, e.g. [Banggood SKU 972289](http://www.banggood.com/DIY-4-Digit-LED-Electronic-Clock-Kit-Temperature-Light-Control-Version-p-972289.html?p=WX0407753399201409DA)\n* connected to PC via cheap USB-UART adapter, e.g. CP2102, CH340G. [Banggood: CP2102 USB-UART adapter](http://www.banggood.com/CJMCU-CP2102-USB-To-TTLSerial-Module-UART-STC-Downloader-p-970993.html?p=WX0407753399201409DA)\n\n## connection\n| P1 header | UART adapter |\n|-----------|--------------|\n| P3.1      | RXD          |\n| P3.0      | TXD          |\n| GND       | GND          |\n| 5V        | 5V           |\n\n## requirements\n* linux or mac (windows untested, but should work)\n* sdcc installed and in the path (recommend sdcc \u003e= 3.5.0)\n* 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.\n\n## usage\nchoose platformio (preferred) or traditional make build\n\n### platformio support\n\n* assumes you have platformio installed\n* choose which mcu you are building for by uncommenting one `env_default` in `platformio.ini`\n* adjust `upload_port` as needed in `platformio.ini`\n\n### traditional make\n```\nmake clean\nmake\nmake flash\n```\n\n#### make options\n* override default serial port:\n`STCGALPORT=/dev/ttyUSB0 make flash`\n\n* add other options:\n`STCGALOPTS=\"-l 9600 -b 9600\" make flash`\n\n* flashing STC15W408AS:\n`STCGALPROT=\"stc15\" make flash`\n\n## pre-compiled binaries\nIf you like, you can try pre-compiled binaries here:\nhttps://github.com/zerog2k/stc_diyclock/releases\n\n## use STC-ISP flash tool\nInstead of stcgal, you could alternatively use the official stc-isp tool, e.g stc-isp-15xx-v6.85I.exe, to flash.\nA windows app, but also works fine for me under mac and linux with wine.\n\n\n~**note** due to optimizations that make use of \"eeprom\" section for holding lookup tables, if you are using 4k flash model mcu AND if using stc-isp tool, you must flash main.hex (as code file) and eeprom.hex (as eeprom file). (Ignore stc-isp warning about exceeding space when loading code file.)~ (not really needed anymore as current build is within 4k code)\nTo generate eeprom.hex, run:\n```\nmake eeprom\n```\n\n## clock assumptions\nFor STC15F204EA, some of the code assumes 11.0592 MHz internal RC system clock (set by stc-isp or stcgal).\nFor example, delay routines might need to be adjusted if this is different. (Most timing has been moved to hardware timers.)\n\n## disclaimers\nThis code is provided as-is, with NO guarantees or liabilities.\nAs 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.\n\n### references\nhttp://www.stcmcu.com (mostly in Chinese)\n\nstc15f204ea english datasheet:\nhttp://www.stcmcu.com/datasheet/stc/stc-ad-pdf/stc15f204ea-series-english.pdf\n\nstc15w408as english datasheet:\nhttp://www.stcmicro.com/datasheet/STC15F2K60S2-en2.pdf\n\nsdcc user guide:\nhttp://sdcc.sourceforge.net/doc/sdccman.pdf\n\nsome examples with NRF24L01+ board:\nhttp://jjmz.free.fr/?tag=stc15l204\n\nMaxim DS1302 datasheet:\nhttp://datasheets.maximintegrated.com/en/ds/DS1302.pdf\n\nVE3LNY's adaptation of this hardware to AVR (he has some interesting AVR projects there):\nhttp://www.qsl.net/v/ve3lny/travel_clock.html\n\n## diagrams\n### new operation\n[new firmware operation flow diagram](docs/DIY_LED_Clock_operation_new.png)\n\n### original operation\n[original firmware operation flow state diagram](docs/DIY_LED_Clock_operation_original.png)\n\n### schematics\nKit instructions w/ schematic: [scan](docs/DIY_LED_Clock.png) | [PDF](http://img.banggood.com/file/products/20170116024635SKU203096.pdf)\n\n\n### chat\n[![Join the chat at https://gitter.im/zerog2k/stc_diyclock](https://badges.gitter.im/zerog2k/stc_diyclock.svg)](https://gitter.im/zerog2k/stc_diyclock?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerog2k%2Fstc_diyclock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerog2k%2Fstc_diyclock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerog2k%2Fstc_diyclock/lists"}