Please enable JavaScript to view this site.

How this block appears in a Simulink model?

sntp_block_1

What can be configured?

sntp_block_2

Configuration Parameter

Selectable Option/Value

Description

SNTP Server name

 

Enter the SNTP server name

Time Zone

 

Enter the time zone

Country

 

Enter the country

Port Name

Port Type

Date Type

Description

Trigger

Scalar

Any data type

Expected values True or False(1 or 0), This block only active when this pin becomes True(1)

When to use this block?

Simple Network Time Protocol (SNTP) block can be used to get the time from any SNTP server.

Limitations

This block need to have a WIFI_block to communicate with the server.

Demo

Demo file : esp32_system_time_demo.slx

sntp_block_3

Inside of the if action subsystem.

sntp_block_4

Description

This demo use SNTP_block to update the ESP32 local time with the server. There it need to be connect to the WIFI first from the WIFI_block. Once it connect SNTP will synchronize the time with the server. Then System_time_block will get the internal time from the esp and give the output to a String_processing_block. It will process the string and print it for the user.

What should be happening?

Firstly it will connect to the server by using the WIFI block. When the WIFI connection is established it will update the local time. Please check the Serial Monitor for the more info (baud rate : 115200). It will log the current time there.

sntp_block_5

Copyright 2022 Aimagin Co.,Ltd. Rev.507