Key box

:I'm doing a project on key box intimation. For this I use Node Mcu and ultrasonic sensors. The person want to open the key in a particular time say. 9a.m. depends on the box size we can identify the opening and closing of the box. If the box is not closed beyond 5minues after opening, then buzzer to close

I take Time from the NTP server and had ultrasonic code.
I'm struck with the timing part

If we didn't open the box within the time has notification and if not closed for 5 mins get buzzer sound.

Anyone knows please help me to resolve this.
Thanks in advance :slight_smile:

Use the millis() function. Here is a beginners guide to using millis() for timing.

How accurate does the time of day for opening need to be? If you want high accuracy a Real Time Clock (RTC) module may be required.