SlideShare a Scribd company logo
1 of 20
Download to read offline
Internet ofThings
Getting Date & Time From NTP Server
With ESP8266 NodeMCU
Eng. Elaf A.Saeed
The Contents
• NTP Server With ESP8266 NodeMCU.
• Getting Day & Time From NTP Server With ESP8266 NodeMCU.
• Getting Current Day and Time from NTP Server.
• Getting Current Date and Time from NTP Server.
Getting Day & Time & date From NTP
Server With ESP8266 NodeMCU
NTP Server With ESP8266 NodeMCU
NTP Server With ESP8266 NodeMCU
(cont.)
• NTP stands for Network Time Protocol and it is a networking protocol for clock
synchronization between computer systems. In other words, it is used to synchronize
computer clock times in a network.
• The protocol can be used to synchronize all networked devices to Coordinated
Universal Time (UTC) within a few milliseconds ( 50 milliseconds over the public
Internet and under 5 milliseconds in a LAN environment).
• Coordinated Universal Time (UTC) is a world-wide time standard, closely related to
GMT (Greenwich Mean Time). UTC does not vary, it is the same world wide.
NTP Server With ESP8266 NodeMCU
(cont.)
❑NTPArchitecture
• NTP uses a hierarchical architecture. Each level in the
hierarchy is known as a stratum.
• At the very top are high-precision timekeeping devices,
such as atomic clocks, GPS or radio clocks, known as
stratum 0 hardware clocks.
• Stratum 1 servers have a direct connection to a stratum 0
hardware clock and therefore have the most accurate time.
• Each stratum in the hierarchy synchronizes to the stratum
above and act as servers for lower stratum computers.
NTP Server With ESP8266 NodeMCU
(cont.)
❑How NTP Works?
• NTP can operate in a number of ways. The most common configuration
is to operate in client-server mode. The basic working principle is as
follows:
1. The client device such as ESP8266 connects to the server using the
User Datagram Protocol (UDP) on port 123.
2. A client then transmits a request packet to a NTP server.
3. In response to this request the NTP server sends a time stamp packet.
4. A time stamp packet contains multiple information like UNIX
timestamp, accuracy, delay or time zone.
5. A client can then parse out current date & time values.
NTP Server With ESP8266 NodeMCU
(cont.)
❑Installing the NTPClient Library
• We’ll use the NTPClient library to get time. In your Arduino IDE, go to
Sketch > Library > Manage Libraries. The Library Manager should open.
• Search for NTPClient and install the library by Fabrice Weinber as shown in
the following image.
Getting Day & Time From NTP Server
With ESP8266 NodeMCU
Getting Day & Time From NTP Server
With ESP8266 NodeMCU
❑NTPClient Library Time Functions
• getDay() – returns an int number that corresponds to the the week day (0 to 6)
starting on Sunday;
• getHours() – returns an int number with the current hour (0 to 23) in 24 hour format;
• getMinutes() – returns an int number with the current minutes (0 to 59);
• getSeconds() – returns an int number with the current second;
• getEpochTime() – returns an unsigned long with the epoch time (number of seconds
that have elapsed since January 1, 1970 (midnight GMT);
• getFormattedTime() – returns a String with the time formatted like HH:MM:SS;
Getting Day & Time From NTP Server
With ESP8266 NodeMCU (cont.)
Getting Current Day and Time from
NTP Server (cont.)
Getting Current Day and Time from
NTP Server (cont.)
Getting Current Date and Time from
NTP Server
❑Function that is used in Code
1. year()➔ Set or read the RTC year value.
Syntax
year(unsigned long year)
2. month() ➔ Set or read the RTC month value.
Syntax
month(unsigned long month)
3. day() ➔ Set or read the RTC day value.
Syntax
day(unsigned long day)
Getting Current Date and Time from
NTP Server (cont.)
❑Function that is used in Code
4. minute() ➔ Set or read the RTC minute value.
Syntax: minute(unsigned long minute)
5. second() ➔ Set or read the RTC second value.
Syntax: second(unsigned long second) .
Getting Current Date and Time from
NTP Server (cont.)
Getting Current Date and Time from
NTP Server (cont.)
Getting Current Date and Time from
NTP Server (cont.)
Getting Current Date and Time from
NTP Server (cont.)
Thanks

More Related Content

What's hot

Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinComparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinUniversitas Pembangunan Panca Budi
 
Recovery with concurrent transaction
Recovery with concurrent transactionRecovery with concurrent transaction
Recovery with concurrent transactionlavanya marichamy
 
CRC implementation
CRC implementation CRC implementation
CRC implementation ajay singh
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process SchedulingShipra Swati
 
Computer Networks Unit 1 Introduction and Physical Layer
Computer Networks Unit 1 Introduction and Physical Layer Computer Networks Unit 1 Introduction and Physical Layer
Computer Networks Unit 1 Introduction and Physical Layer Dr. SELVAGANESAN S
 
NORMALIZATION - BIS 1204: Data and Information Management I
NORMALIZATION - BIS 1204: Data and Information Management I NORMALIZATION - BIS 1204: Data and Information Management I
NORMALIZATION - BIS 1204: Data and Information Management I Mukalele Rogers
 
Approaches to real time scheduling
Approaches to real time schedulingApproaches to real time scheduling
Approaches to real time schedulingKamal Acharya
 
Data Communication And Networking - ERROR DETECTION AND CORRECTION
Data Communication And Networking - ERROR DETECTION AND CORRECTIONData Communication And Networking - ERROR DETECTION AND CORRECTION
Data Communication And Networking - ERROR DETECTION AND CORRECTIONAvijeet Negel
 
Complement in DLD
Complement in DLDComplement in DLD
Complement in DLDshahzad ali
 
Windows process scheduling presentation
Windows process scheduling presentationWindows process scheduling presentation
Windows process scheduling presentationTalha Shaikh
 
Chapter 11: Data Link Control
Chapter 11: Data Link ControlChapter 11: Data Link Control
Chapter 11: Data Link ControlJeoffnaRuth
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptxSanad Bhowmik
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalizationdaxesh chauhan
 
Real Time Systems
Real Time SystemsReal Time Systems
Real Time SystemsDeepak John
 

What's hot (20)

Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinComparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
 
Recovery with concurrent transaction
Recovery with concurrent transactionRecovery with concurrent transaction
Recovery with concurrent transaction
 
CRC implementation
CRC implementation CRC implementation
CRC implementation
 
Point to-point protocol (ppp)
Point to-point protocol (ppp)Point to-point protocol (ppp)
Point to-point protocol (ppp)
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process Scheduling
 
Digital to digital
Digital to digitalDigital to digital
Digital to digital
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Computer Networks Unit 1 Introduction and Physical Layer
Computer Networks Unit 1 Introduction and Physical Layer Computer Networks Unit 1 Introduction and Physical Layer
Computer Networks Unit 1 Introduction and Physical Layer
 
NORMALIZATION - BIS 1204: Data and Information Management I
NORMALIZATION - BIS 1204: Data and Information Management I NORMALIZATION - BIS 1204: Data and Information Management I
NORMALIZATION - BIS 1204: Data and Information Management I
 
Approaches to real time scheduling
Approaches to real time schedulingApproaches to real time scheduling
Approaches to real time scheduling
 
Data Communication And Networking - ERROR DETECTION AND CORRECTION
Data Communication And Networking - ERROR DETECTION AND CORRECTIONData Communication And Networking - ERROR DETECTION AND CORRECTION
Data Communication And Networking - ERROR DETECTION AND CORRECTION
 
Snooping TCP
Snooping TCPSnooping TCP
Snooping TCP
 
Complement in DLD
Complement in DLDComplement in DLD
Complement in DLD
 
Distributed Operating System_1
Distributed Operating System_1Distributed Operating System_1
Distributed Operating System_1
 
Windows process scheduling presentation
Windows process scheduling presentationWindows process scheduling presentation
Windows process scheduling presentation
 
Unit 05: Physical Architecture Design
Unit 05: Physical Architecture DesignUnit 05: Physical Architecture Design
Unit 05: Physical Architecture Design
 
Chapter 11: Data Link Control
Chapter 11: Data Link ControlChapter 11: Data Link Control
Chapter 11: Data Link Control
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptx
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
 
Real Time Systems
Real Time SystemsReal Time Systems
Real Time Systems
 

Similar to Getting date and time from ntp server with esp8266 node mcu

4 ip services dhcp
4 ip services dhcp4 ip services dhcp
4 ip services dhcpSagarR24
 
4 ip services dhcp-part b
4 ip services dhcp-part b4 ip services dhcp-part b
4 ip services dhcp-part bSagarR24
 
4 ip services nat
4 ip services nat4 ip services nat
4 ip services natSagarR24
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed systemSunita Sahu
 
4 ip services span,rspan
4 ip services span,rspan4 ip services span,rspan
4 ip services span,rspanSagarR24
 
Whats the Time
Whats the TimeWhats the Time
Whats the TimeAPNIC
 
Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Sri Prasanna
 
Synchronization For High Frequency Trading Networks: A How To Guide
Synchronization For High Frequency Trading Networks: A How To GuideSynchronization For High Frequency Trading Networks: A How To Guide
Synchronization For High Frequency Trading Networks: A How To Guidejeremyonyan
 
Lesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptxLesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptxLagamaPasala
 
Exploring Parallel Merging In GPU Based Systems Using CUDA C.
Exploring Parallel Merging In GPU Based Systems Using CUDA C.Exploring Parallel Merging In GPU Based Systems Using CUDA C.
Exploring Parallel Merging In GPU Based Systems Using CUDA C.Rakib Hossain
 
Synchronization of multihop sensor networks in the app layer
Synchronization of multihop sensor networks in the app layerSynchronization of multihop sensor networks in the app layer
Synchronization of multihop sensor networks in the app layerVaishnavi
 
Performance Evaluation of Low-cost GPS Time Server based on NTP
Performance Evaluation of Low-cost GPS Time Server based on NTPPerformance Evaluation of Low-cost GPS Time Server based on NTP
Performance Evaluation of Low-cost GPS Time Server based on NTPTELKOMNIKA JOURNAL
 
Methods for Improving NTP
Methods for Improving NTPMethods for Improving NTP
Methods for Improving NTPADVA
 
Accurate Synchronization of EtherCAT Systems Using Distributed Clocks
Accurate Synchronization of EtherCAT Systems Using Distributed ClocksAccurate Synchronization of EtherCAT Systems Using Distributed Clocks
Accurate Synchronization of EtherCAT Systems Using Distributed ClocksDesign World
 

Similar to Getting date and time from ntp server with esp8266 node mcu (20)

Seminar
SeminarSeminar
Seminar
 
4 ip services dhcp
4 ip services dhcp4 ip services dhcp
4 ip services dhcp
 
4 ip services dhcp-part b
4 ip services dhcp-part b4 ip services dhcp-part b
4 ip services dhcp-part b
 
4 ip services nat
4 ip services nat4 ip services nat
4 ip services nat
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed system
 
4 ip services span,rspan
4 ip services span,rspan4 ip services span,rspan
4 ip services span,rspan
 
Whats the Time
Whats the TimeWhats the Time
Whats the Time
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Timers
TimersTimers
Timers
 
Timer
TimerTimer
Timer
 
Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)
 
