Useless Box

The Useless Box, created by: John Young & Tyler Hewitt

We created a wooden box that turns on using a push button and a lever pops out, which is powered by a Servo motor, that hits the push button that closes the box by the Servo motor reversing.

How it works:
Push button switch causes the Servo motor to rotate 180 degrees when there is a high power output. When there is a low power output, the Servo motor rotates the opposite 180 degrees. The lever turns the button off so the box closes. These components are powered by a power adapter plugged into a wall outlet. The Arduino is the brains of this operation. 




Fritzing Picture/Circuit Diagram:

Arduino Program:

#include <Servo.h>

int Pin = 9;                             //number of the servo pin.                 
int switchPin = 2;                    //number of the push button pin.
int val;                                    //Variables for reading the push button status.
int buttonState = 0;                 //"                                                                "
int buttonPresses = 1;             //"                                                                "

Servo myservo;                       //name of servo.

int pos = 0;                             //starting position of the servo motor

void setup ()
    pinMode (switchPin, INPUT);       //initialize the pushbutton pin as an input:
    Serial.begin(9600);                     //initialize the serial communication
    buttonState = digitalRead (switchPin);       //reads the state of the push button value.
    myservo.attach(9);                     //initializes the servo pin 9.
void loop()
    val = digitalRead(switchPin);      //reads the state of the push button status. 
    if (val==HIGH)                           //when the button is pushed, the servo rotates 160 degrees.
     pos = 160;                              //the degree the servo opens up to.
      myservo.write(pos);                //position of servo
      delay (15);                             //delays 15 milliseconds
    if (val==LOW)                          //when the button is pushed back to the initial position, the servo rotates back 90 degrees.
      pos = 90;                              //when at low power state, it rotates back 90 degrees
      myservo.write(pos);               //position of servo
      delay (15);                            //delays 15 milliseconds
Description of Problems:
debugging the code- we initially had the position of the servo motor wrong so once we fixed that it was able to run smooth from the command of the push button.
not being able to fit the bread board- found a way to solder the wires together to eliminate the need for the bread board.

If we had more time:
We would have liked to have a nicer box, preferably made of metal.