Clone
9
"Almost precise" clock
Ewaryst edited this page 2026-04-11 07:44:32 +00:00

"Almost precise" clock project.

Please visit https://ewaryst.com to my portfolio page.

The reason for colling the clock "Almost" precise comes form the fact that it utilizes WCMCU-28128-24 addressable led ring with 24 addressable diodes. Simple mapping is used to display minutes and seconds on this clock. You will not be able to tell precise time down to a second or even a minute but it works very well in everyday life to indicate time flow.

Clock uses STM32F103 controller from ST Microelectronics (Blue Pill) and is powered via USB port. Time keeping is done using external RTC clock - ds1307.

USB acts also as communication interface, allowing user to change several parameters in the clock, like the colour of diodes indicating hours, minutes and seconds as well as the background colour of the display. ST USB driver is needed in order for this clock to be discovered as "COM port".

Command Set

The communication is done by sending 6-number command to the clock. first number indicates command ID. General scheme is:

  • 1 - Command ID
  • 2 to 5 - Command dependant values
  • 6 - Reserved for CRC

Following commands are implemented:

    0:  cmd_WhoAmI,						

	1:    cmd_GetTime,					
	2:    cmd_GetMonthDay,				
	3:    cmd_GetYear,					
	4:    cmd_GetTimeZone,				
	5:    cmd_GetDate,					
	6:    cmd_getDiodeOffset,				

	7:    cmd_SetTime,					
	8:    cmd_SetMonthDay,				
	9:    cmd_SetYear,					

	10:  cmd_setColour_hour,				
	11: cmd_setColour_minute,			
	12: cmd_setColour_second,			
	13: cmd_setColour_background,		

	14: cmd_Set_TimeZone,				
	15: cmd_SetDate,					

	16: cmd_readNV,						
	17: cmd_writeNV,					

	18: cmd_setDiodeOffset	- in  work

Meaning of next numbers in the sequence depends of the command you send. ie:

For "set colour" command next three numbers are "Red", "Green" and "Blue" values of the new colour. Fro "read NV" second number indicates which setting to read:

#define NV_COLOUR_HOURS_ADDR 0x08 // 3 bytes #define NV_COLOUR_MINUTES_ADDR 0x0B // 3 bytes #define NV_COLOUR_SECONDS_ADDR 0x0E // 3 bytes #define NV_COLOUR_BACKGND_ADDR 0x11 // 3 bytes #define NV_DIODE_OFFSET 0x14 // 1 byte

Accordingly, for "write NV" next max 3 numbers indicate "R", "G" and "B" in case of colour change (3 bytes).

Mechanics

In "Mechanics" folder you will fing my enclosure design done in FreeCad.