Synchronization For High Frequency Trading Networks: A How To Guide
Synchronization For High Frequency Trading Networks: A How To GuideSynchronization For High Frequency Trading Networks: A How To Guide
Synchronization For High Frequency Trading Networks: A How To Guide
 
Lesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptxLesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptx
 
WSN ppt (1).pptx
WSN ppt (1).pptxWSN ppt (1).pptx
WSN ppt (1).pptx
 
Exploring Parallel Merging In GPU Based Systems Using CUDA C.
Exploring Parallel Merging In GPU Based Systems Using CUDA C.Exploring Parallel Merging In GPU Based Systems Using CUDA C.
Exploring Parallel Merging In GPU Based Systems Using CUDA C.
 
Synchronization of multihop sensor networks in the app layer
Synchronization of multihop sensor networks in the app layerSynchronization of multihop sensor networks in the app layer
Synchronization of multihop sensor networks in the app layer
 
Synch
SynchSynch
Synch
 
Performance Evaluation of Low-cost GPS Time Server based on NTP
Performance Evaluation of Low-cost GPS Time Server based on NTPPerformance Evaluation of Low-cost GPS Time Server based on NTP
Performance Evaluation of Low-cost GPS Time Server based on NTP
 
Methods for Improving NTP
Methods for Improving NTPMethods for Improving NTP
Methods for Improving NTP
 
