Introduction: The Mystery Box

This instructable was created in fulfillment of the final project requirements of the MakeCourse at the University of South Florida.(www.makecourse.com)

My name is Kenny Simmons and I am a mechanical engineer at the University of South Florida. This is an instructable on my final project "The MysteryBox".

The box is a self opening and closing prop that can be used in a variety of ways. I hope that you enjoy the tutorial on how to create your own!

Step 1: Make or Purchase Your Box.

This instructable was created in fulfillment of the project requirements of the MakeCourse at the University of South Florida(www.makecourse.com)

The first thing that you are going to want to do is either design and construct your own Mystery Box or simply purchase one that is already pre-constructed. (NOTE: to avoid complications in later steps, try to make the lid as light weight as possible.)

If you choose to make your own, the style that you may wish to design will be in that of an ammo crate.(Any rectangular box design will work but it is preferred to have an ammo crate.)

  1. Design the Box - As previously stated you may use whatever dimensioning that you choose. If this is your first project, I recommend going smaller scale and working up to a larger project once you have some practice. Here is a list of the dimensions for the pieces that I used for this project(NOTE: ALL SIZES ARE IN INCHES! ALL THICKNESS IS 0.5). LID - (2pc.) 24 x 3.5. FRONT/REAR - (4pc.) 23(3/4) x 3(1/4). R/L SIDES - (4pc.) 7(1/2) x 3(1/4). BOTTOM - (2pc.) 23(1/2) x 3(9/16). LID SUPPORT - (3pc.) - 6(3/4) x 1(1/2). This should give you a total of 15 pieces for your box. On this project, I used molding on every edge with exception for the top. This will give the box a cleaner look.
  2. Create A Frame - You will want to create a frame of the perimeter of your box and clamp it to your work bench. This step will help with constructing and gluing your box together. All that you will need to do here is measure the outside perimeter of the box and (using spare wood) construct the frame so that the box piece fit together snug. With the help of frame you may now begin to glue your project together. The frame will allow you to keep the box straight and allow you to leave it unattended while the glue dries.
  3. Glue the Box - Once you have properly assembled the frame, perform a dry run of the construction using the BOTTOM, R/L SIDES and FRONT/REAR pieces. This step is important because it will show you if any measurements are incorrect. If there are any measurements that are off, NO WORRIES, simply make the necessary modifications and repeat this step. Once you are sure that you are ready to glue then one by one add glue to the appropriate are and return to the frame. Make sure that all areas are glue and then clamp the parts in place. Allow for time to adhesive to dry.(TIP: I would recommend using the WOOD GORILLA GLUE)
  4. Creating the Top - While your box top is drying you can construct the lid. What you will need here are the two TOP pieces and the three support pieces. Measure the width of the box base and set the two outer edges of the 2 top pieces accordingly( there will be a gap. This is for aesthetics.). Then space the three supports evenly across the box top and glue in place.( I recommend using a heavy weight to apply pressure) When this is done let the box lid dry.
  5. Adding the Top - Once the box base and the lid are completely dry you can now put on the final component. Space the hinges so that they rest between the first and second lid support and the second and third lid support. Make sure that the lid is centered on the box. Depending on the thickness of your lid you may either want to drill or screw on the hinges by hand. For this project , because the thickness of the wood is at 0.5, I chose to hand screw on the hinges.
  6. Finished - Your box is not finished and ready for you to add the mechanical and electrical systems.

Step 2: The Electrical System

For this step you will need the following :

1.) Arduino Uno

2.) Proximity Sensor (HC-SR04)

3.) (2pc.) Servo Motors (HiTec HS-311)

4.) 2 LED Lights

5.) 2 220 ohm Resistors

6.) Lithium Ion Polymer 3 cell Battery (11.1V)

7.) Voltage regulator (2596-SDC)

