Go Down

Topic: NTP Time Server (Read 12603 times) previous topic - next topic


There's a GPS-based NTP server project at the link below. It uses an Arduino Mega with Ethernet shield plus a couple of options for the GPS time source. The project design document (contained in the zip file) has lots of details including an accuracy analysis and test results. Sketch source code is also in the zip file.

Project Web Page

Project Zip File


In this Sketch, Time Server MAC address used {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }, but in another sketch from another source using MAC address { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED } for ethernet shield, why it is different?

The ethernet shield does NOT come with an assigned MAC address.  You assign what ever you want as you initialise the shield library.


Hi Ziggy2012
I used your code, it works well but date wrong when i synchronize to my PC. Can you help me? thanks!

Geek Emeritus

GPS always gives accurate UTC time.  RTCs will always drift.
yes, but: there is a thing you need to know.

w8bh clock2

page 2, just above and below the oscope screen capture:

Fortunately there is a better way.  Most modules also provide a 1pps (1 pulse-per-second) output. The leading edge of this pulse typically falls at the top of the second.  In other words, the start of the pulse corresponds to the start of the second. Serial RS-232 data immediately following this pulse will give the time corresponding to that pulse. The following digital oscilloscope image shows the relationship between the 1pps pulse in yellow and the serial data in blue.

The rising edge of the 1pps signal marks the beginning of the second.Each square in the horizontal direction equals 100mS, or one tenth of a second.  In the example above, the1pps signal is 100mS wide.  Serial data begins about 250 mS after the start of the second, and lasts for roughly 425mS.  After watching this display for a minute or so, it was interesting to see that the start and duration of the serial data are both variable
so if you don't do what W8BH did and trigger a time correction from the leading edge, you will always be slightly behind the right time.

I adjusted the W8BH clock for Arduino UNO and added 3 I2C LEDs: UTC, Local Time adjusted for DST, and an optional status display for people who dig deep into the code. It takes up all the static RAM in an UNO, you need a MEGA if you want any more functionality
All PMs will be deleted unopened due to arrogant argumentative pot stirring Malfoys.
 If you have not read "How to use this forum - please read", in particular: "7. If you are posting code or error messages, use "code" tags":  expect rude responses

Go Up