Accurate Synchronization of EtherCAT Systems Using Distributed Clocks
Accurate Synchronization of EtherCAT Systems Using Distributed ClocksAccurate Synchronization of EtherCAT Systems Using Distributed Clocks
Accurate Synchronization of EtherCAT Systems Using Distributed Clocks
 

More from Elaf A.Saeed

IOT NodeMCU - NodeMCU Webserver
IOT NodeMCU - NodeMCU WebserverIOT NodeMCU - NodeMCU Webserver
IOT NodeMCU - NodeMCU WebserverElaf A.Saeed
 
IOT NodeMCU - Ubidots Platform to Turn on LEDs
IOT NodeMCU - Ubidots Platform to Turn on LEDsIOT NodeMCU - Ubidots Platform to Turn on LEDs
IOT NodeMCU - Ubidots Platform to Turn on LEDsElaf A.Saeed
 
IOT NodeMCU - Thinger Platform to Turn on LEDs
IOT NodeMCU - Thinger Platform to Turn on LEDsIOT NodeMCU - Thinger Platform to Turn on LEDs
IOT NodeMCU - Thinger Platform to Turn on LEDsElaf A.Saeed
 
IOT NodeMCU - IFTTT Templet to send SMS
IOT NodeMCU - IFTTT Templet to send SMSIOT NodeMCU - IFTTT Templet to send SMS
IOT NodeMCU - IFTTT Templet to send SMSElaf A.Saeed
 