The electrical system will allow the user to interface with the proximity sensor to enable the system. The system will be controlled by the Arduino. (Programming code for the Arduino will be in the next step.) The Arduino will tell the servo motors to simultaneously rotate at a 90 degree angle to allow the 3D printed parts to open and close the top of the box. It will also trigger the LED sequence, creating a nice visual effect. Below are the steps for setting up the electrical system.

  1. Connect the Arduino to your computer.
  2. Connect battery to voltage regulator and set regulation to 7.2 Volts(needed by HiTech Servos)
  3. Connect 7.2 volts to the RED pin of the servo motor and BLACK to Ground pin of the motor. Make sure that you connect the ground of the Arduino to the ground of the servo motor.
  4. Connect the signal pin of the motor to a digital pin on the Arduino that is capable of pulse width modulation(PWM)
  5. Connect your proximity sensor to the Arduino. Ground to Ground, VCC to 5v on the Arduino, Trigger and Echo pins to digital pins on the Arduino.
  6. Connect the 2 LEDs to the Arduino. Make sure that the longer leg of the LED is connected to positive ( as these are polar devices) and the short leg to negative. You will also have to have a 220 ohm resistor connect in series with each LED.

Step 3: The Code for the Arduino

#include <Servo.h> // include the servo library that comes with the Arduino

#define LIGHT1 7 // Define the variables

#define LIGHT2 8

#define ECHOPIN 2

#define TRIGPIN 3

Servo myservo1;

Servo myservo2;

////////////////////////////////////////////////////

int UseSensor();

int UseSensor

{

int duration; // This sequence uses the proximity Sensor

digitalWrite(TRIGPIN, LOW);

delayMicroseconds (2);

digitalWrite(TRIGPIN, HIGH);

delayMicroseconds(5);

digitalWrite(TRIGPIN,LOW);

duration = pulseIn(ECHOPIN, HIGH);

return duration/29/2; // converts to cm for distance finder

}

////////////////////////////////////////////////////////////

void CloseBox(); // Creates the function for the CloseBox in the main loop

void CloseBox()

{

for (int I=15;i<=150;i++)

{

myservo1.write( i); // Since the motors are facing opposite directions, this portion

myservo2.write(180-i); // of code will allow them to rotate in sync and in the same direction.

delay(25);

}

}

/////////////////////////////////////////////////////////////

void OpenBox(); // Creates the OpenBox loop for the main function

void OpenBox()

{

int flag=0;

for (int I=150;i>=25;i - -) // Beginning of motor for loop

{

myservo1.write( i);

myservo2.write(180-i);

if ((i%2)==0) // Modulus triggers action and allows the led to blink

{

if (flag==0)

{

digitalWrite(LIGHT1,HIGH);

digitalWrite(LIGHT2,LOW);

}

if (flag==1)

{

digitalWrite(LIGHT1,LOW);

digitalWrite(LIGHT2,HIGH);

}

flag=!flag; // this command will reverse the value of the flag

}

delay(25);

} // motor loop end

digitalWrite(LIGHT2,LOW);

digitalWrite(LIGHT1,LOW); // This will shut both LEDs off.

} // end of function

///////////////////////////////////////////////////////////

void setup(){

Serial.begin(9600);

myservo1.attach(11); // Declaration for the control pin of the servo

myservo2.attach(10);

pinMode(LIGHT1,OUTPUT); // Sets the pins for output voltage or and in input sensor.

pinMode(LIGHT2,OUTPUT);

pinMode(TRIGPIN,OUTPUT);

pinMode(ECHOPIN,INPUT);

CloseBox();

}

void loop(){

if (UseSensor()<=35)

{

OpenBox(); // starts loop when proximity sensor is triggered

delay(5000);

CloseBox();

}

delay(50);

}

// END OF CODE

Step 4: The Mechanical System

Once you have finished programming the Arduino you are ready to insert the electrical system into the box and connect it to the mechanical system. The mechanical system lever arms attached to the servo motors and will drive the opening and closing of the box lid. These servos are the same two servo motors that were programmed in the previous step. The following steps will get the mechanical system in place and up and running.

  1. Attach the servo motors to the lever arm systems. Attached are pictures of this system. The lever arms and bases are 3D printed.
  2. Attach the servo motor to the rear inside panel of the box. You are going to want to put the gear system as close to the top of the box base as possible. You will also want to place the motor directly under the outer support beams for the lid top.
  3. Finally you must drill 2 holes appox. 0.5 in diameter for your proximity sensor in the front lower center of your box for user interaction.

Step 5: Finalizing

The final step is making sure that your system functions with the box. With your proximity sensor in place make sure that your 11.1 volt battery is connected and your Arduino is programmed. You should now be able to wave your hand in front of the proximity sensor and open and close your box.