For my midterm project I wanted to make something more challenging and thought-out. After a lot of brainstorming, I noticed something that I have several of… secret storage boxes disguised as books.
I decided to make a safe that is disguised as a book, and make it so that it can only be locked/unlocked if a combination of gestures were done. I was at first going to use wood for the entire safe, but decided to use a combination of wood, cardboard, and transparent acrylic to make it more interesting. The paper part of the book is made from acrylic, so that if someone picked up the book from a shelf, they would see that it is not a normal book. So the transparent acrylic I decided to use is a twist to the point of safes, which is to keep objects hidden safe, in secret. The transparent barrier would let them see the money and valuables inside it, but no matter what they tried, they would not be able to open it, because only its owner would know the correct combination of gestures. This project was inspired by a combination of my love for Harry Potter and Sherlock Holmes. I didn’t notice this when I actually made it, but the safe box is a combination of the two storage boxes in the first image above. Although I had originally not thought of using transparency, the final result of my work was somehow subconsciously a mix of the two boxes, using the book-like shape of one and the transparent sides and solid top and bottom of the other.
I thought of adding a buzzer to make a sound when the person got the code wrong or an alarm after 3 wrong tries, but I thought that that wouldn’t make as much sense for my idea, because I want people to think that the box does not open, and a buzzer would give it away, and encourage them to try again. For this reason I also decided not to use any LEDs. I initially had a different combination of gestures, also using an up gesture, but decided to not use it as results were inconsistent with the up gesture.
materials/equipment:
-wood
-handsaw
-cardboard
-transparent acrylic
-laser cutter (for the 3 acrylic pieces)
-servo
-ZX gesture sensor
-Breadboard
-Redboard
-Jumper wires
-Glue (I mainly used acrylic glue, super glue, and a glue gun)
-paper (for book cover) – I printed and used the cover of the ‘getting started with Arduino’, which was co-written by Michael Shiloh, an NYUAD IM professor. I initially thought of using this cover just as a pleasant and funny surprise for the professor, since I knew he would be there when showing our projects, but this was perfect because not only did the color of the sensor match the color scheme of the cover but there was also a UNO board on it, that I put my sensor on to disguise.
I was a bit worried that because the gesture wasn’t too complex, it would open easily if people did any gesture, but it was great, and very entertaining I might add, to watch everyone try to guess how to open it and not be able to, until they eventually gave up and let me show them how it’s done! The product turned out how I wanted it to, and worked consistently.
#include <Servo.h> #include <Wire.h> #include <ZX_Sensor.h> //const int ZX_ADDR = 0x10; int gestureSequence[] = { 0, 1, 2 // 0 is right swipe and 1 is left, 2 is up }; int index = 0; const int ZX_ADDR = 0x10; ZX_Sensor zx_sensor = ZX_Sensor(ZX_ADDR); bool leftGestureStarted = false; bool rightGestureStarted = false; bool upGestureStarted = false; int prevZ = 240; uint8_t x_pos = 0; uint8_t z_pos = 0; Servo myservo; void setup() { // put your setup code here, to run once: uint8_t ver; myservo.attach(9); Serial.begin(9600); Serial.println(); Serial.println("-----------------------------------"); Serial.println("SparkFun/GestureSense - safebox"); Serial.println("-----------------------------------"); if ( zx_sensor.init() ) { Serial.println("ZX Sensor initialization complete"); } else { Serial.println("Something went wrong during ZX Sensor init!"); } ver = zx_sensor.getModelVersion(); if ( ver == ZX_ERROR ) { Serial.println("Error reading model version number"); } else { Serial.print("Model version: "); Serial.println(ver); } if ( ver != ZX_MODEL_VER ) { Serial.print("Model version needs to be "); Serial.print(ZX_MODEL_VER); Serial.print(" to work with this library. Stopping."); while (1); } // // Read the register map version and ensure the library will work ver = zx_sensor.getRegMapVersion(); if ( ver == ZX_ERROR ) { Serial.println("Error reading register map version number"); } else { Serial.print("Register Map Version: "); Serial.println(ver); } // if ( ver != ZX_REG_MAP_VER ) { Serial.print("Register map version needs to be "); Serial.print(ZX_REG_MAP_VER); Serial.print(" to work with this library. Stopping."); while (1); } myservo.attach(9); } void loop() { // put your main code here, to run repeatedly: //gesture stuff int gesture = -1; if (zx_sensor.positionAvailable()) { x_pos = zx_sensor.readX(); z_pos = zx_sensor.readZ(); if (x_pos != ZX_ERROR) { Serial.print("X: "); Serial.print(x_pos); } if (z_pos != ZX_ERROR) { Serial.print(" Z: "); Serial.print(z_pos); } Serial.print(" Index: "); Serial.print(index); Serial.print(" Left Started: "); Serial.print(leftGestureStarted); Serial.print(" Right Started: "); Serial.print(rightGestureStarted); Serial.print(" Up Started: "); Serial.println(upGestureStarted); // ===================== // if (z_pos < 220 && index < 3) { // Serial.println("z less than 100"); if (leftGestureStarted == false && rightGestureStarted == false && upGestureStarted == false) { if (x_pos > 130 && x_pos < 200) { leftGestureStarted = true; } else if (x_pos < 110 && x_pos > 80) { rightGestureStarted = true; } // else if (x_pos > 110 && x_pos < 170 && z_pos < 40) { // upGestureStarted = true; // } } } } else { leftGestureStarted = false; rightGestureStarted =false; upGestureStarted = false; } //then in another if statement if (leftGestureStarted == true) { if (x_pos < 100) { gesture = 1; leftGestureStarted = false; } } if (rightGestureStarted == true) { if (x_pos > 130 ) { gesture = 0; rightGestureStarted = false; } } // if (upGestureStarted == true) { // if (z_pos > 60) // { // //Copy and Paste // gesture = 2; // upGestureStarted = false; // } // } // then check if the gesture is the current correct gesture: if (gesture >= 0) { if (gestureSequence[index] == gesture) { index++; } else { index = 0; Serial.println("wrong gesture"); } } if (index == 2) { myservo.write(0); // 3 in this case because we have 4 gestures so starting from gesture 0=> counting 0,1,2,3 // unlock safe delay(3000); index=0; } else myservo.write(90); prevZ = z_pos; }