Skip to content
All projects

Case study

LockSense: a computer that locks itself when you walk away

An ESP32 beacon in your pocket, an MQTT broker and a small Python service that locks Windows when your presence signal stops.

Team
4 developers
Context
Smart Innovation Ideathon, Grand Black Sea Forum
Stack
ESP32, MQTT, Python, C++
Year
2025

The problem

Most security policies assume people press Win + L every time they leave their desk. They forget, or they are called away in a hurry, and an unlocked computer is an open door. LockSense removes the human step: the lock follows the person, not the keyboard shortcut.

How it works

The user carries an ESP32 that publishes a short "present" message every three seconds. A Python service on the computer subscribes to that topic and remembers when it last heard the beacon. If seven seconds pass in silence, it calls the native Windows lock API.

  1. ESP32

    Publishes presence every 3 s

  2. MQTT broker

    Relays the messages

  3. Python service

    Tracks the last signal

  4. Windows

    Locks after 7 s of silence

Security decisions

The interesting question in a system like this is what happens when something breaks.

  • Fail-secure: a dead battery, a lost Wi-Fi connection or a stopped broker all look like silence, and silence locks the machine. A failure can inconvenience the user but cannot leave the computer open.
  • Wi-Fi and MQTT credentials live in local files (secrets.h and .env) that are kept out of the repository.
  • The lock itself is the operating system’s own, so LockSense never handles the password.

What is next on the roadmap

The prototype was built for an ideathon, and the repository lists what it would need to become a product: deep sleep on the ESP32 to save battery, Bluetooth Low Energy as a second transport, a small mobile dashboard, and lock scripts for macOS and Linux.

Source on GitHub