Back to Portfolio

Smart Safe

A safe that can be unlocked over the internet.

After getting a new ESP32 board, I wanted to see if I could turn an ordinary safe into an internet-connected one. I tapped into the safe's own lock circuit and used the board to run a small web page that opens it on request.

The idea

I had just picked up an ESP32 board and wanted a project to try it on. An IoT safe, one that can be unlocked over the internet, seemed like a good fit.

The safe, closed, with its original keypad still fitted to the front
The safe's control board next to a close-up of the same board, with an arrow showing they are the same piece

Interfacing with the lock circuit

With the board out of the safe, I identified the transistor that switches current through the lock solenoid and traced its control line back to the microcontroller. I soldered a wire to the pad on that line and a second wire to one of the board's ground pins. Joining the two wires pulls the control line low, which turns the transistor on and releases the lock, so the solenoid can be driven from outside the safe's own circuit.

The relay contacts make that connection, which keeps the ESP32 electrically isolated from the safe's circuit. The ESP32 runs a simple web server that closes the relay on request to unlock the safe.

Web UI

The web UI is a single page that works on a phone or a computer. Nothing happens until the right password is entered, so a stray tab or a curious visitor cannot open the safe. When the password is correct, the UI triggers the relay, the padlock swings open, and a countdown bar shows how long the safe stays open before it locks itself again.

A wrong password shakes the card and shows how many attempts are left, and three misses in a row lock the page out for 30 seconds. The password is checked on the server rather than in the browser, and the page always asks the server for the current state, so refreshing never shows a false "locked". In this demo the relay is simulated.

The Smart Safe page in its locked state with an empty password field
Locked
The Smart Safe page after a wrong password, showing two attempts left
Wrong password
The Smart Safe page unlocked, with an open padlock and a countdown bar
Unlocked