NTP Client

The rubidium atomic clock requires an accurate time source to initially set the time. Originally I used a RS232 GPS puck but I then looked for something home grown. The answer was to use sime NTP Client to obtain the time from an internet time server and send the date and time as text to the atomic clock.

This simple NTP client uses a w5100 ethernet chip and a mega32 for its intelligence.


Schematic and PCB

The Eagle files can be downloaded - see below.


Software

The board has two modes: configuration where the RS232 connection is used to set up the ethernet connection, and operating where the ethernet module obtains the date and time from a NTP Server and outputs the results on the RS232 connection.

Configuration

To enter the configuration mode a jumper is fitted to pins 1 & 2 on header SV2 (and no other pair) with the power off. When the card is started a simple configuartion menu appears on the RS232 connection (57600,8,n,1):

NTP Client Setup Menu Action 0 Soft reset AVR 1 Change Client IP Address (192.168.1.53) 2 Change Client Gateway (192.168.1.1) 3 Change Subnet Mask (255.255.255.0) >

You need to get the gateway address from your router and you will need to set an IP address for the card that is acceptable to your router. My home built devices all have IP addresses in the range 192.168.1.50 to 192.168.1.99.

The card has a fixed MAC of 00:aa:bb:cc:dd:06 and the mega will need to be reprogrammed to change it. Bare in mind my intention for the card is for home use and not for any professional use. Strictly a MAC must not be "invented" in this way. The odds are, of course, that this number will not clash with any other MAC address you have at home.

The RS232 connection is fixed at 57600 baud, 8 bits, no parity and 1 stop bit. These values are programmed into the mega.

When any changes have been made, the jumper on SV2 is removed and 0 selected from the menu. The card will reset.

The configuration values you enter are saved into eeprom so this set up may only need to be done once.

Operating

With the w5100 module plugged into your router and a RS232 connection plugged into your PC (again 57600,8,n,1), enter 192.168.1.53 (or whatever IP address you entered in the configuration) into your browser and with a bit of luck the following page will appear:

The output box at the bottom of the page will be empty initially. Press the Request button and the card will fetch the date & time and display some information on the NTP data received. The serial connection will have the date & time text sent to it. Such as the following:

DATE 02-12-2010 TIME 19:05:47:179

Job done!

You can select from 4 pre-programmed time servers - PlusNet a UK ISP, two fron the UK's National Physical Laboratory (NPL) and Trinity College Dublin (TCD). You enter an IP address of another NTP Server to use as well. Enter what you want and/or select the correct radio button and press the Change button. The selection is also saved to eeprom so the card will wake-up as you leave it.

The last step is yours to take - whatever you plug the card into must decode the date and time (which will always be GMT) and correct for your timezone and any daylight saving. Using scanf in C should make the decoding task trivial.

At the time of preparing this web page I'm still working on the C libraries that support this project. If you want the code now, or just a hex file (or even a preprogrammed mega) then get in touch.

Downloads

You should look in the "/Workshop Projects/NTP Client" folder.