ESP8266 NodeMCU Server, Client, Station Mode, and Client Control LED
ESP8266 NodeMCU Server, Client, Station Mode, and Client Control LEDESP8266 NodeMCU Server, Client, Station Mode, and Client Control LED
ESP8266 NodeMCU Server, Client, Station Mode, and Client Control LEDElaf A.Saeed
 
IOT NodeMCU - NodeMCU Connection to Internet
IOT NodeMCU - NodeMCU Connection to InternetIOT NodeMCU - NodeMCU Connection to Internet
IOT NodeMCU - NodeMCU Connection to InternetElaf A.Saeed
 
Lesson 10- NodeMCU with LCD I2C
Lesson 10- NodeMCU with LCD I2CLesson 10- NodeMCU with LCD I2C
Lesson 10- NodeMCU with LCD I2CElaf A.Saeed
 
Lesson 9- NodeMCU with Arduino UNO (UART)
Lesson 9- NodeMCU with Arduino UNO (UART)Lesson 9- NodeMCU with Arduino UNO (UART)
Lesson 9- NodeMCU with Arduino UNO (UART)Elaf A.Saeed
 
Lesson 8- NodeMCU with Servo Motor
Lesson 8- NodeMCU with Servo MotorLesson 8- NodeMCU with Servo Motor
Lesson 8- NodeMCU with Servo MotorElaf A.Saeed
 
Lesson 7- NodeMCU with DC Motor
Lesson 7- NodeMCU with DC MotorLesson 7- NodeMCU with DC Motor
Lesson 7- NodeMCU with DC MotorElaf A.Saeed
 
Lesson 6 - NodeMCU with PWM Pin
Lesson 6 -  NodeMCU with PWM PinLesson 6 -  NodeMCU with PWM Pin
Lesson 6 - NodeMCU with PWM PinElaf A.Saeed
 
lesson4 - NodeMCU control led
  lesson4 - NodeMCU control led  lesson4 - NodeMCU control led
lesson4 - NodeMCU control ledElaf A.Saeed
 
lesson2 - Nodemcu course - NodeMCU dev Board
 lesson2 - Nodemcu course - NodeMCU dev Board lesson2 - Nodemcu course - NodeMCU dev Board
lesson2 - Nodemcu course - NodeMCU dev BoardElaf A.Saeed
 
lesson1 - Getting Started with ESP8266
lesson1 -  Getting Started with ESP8266lesson1 -  Getting Started with ESP8266
lesson1 - Getting Started with ESP8266Elaf A.Saeed
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseElaf A.Saeed
 
Embedded system introduction - Arduino Course
Embedded system introduction - Arduino CourseEmbedded system introduction - Arduino Course
Embedded system introduction - Arduino CourseElaf A.Saeed
 
Pyton with rasperry pi
Pyton with rasperry piPyton with rasperry pi
Pyton with rasperry piElaf A.Saeed
 
Summary of MATLAB Functions-Part1
Summary of MATLAB Functions-Part1Summary of MATLAB Functions-Part1
Summary of MATLAB Functions-Part1Elaf A.Saeed
 
