Close

Set the time over serial

A project log for Numitron Clock

A post apocalyptic Numitron clock based on Arduino Nano and DS3231

jeltoJelto 10/26/2020 at 18:110 Comments

To keep the design simple I decided to adjust the time only with a serial command.

Most of the logic comes from the DS3231_set example code.


The Arduino listens on the serial connection with 9600 baud.

It accepts the following string: 

YYMMDDwHHMMSSx


YY= two digit year (example '20')

MM=two digit month (example '10')

DD=two digit day (example '26')

w=separator

HH=two digit hour (exampel '19')

MM=two digit minute (example '10')

SS=two digit second (example '20')

x=sparator at the end

Full example would be:

201026w191020x

for the 26th of October 2020, 19:10:20

To set the date with a Linux computer just type:

stty -F /dev/ttyUSB0 -hupcl
echo -n "201026w191020x" > /dev/ttyUSB0

Discussions