Skip to content
Adaptive AgroTech NetworkUniversity of Southern Denmark · SDU Drone Center
Cover for Raspberry Pi Pico Door-Open Alarm | Timer, Contact & OLED

Video by Adaptive AgroTech. If the embedded player is unavailable, open the original video ↗.

Raspberry Pi Pico Door-Open Alarm | Timer, Contact & OLED

A door contact starts a timer on the Raspberry Pi Pico. The OLED can show how long the door has remained open before the alarm sounds.

Understand the concept

The key idea

Start timing on the transition to open. If the contact still reads open on the next loop, the original start time must be preserved. Closing the door ends that open interval.

What to remember

  • Time each continuous open interval.
  • Show elapsed time so a user can distinguish a brief opening from a persistent one.
Pause & think

Check your understanding

Why would restarting the timer every time the contact reads open prevent the alarm?

Show the explanation

Each restart erases the elapsed interval, so it may never reach the alarm delay.