MATLAB Basics-Part1
MATLAB Basics-Part1MATLAB Basics-Part1
MATLAB Basics-Part1Elaf A.Saeed
 
Python basics_ part1
Python basics_ part1Python basics_ part1
Python basics_ part1Elaf A.Saeed
 

More from Elaf A.Saeed (20)

IOT NodeMCU - NodeMCU Webserver
IOT NodeMCU - NodeMCU WebserverIOT NodeMCU - NodeMCU Webserver
IOT NodeMCU - NodeMCU Webserver
 
IOT NodeMCU - Ubidots Platform to Turn on LEDs
IOT NodeMCU - Ubidots Platform to Turn on LEDsIOT NodeMCU - Ubidots Platform to Turn on LEDs
IOT NodeMCU - Ubidots Platform to Turn on LEDs
 
IOT NodeMCU - Thinger Platform to Turn on LEDs
IOT NodeMCU - Thinger Platform to Turn on LEDsIOT NodeMCU - Thinger Platform to Turn on LEDs
IOT NodeMCU - Thinger Platform to Turn on LEDs
 
IOT NodeMCU - IFTTT Templet to send SMS
IOT NodeMCU - IFTTT Templet to send SMSIOT NodeMCU - IFTTT Templet to send SMS
IOT NodeMCU - IFTTT Templet to send SMS
 
ESP8266 NodeMCU Server, Client, Station Mode, and Client Control LED
ESP8266 NodeMCU Server, Client, Station Mode, and Client Control LEDESP8266 NodeMCU Server, Client, Station Mode, and Client Control LED
ESP8266 NodeMCU Server, Client, Station Mode, and Client Control LED
 
IOT NodeMCU - NodeMCU Connection to Internet
IOT NodeMCU - NodeMCU Connection to InternetIOT NodeMCU - NodeMCU Connection to Internet
IOT NodeMCU - NodeMCU Connection to Internet
 
Lesson 10- NodeMCU with LCD I2C
Lesson 10- NodeMCU with LCD I2CLesson 10- NodeMCU with LCD I2C
Lesson 10- NodeMCU with LCD I2C
 
Lesson 9- NodeMCU with Arduino UNO (UART)
Lesson 9- NodeMCU with Arduino UNO (UART)Lesson 9- NodeMCU with Arduino UNO (UART)
Lesson 9- NodeMCU with Arduino UNO (UART)
 
Lesson 8- NodeMCU with Servo Motor
Lesson 8- NodeMCU with Servo MotorLesson 8- NodeMCU with Servo Motor
Lesson 8- NodeMCU with Servo Motor
 
Lesson 7- NodeMCU with DC Motor
Lesson 7- NodeMCU with DC MotorLesson 7- NodeMCU with DC Motor
Lesson 7- NodeMCU with DC Motor
 
Lesson 6 - NodeMCU with PWM Pin
Lesson 6 -  NodeMCU with PWM PinLesson 6 -  NodeMCU with PWM Pin
Lesson 6 - NodeMCU with PWM Pin
 
lesson4 - NodeMCU control led
  lesson4 - NodeMCU control led  lesson4 - NodeMCU control led
lesson4 - NodeMCU control led
 
lesson2 - Nodemcu course - NodeMCU dev Board
 lesson2 - Nodemcu course - NodeMCU dev Board lesson2 - Nodemcu course - NodeMCU dev Board
lesson2 - Nodemcu course - NodeMCU dev Board
 
lesson1 - Getting Started with ESP8266
lesson1 -  Getting Started with ESP8266lesson1 -  Getting Started with ESP8266
lesson1 - Getting Started with ESP8266
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino Course
 
Embedded system introduction - Arduino Course
Embedded system introduction - Arduino CourseEmbedded system introduction - Arduino Course
Embedded system introduction - Arduino Course
 
Pyton with rasperry pi
Pyton with rasperry piPyton with rasperry pi
Pyton with rasperry pi
 
Summary of MATLAB Functions-Part1
Summary of MATLAB Functions-Part1Summary of MATLAB Functions-Part1
Summary of MATLAB Functions-Part1
 
MATLAB Basics-Part1
MATLAB Basics-Part1MATLAB Basics-Part1
MATLAB Basics-Part1
 
Python basics_ part1
Python basics_ part1Python basics_ part1
Python basics_ part1
 

Recently uploaded

HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stageAbc194748
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...Health
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 

