---
title: "W5300-TOE Arduino NTP Client"
url: "https://maker.wiznet.io/scarlet/projects/w5300-toe-arduino-ntp-client/"
markdown_url: "https://maker.wiznet.io/scarlet/projects/w5300-toe-arduino-ntp-client/md"
type: "UCC: User Created Content"
author: "scarlet"
original_author: "scarlet"
original_url: "https://github.com/Wiznet/W5300-TOE-Arduino/tree/main/Ethernet/examples/NTPClient"
published: "2023-03-31"
language: "en"
tags: ["toe-design-contest-ref"]
hardware: ["WIZnet W5300-TOE-Shield"]
likes: 1
views: 4885
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# W5300-TOE Arduino NTP Client

> W5300-TOE Arduino NTP Client

Original author: scarlet (source: https://github.com/Wiznet/W5300-TOE-Arduino/tree/main/Ethernet/examples/NTPClient)

## Components

- **WIZnet W5300-TOE-Shield** x 1 ([docs](https://wiznetshop.io/))
- Software: **Arduino IDE** ([docs](https://www.arduino.cc/en/software))

## Documents and links

- [officialGit](https://github.com/Wiznet/W5300-TOE-Arduino/tree/main/Ethernet/examples/NTPClient) (code)

## Article

## How to NTP Client Example

This code is an NTP client example that uses a STM32 Nucleo-144 board and W5300 TOE Shield. the NTP protocol to connect to an NTP server and retrieve the current time and date.

## Step 1: Prepare software

The following serial terminal programs are required for NTPClient example test, download and install from below links.

- [**Tera Term**](https://osdn.net/projects/ttssh2/releases/)

## Step 2: Prepare hardware

Combine W5300-TOE Shield with STM32 Nucleo-144 board.

Connect ethernet cable to W5300 TOE Shield ethernet port.

Connect STM32 Nucleo-144 board to desktop or laptop using 5 pin micro USB cable.

## Step 3: Setup NTPClient Example

* Please refer to the following **[Getting Start]** page for instructions on configuring the Arduino IDE

<https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/documents/getting_started.md>

To test the NTPClient example, minor settings shall be done in code.

1. Setup network configuration.

Setup **network configuration** such as IP in '**NTPClient.ino**' in '**Ethernet/examples/NTPClient**' directory.

```
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 11, 111);
```

To set the NTP Time server.

```
#define TIME_SERVER   "time.nist.gov"
```

## Step 4: Build and Download

After completing the NTPClient example configuration, build in the IDE you are using.

Download the time lib library for Arduino

> [Sketch] -> [Include Library] -> [Manage Libraries] -> install **timelib**

[![](https://github.com/Wiznet/W5300-TOE-Arduino/raw/main/Static/images/examples/ntp_lib_download.png)](https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/images/examples/ntp_lib_download.png)

1. When the build is completed, download the firmware to the STM32 Nucleo-144 board.

## Step 5: Run

1. Connect to the serial COM port of STM32 Nucleo-144 board with Tera Term.

[![](https://github.com/Wiznet/W5300-TOE-Arduino/raw/main/Static/images/examples/teraterm_setting.png)](https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/images/examples/teraterm_setting.png)

2. If the NTPClient example works normally on STM32 Nucleo-144 board, you can see the network information of STM32 Nucleo-144 board.

[![](https://github.com/Wiznet/W5300-TOE-Arduino/raw/main/Static/images/examples/ntp_setting_up.png)](https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/images/examples/ntp_setting_up.png)

3. Connect to the NTP Server. and prints the NTP time every 10 seconds.

[![](https://github.com/Wiznet/W5300-TOE-Arduino/raw/main/Static/images/examples/ntp_time_print.png)](https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/images/examples/ntp_time_print.png)

---

Source: https://maker.wiznet.io/scarlet/projects/w5300-toe-arduino-ntp-client/
