Introduction: Mimic Chest

This is my first time using and creating something with arduino! So I decided to make a mimic chest that would shut down when you try to take the treasure inside.

Supplies

  • Aurduino uno
  • 2 servo moters
  • 9v batterij
  • battery connector
  • wiring set
  • Touch sensor

Step 1: Concept and Measuring

My first time working with aurduino i wanted to make something simple, that my friends would find funny and endearing. This made me think of the classic game enemy; The mimic.


First up draw the simple idea of what you want to create. Decide what size your atributes need to be.


First get or make a chest and figure out its measurements. Keeping in mind the size and force the moters "arms" need to shoot the top of the chest open.

figuring out before you start were the moters should go, because it could change the sizing.


Step 2: Coding

#include <Servo.h>
const int TOUCH_SENSOR_PIN = 7;
const int SERVO_PIN        = 9;
const int SERVO_PIN2        = 10;


Servo servo;
Servo servo2;

int angle = 12;        
int lastTouchState;  
int currentTouchState;

void setup() {
  Serial.begin(9600);              
  pinMode(TOUCH_SENSOR_PIN, INPUT);
  servo.attach(SERVO_PIN);        
  servo2.attach(SERVO_PIN2);        

  servo.write(angle);
   servo2.write(angle);
  currentTouchState = digitalRead(TOUCH_SENSOR_PIN);
}

void loop() {
  lastTouchState    = currentTouchState;            
  currentTouchState = digitalRead(TOUCH_SENSOR_PIN);

  if(lastTouchState == LOW && currentTouchState == HIGH) {
    Serial.println("The sensor is touched");

    // change angle of servo motor
    if(angle == 12)
      angle = 55;
    else
    if(angle == 55)
      angle = 12;

    // control servo motor arccoding to the angle
    servo.write(angle);
     servo2.write(angle);
  }
}


To make sure the chest can open up without gravity taking over, you have to consider by how many degrees you want the servo to move. So start calculating by how many degrees you need the top to move.

In my case 90 degrees would flip the entire top over so I had to calculate what degree would open op the chest the right amount.

Step 3: Arduino

during and after the coding you of course need to make the connections on the audrino board. Try to keep your strings short especially if your box is on the smaller side.

I connected my servo's to 10 en 9 next to eachother, and the touch sensor to 7 slightly appart just so I woudn't confuse them.

I recommend connecting your project to a battery but it would still work if you plugged it into your laptop/pc.

Step 4: Physical Elements

you ofcourse need a chest! you can make one and get everything exactlly the sizes you want. You need to create a fake bottom to keep you wiring, battery and of course your arduino board. So take a good look at your sizing.

The space i had for my stuff was 169mm by 100mm needing a board to hold my servo's had a with of 3mm. So for the fake floor i had to make a board that was 169 by 97. However I needed arms to hold the top side of the chest. So i had to keep the placement of the servo's in mind. See images for those calculations.


The fake floor I cut out of wood and the arms are 3d printed. For the 3d prints I sugest making it taller than you need it to be and then cutting of what you dont need. Just to be safe!


Step 5: Finalizing

First of course solder your wiring for safety and security. Then figure out the placement of you assets. Carefully place your fakefloor on top to hide your wiring. make sure your touch senor can lie on top of the fake floor. lastly I put some fake money on top! originally I wanted to use chocolate coins that would touch the senor so the chest would close when you'dd take it of, but alas I coudn't find any :'(