Stash ProjectBuilding a hidden compartment behind a wall mirror.
This work is distributed under the ISC license.
Copyright (c) 2019, Dmitriy Drozdov
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Here are all the details for a weekend project code name "Stash". Well, not really a weekend, more like 2 or even 3 weekends.
But most of the time was spent on waiting for PCBs to arrive.
Mechanical part really is up to your imagination. In my case I used an openingin the wall. Plugged the back side with drywall,
added some framing, a Chinese safe (super high top security... not) and welded a rectangular support for the sliders. That support
can swing just enough to take one edge of the mirror out of the lock.
Front side, mirror is open
Rear side, no drywall yet
It does not have to be a door. This project can be used whenever the electric lock can be fit. Like a drawer int your desk.
The lock that I used is from Ebay. 12V lock, pretty decent construction. If you want this exact one look for the following description: "Automatic Bolt Electric Magnetic Lock Door Access Control Cabinet Drawer DC 12V".
Here you can see it mounted with a lever that pushes it mechanically up to open without
using the electronic part. Like it done in similar projects, magnet is used to push that lever through the drywall.
Yellow wire is for a push switch, that is pushed in by the metal frame when the compartment is locked. Any N/O switch will work.
For an N/C switch a little change in the software required. The wooden part on which the lock is mounted can slide along another part to
adjust the lock engagement.
Lock assembly
Electronic part of the project is based on a Raspberry PI. I used the Raspberry PI 3 A+. But it is an overkill. Only used if because I was writing/debugging the
software right on that device, connecting with VNC. I also tried Raspberry PI Zero W (wi-fi) and it works just fine.
Actually, two Raspberries are involved. The second one is running the HomeBridge software and is also used for other devices. HomeBridge runs on
RPi 3 B+ so it is very shooth.
The RPi that serves the lock/sensor has a custom board attached to it (people call such boards "a hat"). It is used to convert RPi's voltages (5V and 3.3V) into
12V to power the lock. There are some high current components for the lock too. This way no additional power supply is needed and the whole assembly
(RPi + the controller hat) can work from the regular 5V power supply with a micro USB connector.
Schematic. All components are noted there.
Note: I used components that I had "in stock". That is why there are some through-hole components and some SMDs. Same with the electrolytic capacitors - single
cap could be used, but I had 1000 uF ones and just used those. The photo below is of the earlier board version (1.2) and has a little bug, fixed in V 1.3.
Assembled board (V 1.2)
Component layout
Component side
Back side
Software, responsible for receiving the controlling requests over the HTTP protocol and controlling the RPi's GPIO can be downloaded in the "link" area on the left. Use "make" to compile on your RPi.
It is based on 2 projects - "nweb23" by Nigel Griffiths and "PJ_PRI" by Pieter-Jan. PJ_RPI is modified to allow automatic detection of
RPi model and the GPIO memory offset. Official PJ_RPI files could probably be used too, but you will have to define the version of RPi yourself.
Changes in nweb23.c:
- port 80 is the default, no need to specify port number if 80 is going to be used
- removed all file-serving functionality. All html/json content is generated inside
- added POST request processing to make it look similar to a REST service
- default request "/" generates a simple page with lock status and a button to open it
Screenshot of the default
HTML, generated by the
stash.c program.
HomeBridge plugin can be downloaded in the "link" area on the left. The lock can be unlocked without it by using a web browser, but
the plugin adds more fun - you can unlock the stash with your voice or the homekit app and you will receive notifications when
sensor detects changes in the lock's state.
HomeBridge plugin uses the "lock mechanism" profile so you would need to unlock the device (iPhone, iPad, Apple Watch) first.
Otherwise Siri will decline the request. To enable notifications the plugin polls the lock's status every 10 sec.
If you find this work useful, please, let me know in the comment area on Youtube. Or send a note using the contact form link below.