• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Sync time P.C. to Arduino.

Pommie

Well-Known Member
Most Helpful Member
This seems to come up every now and again and I needed to do this myself so here's an Arduino Sketch and a Visual Basic program to synchronize the Arduino clock (DS1307) to the P.C. clock. The VB program is in Visual Studio 2012 express but should work in any of the later releases as well - I've tried it in VS2017 and all OK.

It's self explanatory (I think) and looks like this.
Sync.png

Hope it's useful to someone.

BTW, the serial monitor can't be running at the same time and if you wish to compile the sketch then you need to disconnect the VB program.

Mike.
 

Attachments

SPDCHK

Member
Nice. Thanks. Will keep this link saved for when I do need it.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
For any IoT type devices that have internet connectivity, you can get the time direct from an internet time server quite simply.

This gives the details needed to set up a request frame (just a lower case c padded with 47 space characters) and interpret the reply.
You could use a local server or eg. pool.ntp.org

 

Pommie

Well-Known Member
Most Helpful Member
I use NTP whenever I use a Wemos or other 8266 based board. However, this is a Nano setup with one of the US$2, I²C, DS1307 + 24C32 memory on board. It was easier to write the code than mess about adding setup buttons and code.

Mike.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
I use NTP whenever I use a Wemos or other 8266 based board. However, this is a Nano setup with one of the US$2, I²C, DS1307 + 24C32 memory on board. It was easier to write the code than mess about adding setup buttons and code.

Mike.
A good idea - I've usually done it via a simple serial connection, and entered the time via a terminal program.
 

Latest threads

EE World Online Articles

Loading

 
Top