Secret Hollow Book Intrusion Detector
2018-03-20 | By Adafruit Industries
License: See Original Project Circuit Playground
Courtesy of Adafruit
Guide by John Park
Overview
The bad guys will always go for your safe to discover your secrets, so why not store them in plain sight with a hollowed out book? Or, perhaps you need to hand off an item to one of your operatives - use a hollow book as a dead drop, perhaps hidden amongst the stacks at a library or used book store...
This guide will show you how to build the classic secret hollow book safe. You'll also learn how to make a motion detection alarm using a Circuit Playground Express, and get a primer on the ultimate physical security app for Android - Haven.
Materials and Tools
You'll need an old book that is no longer wanted. A great source for these can be a thrift shop or the used book store at your local library.
Hardcover books are nice to work with, but you can use a soft cover just as well. Be sure the book is thick enough to hold your items.
To hollow and seal the book, you'll need:
- Utility knife with fresh, sharp blade
- Straight edge
- Speed square
- Pencil
- Small paintbrush
- Mod Podge or white glue
- A sheet of Mylar or plastic cling wrap
- Small clamps (optional, you can stack heavy items instead)
Optional Android
If you want to try out the Haven app for capturing whoever is snooping in your book safe, you'll need an Android phone. It doesn't need to be a new phone, as Haven was written to run well on older devices.
Hollowing the Book
Preparation
Step one is to seal the bulk of the pages and back cover of the book into a solid chunk, leaving the front cover and a few pages loose.
Gather your supplies and tools, then select the starting point for your hollowing - typically, you'll want to leave a few uncut pages at the beginning.
Insert your Mylar sheet or cling wrap at the page where you'll be cutting in order to mask the front cover and loose pages from the glue you'll use.
Glue Up
Using the brush, apply a liberal amount of glue around all of the edges of the pages. There's no need to put glue in between each page - the glue will soak in a bit and bind the pages, as well as the back cover.
Clamp It
Once you've glued the page edges on all three sides, it's time to press the book closed firmly and allow it time to dry.
Ideally, you'll use a set of spring clamps or c-clamps to hold the book closed during drying, about 30 minutes will do.
If you don't have any clamps, stack some very heavy objects on top of the book while it is sitting on a hard, level surface. You want the pages compressed together tightly. If you can't find anything suitably heavy, it's fine to put the book between two boards and sit on it. Seriously.
Measure and Mark
Once the glue has dried for at least 30 minutes, carefully open the front cover and loose pages, then remove the Mylar sheet or cling wrap. If there is any excess glue around the edges, trim it away with a hobby knife.
Using a straight edge/square and a pencil, mark the rectangle you'll cut for your hollow section.
Make the Cut
Use the straight edge as a guide, pushing down firmly, and then cut a few pages deep with the utility knife. You don't need to try to cut too deeply, this process works best if you cut moderate sections at a time.
Make a cut along each edge of your rectangle, then lift up and remove the cut section of paper.
Avoid pulling the paper out if it is stuck at a corner, and instead cut with the knife - the small leftover corner bits can start to build up!
After ten minutes or so, you should be at a pretty nice depth into the hollow. Avoid cutting down into the back cover! If you know of a specific object you'll be hiding in your book safe, make sure to test its depth as you're working so that the hollow doesn't come up shallow.
Glue the Hollow
Once you've gotten the hollow where you want it, it's time to seal the interior. Again, using your small brush, apply the Mod Podge or white glue to the page edges that form the inside walls.
Once you've sealed up the walls of the hollow, insert the Mylar sheet or cling wrap between the hollow page and the loose, uncut pages. This will protect the loose page from getting stuck to the glue while it's drying.
Clamp Time
Yes, it's that time again - Clamp Time! Close the book, then place it between two boards or books and clamp it all down tightly. C-clamps work really well for this, because we can generate a lot of clamping pressure. The boards help distribute the pressure evenly, in order to flatten the inside edges of the hollow, which tend to curl up during cutting and gluing.
Let the glue dry for at least a half an hour, then remove the clamps and boards. Carefully peel away the protective mylar sheet or cling wrap.
Your hollow book is ready for use! You can now hide your secret items in it and place it upon a shelf, or, go to the next page to learn to build a Circuit Playground Express alarm!
Building the Alarm
If you want to catch someone in the act snooping at your secret hollow book safe, you can build a small motion or light detecting alarm using a Circuit Playground Express (CPX) and MakeCode.
When the CPX detects motion or light, meaning the book has been moved or opened, you can have it sound an alarm. Then, you can rush into the room and catch the spy red-handed!
What if you're not around, and the spy resets the alarm? You can program the equivalent of the proverbial "hair taped across a door frame" trick by setting a color pattern in advance that changes if the CPX is disturbed. The spy will never know that they've left evidence of their misdeeds!
Motion Detection
First, let's build a motion detection alarm.
If you aren't familiar with using Make Code to create programs for your Circuit Playground Express, take a look at this excellent getting started guide. Once you're comfortable writing and uploading programs to your CPX, return to this page.
Orientation
We'll use the built-in accelerometer on the CPX to detect when the book is taken off the shelf laid on its "back" to be opened. The accelerometer can tell its orientation relative to the Earth's gravitational pull. When the CPX is laid "face up", for example, the accelerometer will report a strong pull value on the negative Z-axis.
In Make Code we'll use the accelerometer input block (found initially in the input category as "on shake") to check orientation. By switching the dropdown to "face up", it will run whenever the board is on its back with the positive Z-axis facing up, away from the ground.
No alarm sounds in this orientation
Z-axis facing up, alarm sounds!
The rest of the code is necessary to "flip a switch" with a variable named "alarm" when the CPX is face up. By setting the "alarm" variable's value to 1 when the board is set face-up, we can then have the siren continue to sound even when the board orientation changes. This means the spy snooping at your safe can't turn it off just by re-placing the book on the shelf!
You can download the code from the window below, and then place it on your CPX to test it out! Once you're annoyed by the sound, you can reset the CPX to stop it.
let alarm = 0
input.onGesture(Gesture.FaceUp, function () {
alarm = 1
})
alarm = 0
loops.forever(function () {
if (alarm == 1) {
music.playSoundUntilDone(music.sounds(Sounds.Siren))
}
})
Silent Detection
The motion alarm works great if you're nearby and can catch your spy in action. But, what about an alarm that will let you know later if your book safe has been opened, without alerting the spy? Perhaps you've planted some counter-intelligence or misinformation you want the spy to see, and just want to know for certain that it's been accessed.
We'll use a light detector as the input, and then, a secret pattern of LEDs to know when the book has been opened. The sneakiest part is this: even if the spy resets or turns off and on the alarm, you'll know about it!
This program is a little bit more involved than the motion detector, but mostly because it needs to keep track of a few different states.
Here's the basic flow:
- Turn on the CPX
- Two NeoPixels will turn red
- Arm it by flipping the switch right and pressing button A
- The NeoPixels all turn off
- You have two seconds to close it in the book to keep light off of the light detector
- When the book is opened for the first time, light will trip the "alarm", turning on all NeoPixels to a light blue for two seconds, then switch to just two yellow NeoPixels - this is how you know someone's been snooping!
If you check the book alarm and see it turn blue and then yellow, you know that nobody else has tripped it yet. If you check and the lights are already yellow, then it has already been tripped.
And, if the spy freaks out and tries to reset the alarm or turn it off and on, you'll know it, because the lights will be red. Only by entering the secret switch/button combination can you re-arm the alarm!
Tracking State
Once you've worked out the logical flow, the implementation comes down to creating variables that keep track of the various states, inputs that change these variables, and if-else statements that change the NeoPixels depending on the states of the various variables. These are:
- armed
- switchCode
- buttonCode
- tripped
- firstTrip
You will then create inputs, such as "on button A click" to switch the "buttonCode" variable from 0 to 1 when pressed.
Inputs
You will then create inputs, such as "on button A click" to switch the "buttonCode" variable from 0 to 1 when pressed. These are:
- on button A click
- on button B click
- on switch moved right
- on switch moved left
- on light bright
If-Else Comparisons
Based upon the established logical flow, the comparisons used in the if-else statements are:
- if the system hasn't been tripped (tripped == 0), check the button and switch states
- if buttonCode == 0 and/or switchCode == 0, the system is unarmed, two NeoPixels are lit red
- if buttonCode == 1 and switchCode == 1, set the NeoPixels black, wait 2 seconds, arm the system
- if the system is armed and the light sensor is triggered by light, set the tripped state to 1, and set the buttonCode to 0 and switchCode to 0, so they won't keep re-arming things over and over
- if the system has been tripped and it is the firstTrip, set all NeoPixels blue, pause 2 seconds, then switch the firstTrip state to 0
- if the system has been tripped, but it is not the firstTrip, set two NeoPixels to yellow
let firstTrip = 0
let tripped = 0
let switchCode = 0
let buttonCode = 0
let armed = 0
input.buttonA.onEvent(ButtonEvent.Click, function () {
buttonCode = 1
})
input.buttonB.onEvent(ButtonEvent.Click, function () {
buttonCode = 0
})
input.onSwitchMoved(SwitchDirection.Right, function () {
switchCode = 1
})
input.onSwitchMoved(SwitchDirection.Left, function () {
switchCode = 0
})
input.onLightConditionChanged(LightCondition.Bright, function () {
if (armed == 1) {
tripped = 1
buttonCode = 0
switchCode = 0
}
})
armed = 0
switchCode = 0
buttonCode = 0
tripped = 0
firstTrip = 1
input.setLightThreshold(LightCondition.Bright, 8)
light.setBrightness(10)
loops.forever(function () {
if (tripped == 0) {
if (buttonCode == 1 && switchCode == 1) {
light.setAll(0x000000)
loops.pause(2000)
armed = 1
} else {
armed = 0
light.showRing(
`black black red black black black black red black black`
)
}
} else {
if (firstTrip == 1) {
light.setAll(0x99ffff)
loops.pause(2000)
firstTrip = 0
} else {
light.showRing(
`black black yellow black black black black yellow black black`
)
}
}
})
Haven: Keep Watch App
A much more sophisticated way to keep electronic watch over your secret book safe's contents, is to run the Haven app on a burner Android phone. The open source Haven software was designed by The Guardian Project, the Freedom of the Press Foundation, Edward Snowden, and Micah F. Lee to turn any Android phone into a physical intrusion sensor.
Haven uses sound, light, vibration, and image motion detection to sense environmental change, store local logs of all activity, and can be configured to send alerts to your personal phone over SMS or with the end-to-end encrypted Signal app.
The app was built to run on older phones, so you can run it on an old Android phone you've got sitting in a drawer somewhere, or pick up a cheap burner phone. Install and configure the app as shown in the Haven docs. Once you've got it set up, you can hide it, along with your top-secret items, inside your hollow book safe!
Any snoop that comes along and finds your secret book will be photographed and recorded in the act, with an alert going to your personal phone immediately.
You could also modify your secret book with a small hole positioned in front of the phone's camera to create a hidden Haven device to keep watch over your whole room.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum