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

Experimenteren met elektriciteit
Experimenteren met elektriciteitExperimenteren met elektriciteit
Experimenteren met elektriciteittine.vanacker
 
Chapter 3 (law of conservation of mass & and 1st law)
Chapter 3 (law of conservation of mass & and 1st law)Chapter 3 (law of conservation of mass & and 1st law)
Chapter 3 (law of conservation of mass & and 1st law)Yuri Melliza
 
SALURAN TRANSMISI [Praktikum DST]
SALURAN TRANSMISI [Praktikum DST]SALURAN TRANSMISI [Praktikum DST]
SALURAN TRANSMISI [Praktikum DST]Salman Alparisi
 
Power supply
Power supplyPower supply
Power supplyAnanda II
 
EMS Physio catalogue 2016 2017
EMS Physio catalogue 2016 2017 EMS Physio catalogue 2016 2017
EMS Physio catalogue 2016 2017 Ann Lewis
 
10 sistem 3 phasa beban tidak seimbang
10 sistem 3 phasa beban tidak seimbang10 sistem 3 phasa beban tidak seimbang
10 sistem 3 phasa beban tidak seimbangSimon Patabang
 
QAM (Quadratur Amplitude Modulation)
QAM (Quadratur Amplitude Modulation)QAM (Quadratur Amplitude Modulation)
QAM (Quadratur Amplitude Modulation)Risdawati Hutabarat
 
Training Alcatel-Lucent WDM PSS 183x
Training Alcatel-Lucent WDM PSS 183xTraining Alcatel-Lucent WDM PSS 183x
Training Alcatel-Lucent WDM PSS 183xAbdelilah CHARBOUB
 
7 faktor degradasi sistem
7 faktor degradasi sistem7 faktor degradasi sistem
7 faktor degradasi sistemajus ady
 
askelandphulenotes-ch19printable.ppt
askelandphulenotes-ch19printable.pptaskelandphulenotes-ch19printable.ppt
askelandphulenotes-ch19printable.pptAryanSahota
 
Advanced physical chemistry notes
Advanced physical chemistry notes Advanced physical chemistry notes
Advanced physical chemistry notes Fateh Eltaboni
 

What's hot (20)

Be lab manual csvtu
Be lab manual csvtuBe lab manual csvtu
Be lab manual csvtu
 
Lab 10...
Lab 10...Lab 10...
Lab 10...
 
DC Metering - Moving toward center stage
DC Metering - Moving toward center stageDC Metering - Moving toward center stage
DC Metering - Moving toward center stage
 
Experimenteren met elektriciteit
Experimenteren met elektriciteitExperimenteren met elektriciteit
Experimenteren met elektriciteit
 
Polyphase Metering 101
Polyphase Metering 101Polyphase Metering 101
Polyphase Metering 101
 
Chapter 3 (law of conservation of mass & and 1st law)
Chapter 3 (law of conservation of mass & and 1st law)Chapter 3 (law of conservation of mass & and 1st law)
Chapter 3 (law of conservation of mass & and 1st law)
 
SALURAN TRANSMISI [Praktikum DST]
SALURAN TRANSMISI [Praktikum DST]SALURAN TRANSMISI [Praktikum DST]
SALURAN TRANSMISI [Praktikum DST]
 
Ejercicio subneteo _Taller Sena
Ejercicio subneteo _Taller SenaEjercicio subneteo _Taller Sena
Ejercicio subneteo _Taller Sena
 
Power supply
Power supplyPower supply
Power supply
 
Op amp
Op ampOp amp
Op amp
 
EMS Physio catalogue 2016 2017
EMS Physio catalogue 2016 2017 EMS Physio catalogue 2016 2017
EMS Physio catalogue 2016 2017
 
Rangkaian dimmer
Rangkaian dimmerRangkaian dimmer
Rangkaian dimmer
 
10 sistem 3 phasa beban tidak seimbang
10 sistem 3 phasa beban tidak seimbang10 sistem 3 phasa beban tidak seimbang
10 sistem 3 phasa beban tidak seimbang
 
QAM (Quadratur Amplitude Modulation)
QAM (Quadratur Amplitude Modulation)QAM (Quadratur Amplitude Modulation)
QAM (Quadratur Amplitude Modulation)
 
Laporan Modulo Counter
Laporan Modulo CounterLaporan Modulo Counter
Laporan Modulo Counter
 
Training Alcatel-Lucent WDM PSS 183x
Training Alcatel-Lucent WDM PSS 183xTraining Alcatel-Lucent WDM PSS 183x
Training Alcatel-Lucent WDM PSS 183x
 
7 faktor degradasi sistem
7 faktor degradasi sistem7 faktor degradasi sistem
7 faktor degradasi sistem
 
askelandphulenotes-ch19printable.ppt
askelandphulenotes-ch19printable.pptaskelandphulenotes-ch19printable.ppt
askelandphulenotes-ch19printable.ppt
 
Advanced physical chemistry notes
Advanced physical chemistry notes Advanced physical chemistry notes
Advanced physical chemistry notes
 
KMIPN 2023.pptx
KMIPN 2023.pptxKMIPN 2023.pptx
KMIPN 2023.pptx
 

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

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 

Recently uploaded (20)

Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 

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.)