Recently uploaded (20)

HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 

Getting date and time from ntp server with esp8266 node mcu

  • 1. Internet ofThings Getting Date & Time From NTP Server With ESP8266 NodeMCU Eng. Elaf A.Saeed
  • 2. The Contents • NTP Server With ESP8266 NodeMCU. • Getting Day & Time From NTP Server With ESP8266 NodeMCU. • Getting Current Day and Time from NTP Server. • Getting Current Date and Time from NTP Server.
  • 3. Getting Day & Time & date From NTP Server With ESP8266 NodeMCU
  • 4. NTP Server With ESP8266 NodeMCU
  • 5. NTP Server With ESP8266 NodeMCU (cont.) • NTP stands for Network Time Protocol and it is a networking protocol for clock synchronization between computer systems. In other words, it is used to synchronize computer clock times in a network. • The protocol can be used to synchronize all networked devices to Coordinated Universal Time (UTC) within a few milliseconds ( 50 milliseconds over the public Internet and under 5 milliseconds in a LAN environment). • Coordinated Universal Time (UTC) is a world-wide time standard, closely related to GMT (Greenwich Mean Time). UTC does not vary, it is the same world wide.
  • 6. NTP Server With ESP8266 NodeMCU (cont.) ❑NTPArchitecture • NTP uses a hierarchical architecture. Each level in the hierarchy is known as a stratum. • At the very top are high-precision timekeeping devices, such as atomic clocks, GPS or radio clocks, known as stratum 0 hardware clocks. • Stratum 1 servers have a direct connection to a stratum 0 hardware clock and therefore have the most accurate time. • Each stratum in the hierarchy synchronizes to the stratum above and act as servers for lower stratum computers.
  • 7. NTP Server With ESP8266 NodeMCU (cont.) ❑How NTP Works? • NTP can operate in a number of ways. The most common configuration is to operate in client-server mode. The basic working principle is as follows: 1. The client device such as ESP8266 connects to the server using the User Datagram Protocol (UDP) on port 123. 2. A client then transmits a request packet to a NTP server. 3. In response to this request the NTP server sends a time stamp packet. 4. A time stamp packet contains multiple information like UNIX timestamp, accuracy, delay or time zone. 5. A client can then parse out current date & time values.
  • 8. NTP Server With ESP8266 NodeMCU (cont.) ❑Installing the NTPClient Library • We’ll use the NTPClient library to get time. In your Arduino IDE, go to Sketch > Library > Manage Libraries. The Library Manager should open. • Search for NTPClient and install the library by Fabrice Weinber as shown in the following image.
  • 9. Getting Day & Time From NTP Server With ESP8266 NodeMCU
  • 10. Getting Day & Time From NTP Server With ESP8266 NodeMCU ❑NTPClient Library Time Functions • getDay() – returns an int number that corresponds to the the week day (0 to 6) starting on Sunday; • getHours() – returns an int number with the current hour (0 to 23) in 24 hour format; • getMinutes() – returns an int number with the current minutes (0 to 59); • getSeconds() – returns an int number with the current second; • getEpochTime() – returns an unsigned long with the epoch time (number of seconds that have elapsed since January 1, 1970 (midnight GMT); • getFormattedTime() – returns a String with the time formatted like HH:MM:SS;
  • 11. Getting Day & Time From NTP Server With ESP8266 NodeMCU (cont.)
  • 12. Getting Current Day and Time from NTP Server (cont.)
  • 13. Getting Current Day and Time from NTP Server (cont.)
  • 14. Getting Current Date and Time from NTP Server ❑Function that is used in Code 1. year()➔ Set or read the RTC year value. Syntax year(unsigned long year) 2. month() ➔ Set or read the RTC month value. Syntax month(unsigned long month) 3. day() ➔ Set or read the RTC day value. Syntax day(unsigned long day)
  • 15. Getting Current Date and Time from NTP Server (cont.) ❑Function that is used in Code 4. minute() ➔ Set or read the RTC minute value. Syntax: minute(unsigned long minute) 5. second() ➔ Set or read the RTC second value. Syntax: second(unsigned long second) .
  • 16. Getting Current Date and Time from NTP Server (cont.)
  • 17. Getting Current Date and Time from NTP Server (cont.)
  • 18. Getting Current Date and Time from NTP Server (cont.)
  • 19. Getting Current Date and Time from NTP Server (cont.)