Introduction: B-Safe, the Portable Safe

About: My name is Bastiaan. I am 44 years old and one of my hobby's is designing and building stuff.

*** Sept 4th 2019 : I uploaded a new 3D file of the box itself. It seemed that my lock was 10 mm too high for a good close ***

The problem

Imagine this:

You wake up one morning and the weather is real good. You want to go to the beach.
Because you don't live too close to the beach, you take your car. To pay for the parking
at the beach, you use your phone.

This means that you go to the beach carrying (at least) the following items:

  • Car keys
  • Drivers License
  • Phone
  • Towel

What do you do with these items when you want to go for a swim?
You leave them unattended at your towel? Hmmm. This problem needs a solution ...

The solution

For the problem as described above, I created a portable safe. The B-Safe, where
the B stands for beach or for my name, Bastiaan. It's pronounced as Be Safe.

How does it work?

Each B-Safe has an own personal pincode programmed into it. When the B-Safe is off,
it's open. You put your important stuff, like keys, license and phone, inside the box,
flip the switch to turn it on, close and lock it and enter your personal pin.
The B-Safe is now armed and locked.

Whenever someone takes your box, one of the LED's will lit up for a few seconds.
If, after these few seconds, there is still movement, a loud alarm will sound. This will not
stop until you enter the right pincode again. But if you do enter the right pincode within
the moment of movement, the B-Safe disarms.

It is not recommended that you use the B-Safe on an empty beach. The idea is that when
someone walks or runs over the beach with a very noisy box, bystanders stop him / her.

To create this yourself, you only need to follow steps 3, 4, 5 and 6


Used supplies:

  • Arduino Leonardo (without pins)
  • Headerpins male 40 pins metal 90 degrees
  • Multiple jumpercables female/female
  • Switch Rocker Snap-in On/off rectangular black
  • Wire 1x0,2mm2 multicore flexible core black
  • Wire 1x0,2mm2 multicore flexible core red
  • Wire 1x0,2mm2 multicore flexible core yellow
  • a little piece of heat shrink tubes
  • LED 5mm red
  • LED 5mm green
  • speaker 3-24V
  • 9V battery
  • 9V battery connector
  • Resistor 120 Ohm 1/4w 5%
  • Resistor 100 Ohm 1/4w 5%
  • 3D printed box
  • 4x4 Keyboard
  • small piece of PCB board
  • small lock (I took one out of a safe box from Action)
  • 3-axis accelerometer MPU6050
  • some used screws from small "left-over" electronics like television remotes
  • several M3 screws
  • a little glue for the LED's
  • a lot of beer

Step 1: Prototype and Testing

For my prototype, I used a breadbord and some "plug-wires"
With everything connected, I started to create the Arduino code and tested, tested and tested it.
Connect everything different, re-write the code and tested it again.

Right until I was satisfactory and everything worked exactly the way I wanted it to.

Step 2: Wiring Schematics

The wiring is quite simple. Just use the schematics to wire everything.
Just try to use as short cables as possible, so everything will fit in the lid perfectly.

Step 3: Soldering

I measure all the wires so that they are not too long, cut them and strip the end. Then, I connect all the wires to the parts using a soldering iron. I also use heat shrink tubes. Make sure you put them (loose) on the cable before connecting the cable to a part.

The parts that I soldered are:

  • 90 degree angle connector pins on Arduino
  • 90 degree angle connector pins on keypad
  • wire to LED's
  • resistors on PCB
  • wire from speaker to PCB
  • power button

Step 4: 3D Print All Parts

I designed the whole box and everyhing with it in Autodesk Fusion 360. This took me a very long time because I wanted everything to be perfectly right how I wanted it. My first design had the Arduino on the bottom, but this final design has everything inside the lid. Inside the lid there are pre-made holes for securing everyhing with (M3) screws.

To print the parts, I use a Tronxy P802M (similar to a Prusa i3) with a bed of 200 x 200 x 220. I sliced the STL's using Ultimaker Cura. I made an export of the settings I used for Cura. You can download my Cura profile here.

I also uploaded my STL's here. There are four, the box itself, the lid, the lid cover and the knob on the lid.

Be aware: the box itself took me more than 24 hours to print !

Step 5: Load the Code

Because I'm still deciding whether or not to take the B-Safe into real production, I decided to put only a pre-compiled .hex file here. This .hex file is fully working and ready to upload into your Arduino.

The pre-compiled .hex file has a pincode of "9503"

If you'd like a customized pincode, drop me a line and I will send you a new .hex file with your own personal code.

Step 6: Assembling All the Parts

Assembling is, because of the design, quite easy. The keypad and the speaker fit perfectly in the lid. I uses some old (very tiny) screws from an old remote to secure the keypad to the lid.

The Arduino Leonardo and the piece of PCB are secured with M3 screws.

You can use a piece of filament (3D print wire) to secure the lid to the box itself. The holes in the lid and the box are 2 millimeter and the filament is 1.75 millimeter, so this fits perfectly!

The battery goes without securing it in the lid. Because of the lid cover and the immersed square in the lid, the battery won't move when putting the lid-cover. The same goes for the speaker and the on/off button. These also go unsecured in the lid.

The only thing glued are the LED's, but this is just a precaution to avoid them coming out when you push them on the outside.

For wiring the Arduino, the following pins are used:

  • Arduino digital 0 to 7 ; Keypad 1 to 8
  • Arduino digital 8 ; red LED
  • Arduino digital 9 ; green LED
  • Arduino digital 12 ; speaker
  • Arduino SCL ; MPU5060 SCL
  • Arduino SDA ; MPU5060 SDA
  • Arduino 5V ; MPU5060 VCC
  • Arduino GND ; GND on small PCB
  • Arduino GND ; 9V battery
  • Arduino VIN ; 9V battery

The reason I didn't use an electronic lock is because I couldn't find an electronic lock small and strong enough to make this design work. This is on my list of "changes for improvements" (step 8)

Step 7: Go to the Beach

The box is now finished and assembled.
Now it's time to go to the beach!

Small instructions on how it works:

  1. Open the (unlocked) box and put your important stuff inside
  2. Close, lock the box and take the key
  3. Put the box on the location where you want it to be
  4. Press the asterix ( * ) button - The box is now armed
  5. Go swim
  6. Take the box and enter your pin
    1. If you press the wrong password, you can use the pound ( # ) key to start over
  7. Unlock the box using your key

That's it! Have fun !!

Step 8: Changes for Improvement

Like every project, a good project is never truly finished. (Although I think it's a very good project :P) That's why I'm writing, (while I make this project), a list of improvement below:

  • better Arduino code
  • change the lock to an electronic lock instead of a mechanical lock
  • ability to change pincode manual (with Arduino code and EEPROM)
  • make a battery lid to replace battery more easy
  • make the speaker work on more than 5V using a "TIP120" transistor
  • replace the Arduino Leonardo for an Arduino Nano

If you have more improvements to add, please let me know!

Sensors Contest

Runner Up in the
Sensors Contest