loading

How to build another useless machine: easy to make, and hard to use!

Featured
Picture of How to build another useless machine: easy to make, and hard to use!
So many useless machines are built, why building another one? Simply, it is really fun :), fun to build and fun to play with.

I tried to give this version a character, as I always felt there is somebody  "thinking inside the box", so here I tried, I hope I succeeded to give "her" a life!

I am really happy to share with you all the steps, with all hopes that you will be easily building yours and giving it a bitter or better character! My version is based on Arduino, you may think it is an overkill, but given the flexibility it gave me, I think it is worth it.

Here is a video of everything  put all together. Later, we will move into the parts, steps, schematics and code

Let me know your comments and/or questions if any.

Hope you enjoy!
f.

 
Remove these adsRemove these ads by Signing Up

Step 1: How it works?

Everything is connected to an Arduino board, the board waits till the switch is set to logic HIGH , that is, when you flick the switch, the board signals two servo motors to move in a specific way (more on that later), after which, the servo connected to the "hand" will flick the switch back to OFF-position, and return back into the box, followed by the "door" servo. then everything repeats.

If you saw the above video, each time the switch is toggled, the machine responds in a different way, and this is done by simply writing different functions with different timings in the Arduino code, (I am calling them "Moves"). Each time the switch is toggled, I am calling a new move until all are done, I start over. note that in step 9, I provided another version of the code that picks random moves instead of sequential. You can add as many moves as you want, as long you have enough memory on the Arduino.

The Arduino is always ON, this is why I added a switch for the battery to save some power when the machine is not in use. I am already planning to use an interrupt on the switch, instead of the current simple HIGH/LOW detection, and coupling it with sleep mode. This shall save power when the machine is not in use ,and also allowing it to be always ready (but this will also complicate the code) So, for now, it is just a simple ON/OFF switch, and the board is always powered.

Step 2: The parts

You will need:

Mandatory:

1. A box 
2. Any Arduino board with PWM outputs (I happen to have an old one laying around, the Diecimila)
3. Two standard RC servo motors (I used the Futaba - S3003, they have 3,2 Kg/cm torque, more than enough to move the door or hand)
4. A 6-12 V battery (I used my AR drone battery, it is a 11.1 v / 1000 mA) 
3. An SPTT or SPST switch for the trigger (basically, any switch that suits you!)
5. Another switch for the battery
6. A push button to reset the Arduino in case you want to restart the moves/code from top.
7. Some jumper wires


Optional:

In case you want to design a move that includes moving the box around (like last move in the video), then you can get:

1. An Arduino motor shield, this will also be handy for other projects (or you can design an H-bridge yourself, search it out)
2. A cheap RC car so you can take its DC motor and gear box

Furthermore, still in the "optional" section, I've built a hardware de-bounce circuit to have a clean trigger when the switch is toggled on/off. This can be skipped and easily be implemented in arduino software using delays or timers. I did the hardware debounce because I will be soon changing the code to use interrupts, and since the latter do not allow the reliable use of delay/timer functions in the routine, so I had to build a simple de-bounce circuit for future use. If you want to skip this part, then  just connect a simple switch/resistor to pin 2 of the arduino and implement a software debounce routine.

For the hardware debounce:

1. 10mF electrolytic capacitor
2. 10K resistor
3. A logic NOT gate i.e Inverter (chip 74HC04) This has six inverters, but you will only need one.

Let's build it...

Step 3: Building the box

Picture of Building the box
You can use any box you find suitable. I built mine, maybe not perfect, but still much personal :)

1. I used 2 sheets of 5mm BALSA wood, very easy to work with using a cutter, and relatively strong given its incredible light weight.
2. Consumed 5 tubes of Cyanoacrylat glue (aka strong fast-acting adhesives)

Here it is:

A 22 x 14 x 14 cm box

Step 4: Schematic

Picture of Schematic
Above is the schematic (drawn using Fritzing), showing:

Top part: The arduino main board ,2 servos and switch connectivity. Note that as mentioned previously you can replace the whole debounce (top-right) circuit with a simple resistor/switch.

Both "door" and "hand" servos are powered directly from the 5v pin on the Arduino. The signal wires are connected to pin 9 and 10 respectively. These pins supports PWM, thus I am using them to control the angle/position of the servo (from 0 to 180 degree max).

Note: the red push button is just a reset (similar to the one found on the face of the arduino board). I added it to have quick access to reset the board/software at any time without opening the box. Simply connects the RESET pin to Ground to make the reset.  

Bottom part: needed if you want to use a DC motor and move the machine around. This is the arduino motor shield, it is mounted on top of the Arduino, so all of the pins of both boards are connected to each other. I am showing them below as separated just for clarity, hopefully! This shield can control up to 2 DC motor (2 channels A/B) with incredible ease. I am using only one now. It allows to set in the code, the direction, speed and breaks of any of the available 2 channels/motors. I am using channel B as shown bellow. where pin 
13 for direction, pin 11 for speed and pin 8 for brakes control.

The battery is a 11.1 / 1000 mA, connected to the shield, thus feeding the DC motor , the main arduino board and the servos. if you are not using the shield, then you can directly connect the battery to the power barrel on the main arduino board.


Step 5: Fixing the servos

Picture of Fixing the servos
20130929_014328.jpg
ServosnHands.jpg
Here is the hand and door servos installed:

You need first to install the servos in their correct places, this needs a bit of trial and error until you get the needed movement. You can use the Servo example provided in the arduino IDE in order  to test the servos and the amount of deflection needed for each, and thus decide on the final positioning and arms length for the door and hand servos.

The arms are simply made from balsa wood, I made them thicker to withstand some tearing.

Below is how I did it. Just one note about the hand servo. You will need the servo shaft to be directly under the edge of the cover (as shown below), this to avoid having hard time in making a hand that can successfully hit the switch, and also be able to go back into the box.




Step 6: Connecting the switch, servos and Arduino

Picture of Connecting the switch, servos and Arduino
Make all the connections seen in the schematic step, and try to put all inside the box similar to what's shown above:



Step 7: Optional: the DC motor and battery

Picture of Optional: the DC motor and battery
Above is how I put the DC motor gear box (taken from a cheap RC car), also showing the batter and switch placement.

Make sure to place the gear as centered as possible to balance the box, you may need to put some weight inside the box to balance it more after final assembly, as the battery I used is a bit heavy (100 gr) and caused some wiggling when switching or moving the box. 

Note that the dc motor speed is controlled by pin 11, Direction by pin 13, and brakes on pin 8, these are considered channel B on the arduino motor shield.

Through out the assembly I tried to hide all wires switches and other components in order to have a simple authentic box. This applies to the wheels, so I made a rim around them that hosts both the wheels and battery, and also provides access to the red reset button.

Step 8: The code

In order to write code for arduino, you need the arduino IDE (download it here)

I am using the version 1.0.5, just make sure to select the correct COM port (windows) and board type from within the IDE, then use the below code, and hit upload.

NOTE: The values I used in the code to set the max deflection of the servos are made exactly for this box taking in account the servos positioning, axis and angles. I got this through trial. So you need to devise your own values according to your box and servo placement.

For reference, below are the min/max values I used for each servo as you will see them occurring in the code:

The door:
80 hiding, 155 fully open

The hand: 
0 hiding, 129 pushing on switch


Here is the code (Better to download the file attached to this step instead of copy/paste from below):

#include <Servo.h>
Servo doorServo;
Servo handServo;

int switch_pin = 2;               //set switch on pin 2

//motor variables
int motorThrottle=11;
int motorDirection = 13;
int motorBrake=8;

int pos = 0;
int selectedMove = 0;             //move selector
int Testmove = 0;                 //test mode: set to move number to test only one selected move
                                  //(set to Zero to run normally i.e: roundrobbin on amm moves)

void setup()
{
  Serial.begin(9600);
  pinMode(switch_pin, INPUT);
  doorServo.attach(9);           //set door servo on Pin 9 pwm
  handServo.attach(10);          //set hand servo on Pin 10 pwm
  doorServo.write(80);           //set door to hiding position
  handServo.write(0);            //set hand to hiding position
 
  //Setup Channel B, (since Channel A is reserved by door and hand servos and can't ber used at same time)
  pinMode(motorDirection, OUTPUT); //Initiates Motor Channel B pin
  pinMode(motorBrake, OUTPUT); //Initiates Brake Channel B pin
 
}


void loop()
{
if (Testmove != 0) {
selectedMove = Testmove;
}
 
  //if the switch is on, then move door and hand to switch it off...
  if(digitalRead(switch_pin) == HIGH)
  {
   
  if (selectedMove > 10) { selectedMove = 0; } //when all moves are played, repeat the moves from beginning
  // below are all the "Moves" i designed so far, each is a function that is written below in the code, execuse the names, abit strange? yes as some are written in arabic
  if (selectedMove == 0) { switchoff(); }
  else if (selectedMove == 1) { switchoff(); }  
  else if (selectedMove == 2) { switchoffbitaraddod(); }
  else if (selectedMove == 3) { crazydoor(); }
  else if (selectedMove == 4) { crazyslow(); }
  else if (selectedMove == 5) { m7anika7anika(); }
  else if (selectedMove == 6) { m3alla2(); }
  else if (selectedMove == 7) { switchoff(); }
  else if (selectedMove == 8) { matrix(); }
  else if (selectedMove == 9) { sneak(); }
  else if (selectedMove == 10) { zee7(); }
  
  if (Testmove == 0) {
  selectedMove++;         //swith to next move if not in test mode
  }

}
}



// Library of moves

   // basic move
   void switchoff()
   {   
   //Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 129; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    } 
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
   }
    
   // move 3: open and wait, then move hand and wait, then switch of and hide 
    void switchoffbitaraddod()
   {
  //Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    delay(800);
    //Moving hand
    for(pos = 0; pos < 100; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
    delay(1000);
    for(pos = 100; pos < 129; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }   
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=5)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                   
    
    
   }
    
   }
 
   //move 4: open door then close it many times, wait, then quickly reoprn a nd switch off and hide.
 
   void crazydoor()
  {
   
   //Moving door
    for(pos = 80; pos < 125; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
 
    //hiding door
    for(pos = 125; pos>=80; pos-=5)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
   //Moving door
    for(pos = 80; pos < 110; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
 
    //hiding door
    for(pos = 110; pos>=80; pos-=15)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
    delay(700);
   //Moving door
    for(pos = 80; pos < 125; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    delay(700);
    //hiding door
    for(pos = 125; pos>=80; pos-=5)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }

   
    //----of switch of----//
  //Moving door
    for(pos = 80; pos < 155; pos = 8)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 129; pos = 3) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    } 
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=3)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=15)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }   
   
  }  


// move 5: open door, then move hand very slowly forward and back to hiding very slowly, then quickly close door
void crazyslow()
{

//Moving door
    for(pos = 80; pos < 155; pos = 1)  
    {                                  
    doorServo.write(pos);             
    delay(30);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 129; pos = 1) 
    {                                  
    handServo.write(pos);              
    delay(30);                      
    } 
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=1)     
    {                               
    handServo.write(pos);              
    delay(30);                       
    }
     
    //hiding door
    for(pos = 155; pos>=125; pos-=1)    
    {                               
    doorServo.write(pos);             
    delay(30);                     
    }
    delay(100);
    for(pos = 125; pos>=80; pos-=4)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }    
   

}

//move 6:

void m7anika7anika() {

//Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    
    //Moving hand
    for(pos = 0; pos < 70; pos = 1) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
    delay(800);
   
   
    //hiding door
    for(pos = 155; pos>=130; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }
   
    //hiding door
    for(pos = 130; pos < 155; pos =3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }
     //hiding door
    for(pos = 155; pos>=130; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }  
    //hiding door
    for(pos = 130; pos < 155; pos =3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }
    
    handServo.write(40);
    delay(1000);
     
    //Moving hand
    for(pos = 40; pos < 129; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
   
     
    for(pos = 120; pos>=80; pos -= 1)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
  
    
}

void m3alla2(){
//Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 127; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
    //hiding door
    for(pos = 155; pos>=130; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }  
    delay(2000);
   
    for(pos = 130; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
   
    for(pos = 155; pos>=140; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }
    for(pos = 140; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    delay(500);
    //hiding hand
    for(pos = 127; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }

}
  
void matrix()
{

//Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 80; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
   
    for(pos = 80; pos < 129; pos = 1) 
    {                                  
    handServo.write(pos);              
    delay(30);                      
    } 
    delay(300);
   
    for(pos = 129; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(10);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
 
}

void sneak()
   {   
   //Moving door
    for(pos = 80; pos < 130; pos = 1)  
    {                                  
    doorServo.write(pos);             
    delay(30);                      
    }
    delay(2000);
   
    //Moving hand
    for(pos = 0; pos < 40; pos = 1) 
    {                                  
    handServo.write(pos);              
    delay(30);                      
    } 
       
    delay(500);
   
    for(pos = 130; pos < 155; pos = 4)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    delay(100);
   
    for(pos = 40; pos < 90; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    } 
    delay(500);
    //hiding hand
    for(pos = 90; pos>=70; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
    delay(100);
    for(pos = 70; pos < 90; pos = 4) 
    {                                  

    handServo.write(pos);              
    delay(15);                      
    }
    delay(100);
    for(pos = 90; pos>=70; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
    delay(100);
      
    for(pos = 70; pos < 129; pos = 4) 
    {                                  

    handServo.write(pos);              
    delay(15);                      
    }
   
    for(pos = 129; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }   
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
   }
  
  
   void zee7()
   {   
   //Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
   delay(2000);
   //forward @ half speed to the left 
   digitalWrite(motorDirection, LOW); //Establishes RIGHT direction of Channel B
   digitalWrite(motorBrake, LOW);      //Disengage the Brake for Channel B
   analogWrite(motorThrottle, 100);    //Spins the motor on Channel B at full speed
   delay(300);
   digitalWrite(motorBrake, HIGH); //Eengage the Brake for Channel B
   delay(2000);
  
   //backward @ half speed to the right
   digitalWrite(motorDirection, HIGH); //Establishes LEFT direction of Channel B
   digitalWrite(motorBrake, LOW);   //Disengage the Brake for Channel B
   analogWrite(motorThrottle, 100);   //Spins the motor on Channel B at half speed
   delay(300);
   digitalWrite(motorBrake, HIGH); //Eengage the Brake for Channel B
   delay(1000);
 
    //Moving hand
    for(pos = 0; pos < 129; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    } 
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
   }




Step 9: Optional Update: Movement detection

Picture of Optional Update: Movement detection
I've got a proximity sensor today (GP2Y0A21), so now I can use it to move the machine if the user approaches the toggle switch :)

For this additional step, I am assuming you've already built the wheels to allow movement (see optional step 8). All what is left now is to add the sensor and make some modifications in the code for movement detection.

The sensor has 3 wires, yellow signal wire connected to pin 3 on arduino, while the red and black are connected to v5 and ground respectively on the board.

I've placed the sensor hidden under the door as shown in the picture, thus it can 'see' the user's movement only when the door opens. exactly what I need!

I had also to change the code a bit (here) to implement a movement detection routine (see the code, in function zee7()), such that when movement is detected, the box will move, first to the right, then to the left, then the hand flips the switch and hide. The code is heavily commented, I hope I didn't overdo it!

You can find the updated code below, also note that I've made the machine picks the moves randomly, this can be changed back to sequential by simply setting boolean randomize = false;

Thanks ALL for your great suggestions!

The code (Better to download the file attached to this step instead of copy/paste from below):

#include
Servo doorServo;
Servo handServo;

unsigned long TimerA,TimerB;       //timer for the movement detection routine
int switch_pin = 2;               //set switch on pin 2

//motor variables
int motorThrottle=11;
int motorDirection = 13;
int motorBrake=8;

//Distance Variables
int motionPin = 3;               //motion sensor pin on analog 0
int lastDist = 0;                //to remember last distance
int currentDist = 0;  
int thresh = 200;                //Threshold for Movement (set it such that you get the desired sensetivity of motion detection)


int pos = 0;
int selectedMove = 0;             //move selector
int Testmove = 0;                 //test mode: set to move number to test only one selected move
                                 //(set to Zero to run normally i.e: roundrobbin on all moves)
boolean randomize = true;        // if true, the box will do movers randomly, if set to false then the moves will be done sequencially from 1 to 10


void setup()
{
  Serial.begin(9600);
  pinMode(switch_pin, INPUT);
  doorServo.attach(9);           //set door servo on Pin 9 pwm
  handServo.attach(10);          //set hand servo on Pin 10 pwm
  doorServo.write(80);           //set door to hiding position
  handServo.write(0);            //set hand to hiding position
  //Setup Channel B, since Channel A is reserved by door and hand servos and can't ber used at same time
  pinMode(motorDirection, OUTPUT); //Initiates Motor Channel B pin
  pinMode(motorBrake, OUTPUT); //Initiates Brake Channel B pin
 
}


void loop()
{

  //if the switch is on, then move door and hand to switch it off...
  if(digitalRead(switch_pin) == HIGH)
  {
   
  if (Testmove == 0)
  {
     
    if(randomize == false)
    { 
      if (selectedMove > 10)
      {
      selectedMove = 0; //when all moves are played, repeat the moves from beginning
      }
    }
    else
    {
    selectedMove = random(11);
    }
  }
  else
  {
  selectedMove = Testmove;
  }
  Serial.println(selectedMove);
  if (selectedMove == 0) { switchoff(); }
  else if (selectedMove == 1) { switchoff(); }  
  else if (selectedMove == 2) { switchoffbitaraddod(); }
  else if (selectedMove == 3) { crazydoor(); }
  else if (selectedMove == 4) { crazyslow(); }
  else if (selectedMove == 5) { m7anika7anika(); }
  else if (selectedMove == 6) { m3alla2(); }
  else if (selectedMove == 7) { switchoff(); }
  else if (selectedMove == 8) { matrix(); }
  else if (selectedMove == 9) { sneak(); }
  else if (selectedMove == 10) { zee7(); }
  
  if (Testmove == 0 && randomize == false) {
  selectedMove++;         //switch to next move if not in test mode
  }

}
}

// Library of moves

   // basic move
   void switchoff()
   {   
   //Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 129; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    } 
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
   }
    
   // move 3: open and wait, then move hand and wait, then switch of and hide 
    void switchoffbitaraddod()
   {
  //Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    delay(800);
    //Moving hand
    for(pos = 0; pos < 100; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
    delay(1000);
    for(pos = 100; pos < 129; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }   
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=5)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                   
    
    
   }
    
   }
 
   //move 4: open door then close it many times, wait, then quickly reoprn a nd switch off and hide.
 
   void crazydoor()
  {
   
   //Moving door
    for(pos = 80; pos < 125; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
 
    //hiding door
    for(pos = 125; pos>=80; pos-=5)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
   //Moving door
    for(pos = 80; pos < 110; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
 
    //hiding door
    for(pos = 110; pos>=80; pos-=15)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
    delay(700);
   //Moving door
    for(pos = 80; pos < 125; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    delay(700);
    //hiding door
    for(pos = 125; pos>=80; pos-=5)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }

   
    //----of switch of----//
  //Moving door
    for(pos = 80; pos < 155; pos = 8)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 129; pos = 3) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    } 
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=3)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=15)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }   
   
  }  


// move 5: open door, then move hand very slowly forward and back to hiding very slowly, then quickly close door
void crazyslow()
{

//Moving door
    for(pos = 80; pos < 155; pos = 1)  
    {                                  
    doorServo.write(pos);             
    delay(30);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 129; pos = 1) 
    {                                  
    handServo.write(pos);              
    delay(30);                      
    } 
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=1)     
    {                               
    handServo.write(pos);              
    delay(30);                       
    }
     
    //hiding door
    for(pos = 155; pos>=125; pos-=1)    
    {                               
    doorServo.write(pos);             
    delay(30);                     
    }
    delay(100);
    for(pos = 125; pos>=80; pos-=4)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }    
   

}

//move 6:

void m7anika7anika() {

//Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    
    //Moving hand
    for(pos = 0; pos < 70; pos = 1) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
    delay(800);
   
   
    //hiding door
    for(pos = 155; pos>=130; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }
   
    //hiding door
    for(pos = 130; pos < 155; pos =3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }
     //hiding door
    for(pos = 155; pos>=130; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }  
    //hiding door
    for(pos = 130; pos < 155; pos =3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }
    
    handServo.write(40);
    delay(1000);
     
    //Moving hand
    for(pos = 40; pos < 129; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
   
    //hiding hand
    for(pos = 129; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
   
     
    for(pos = 120; pos>=80; pos -= 1)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
  
    
}

void m3alla2(){
//Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 127; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
    //hiding door
    for(pos = 155; pos>=130; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }  
    delay(2000);
   
    for(pos = 130; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
   
    for(pos = 155; pos>=140; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);
    }
    for(pos = 140; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    delay(500);
    //hiding hand
    for(pos = 127; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }

}
  
void matrix()
{

//Moving door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
  
    //Moving hand
    for(pos = 0; pos < 80; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    }
   
    for(pos = 80; pos < 129; pos = 1) 
    {                                  
    handServo.write(pos);              
    delay(30);                      
    } 
    delay(300);
   
    for(pos = 129; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(10);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
 
}

void sneak()
   {   
   //Moving door
    for(pos = 80; pos < 130; pos = 1)  
    {                                  
    doorServo.write(pos);             
    delay(30);                      
    }
    delay(2000);
   
    //Moving hand
    for(pos = 0; pos < 40; pos = 1) 
    {                                  
    handServo.write(pos);              
    delay(30);                      
    } 
       
    delay(500);
   
    for(pos = 130; pos < 155; pos = 4)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    delay(100);
   
    for(pos = 40; pos < 90; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    } 
    delay(500);
    //hiding hand
    for(pos = 90; pos>=70; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
    delay(100);
    for(pos = 70; pos < 90; pos = 4) 
    {                                  

    handServo.write(pos);              
    delay(15);                      
    }
    delay(100);
    for(pos = 90; pos>=70; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
    delay(100);
      
    for(pos = 70; pos < 129; pos = 4) 
    {                                  

    handServo.write(pos);              
    delay(15);                      
    }
   
    for(pos = 129; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }   
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
   }
  
   //this move will open the door and wait for movement, if detected near the switch,
   //the box will move first to the Right, and then to the Left, and finally the hand moves and turns off the switch
   void zee7()
   { 
    
   //open door
    for(pos = 80; pos < 155; pos = 3)  
    {                                  
    doorServo.write(pos);             
    delay(15);                      
    }
    delay(1200);    //wait to stabilize sensor readings after opening the door
     
     // set the timer and read the sensor
     // wait for movement that exceeds threshold or if timer expires (5 sec),
     lastDist= analogRead(motionPin);  
     TimerA= millis();
    
     while(millis()-TimerA <= 5000)
     {
        currentDist = analogRead(motionPin);
    
        //Does the current distance deviate from the last distance by more than the threshold?
        //if yes, then move box to the right
        if ((currentDist > lastDist thresh || currentDist < lastDist - thresh) || currentDist > 300)
         {

          //forward @ half speed to the left (choose the speed and the delay
          //(i.e delay(300) according to you box and battery voltage such that the movement throw is desirable)
          digitalWrite(motorDirection, LOW);  //Establishes RIGHT direction of Channel A
          digitalWrite(motorBrake, LOW);      //Disengage the Brake for Channel B
          analogWrite(motorThrottle, 100);    //Spins the motor on Channel B at full speed
          delay(300);
          digitalWrite(motorBrake, HIGH); //Eengage the Brake for Channel B
          break;
          }
     lastDist = currentDist;  
     }
   
      // set the timer and read the sensor
      // wait for movement that exceeds threshold or if timer expires (5 sec),
      delay(1200);  //wait to stabilize sensor readings after opening the door
      lastDist= analogRead(motionPin); 
      TimerB= millis();
      while(millis()-TimerB <= 5000)
      {
        currentDist = analogRead(motionPin);    
        //did the box already move to the right and the current distance deviate from the last distance by more than the threshold?
        //If yes, then move to the Left
        if ((currentDist > lastDist thresh || currentDist < lastDist - thresh) || currentDist > 300)
         {

          //backward @ half speed to the right (choose the speed and the delay
          //(i.e delay(300) according to you box and battery voltage such that the movement throw is desirable)
          digitalWrite(motorDirection, HIGH); //Establishes LEFT direction of Channel B
          digitalWrite(motorBrake, LOW);   //Disengage the Brake for Channel B
          analogWrite(motorThrottle, 100);   //Spins the motor on Channel B at half speed
          delay(300);
          digitalWrite(motorBrake, HIGH); //Eengage the Brake for Channel B
          break;
          }
     
      lastDist = currentDist;  
  
      }
    delay(100);
    //Moving hand
    for(pos = 0; pos < 130; pos = 4) 
    {                                  
    handServo.write(pos);              
    delay(15);                      
    } 
   
    //hiding hand
    for(pos = 130; pos>=0; pos-=4)     
    {                               
    handServo.write(pos);              
    delay(15);                       
    }
     
    //hiding door
    for(pos = 155; pos>=80; pos-=3)    
    {                               
    doorServo.write(pos);             
    delay(15);                     
    }
   }
1-40 of 168Next »
areyoutrying8 months ago

Thanks for this! I made my first Arduino project based on this instructable: a useless dragon!

Awesome!!!!!
riachi (author)  areyoutrying8 months ago

You are awesome :) !!!

Great personality for a Dragon! I wish you can redo the video while having the dragon directly facing the camera (top-view), I feel this will be hilarious, so see the tongue sneaking out!

Thanks for sharing your video and glad my i'able has helped

I tried top view in an earlier stage but it didn't work (saw too much of the messy insides) so I dismissed it when I took this video. I think you are right though: in the final stage it would've looked great! Unfortunately I already gave the dragon away... So on to the next project!

melton1313 made it!6 months ago
Code helped a lot. Thanks
temp_-763798353.jpgtemp_1909007649.jpg
riachi (author)  melton13136 months ago

AWESOME!! :) would be great if you an post a video too :)

melton1313 riachi6 months ago
Thanks
https://www.youtube.com/watch?v=3HPCv-IgJT8
br1pro7 months ago
Very fun! hard job fixing the servos and design the hand. Thanks for this instructable!
temp_-2137509751.jpg
riachi (author)  br1pro6 months ago

Great work man! really nice :) any video?

clincoln1 year ago
Watch the video on it first then laugh you ass off
TobiasV clincoln8 months ago

I know I did ! :D

rileyw1 year ago
Super cool the video made it seem like it had a mind of its own
My useless machine with arduino and riachis code! Made into a tardis from Dr.who. :)

https://www.youtube.com/watch?v=aDs0T52o6-M
riachi (author)  Elitekilla1171 year ago
LOVE IT!!!! :)) really well done man, so happy to see your bombbox alive! I also the dramatization and the music :p just can't stop myself to suggest 3 small modifications if i may:)?

- it would be great to put the machine in standing position, i know that this will make lose the help of gravity to close the door, but a simple solution is to put 2 rubber bands attached to the inside of the door on one side and to the inner side of the box for the other end, this will make the door close when the door servo is closing...check my build steps,you will see the rubber band in Step 6...

- also what about painting the hands in black, it will be more sneaky and slick
! Also the hand tip can be painted in bloody red or decorated with a crazy face or something like that..

- remove the last move as nothing happens in it(supposed to be the one the moves the box) and write your own move...

Nevertheless, forget the suggestions,i loved your machineeee! And thanks for the so many thanks man, please you can reduce them and keep the video focused on the machine :)

Hope your gf liked it!
Hahah Thank you for the compliments :) I actually wanted to do much more to it but because of the time crunch I couldn't fit in a lot of the details i wanted to. I would like to add some color to the arms but didn't have time for those. And I wanted to draw a face on the arm with a sharpie but its already wrapped up and ready to give to her for Christmas. Hehehe. I think she'll love it. I also did want to have it stand up but was afraid the rubber bands would put too much weight on the servos. The door is already pretty heavy. The last move I kept because it keeps you in suspense waiting for it to pop out. Hahaha but I appreciate all the help my friend! Definitely worth it!
This I have to make...it's awesome
wrs7151 year ago
This is the first project I've seen using an Arduino where I thought, "Yeah, that's worth it. Now I have to get one." Fantastic job!
Wow, awesome take on a common project! Love your spin on making it more interesting!
bob30301 year ago
One man's useless device is another's totally awesome, out of this world, we'll thought out, fun to have, coveted by many, useless device. Thanks for your updates to the project. Thanks for posting.
wobbler1 year ago
Thought 1: Using an Arduino for this is just ridiculous overkill
Thought 2: After watching the video-Using an Arduino for this is just pure genius!

I bow down to your creativity!
stumitch1 year ago
Thats seriously great! Kind of reminds me of a Wall-E personality. Thanks for such a great project!
Truly useless! Nice 'ible. I'm inspired and need to build one for my desk. Thanks.
robot7971 year ago
PLEASE TAKE MY MONEY
i realy realy want that thing
makendo1 year ago
Glad I watched the video to the end. It was already entertaining, but the twist was brilliant.
alzie1 year ago
Ha, i nearly pissed my self watching the vid!
Got some personality.
Way cool, well done.
rpotts21 year ago
Finally! A Christmas present my in-laws will enjoy! I love thus!
jpow1 year ago
Best useless machine I've seen! It is on my build list... for sure! I have lots of RC stuff, so all I need is an arduino now :)

thanks for sharing!
diy_bloke1 year ago
fantastic!
lowpro1 year ago
So awesome!
This is useless...
I like it !! ^.^
nice job, like how you make it "come to life"
chaosrob1 year ago
This is awesome. Can't wait to see all your improvements and (maybe) a new video. This is a great candidate for a halloween candy bowl... thingiee! Instead of physical switch, a photo resistor to detect candy removal. KEWL.... keep it up!
riachi (author)  chaosrob1 year ago
go for it chaosrob! let me know if i can help!
bob30301 year ago
Cool. Very creative adding the "taunting" and "side" moves. You have inspired me to add this to my list of projects . Thanks for posting and sharing.
riachi (author)  bob30301 year ago
Please let me know when you build yours! thanks
Patrick S1 year ago
I like the personality! Very funny
KåreN217 days ago

Thank you for sharing this with us. I started making my box. But instead of the rc engine i have a 5v smoke generator. I ordered the same parts you listed eaven the engine shield. Can i just change the dc engine with my smoke and change the code a little in the end? Eaven if its not nessesary will it work? And also will my batteri be okei to use?

Snapshot_20150712.JPGSnapshot_20150712_1.JPG
KåreN217 days ago
thecrazylol28 days ago

problem: the code works, but it does th emoves over and over, even if the switch isn't on. i think that is a problem with the debounce, i don't understand how i implement a software debounce? can anyone help me?

zaphod542 months ago

Well, it's finished. The hardest part is definitely the woodworking to create the mounts for the servos, and mostly the fingers to lift the lid and turn the switch off, and affixing it all to the box/servos.

BUT, I'm having an issue with the code. The moves work fine individually when I set TestMove to a single move, but when I turn it back to sequence through, the sequence doesn't progress through as I expect. It seems to mostly do the main move, and occasionally throw one or two of the other moves in, yet never hit a couple of the later moves at all.

zaphod54 zaphod542 months ago

Well, I figured out WHAT is wrong, but haven't figured out WHY yet. I noticed that almost every time the switch is thrown and the unit operates, the yellow light on the board flashes like the Reset button is being pressed, or the power switch was turned off and back on. But every now and then, it does NOT reset (the yellow light does not flash) on an operation, and then it transitions to the next routine correctly. But it never makes it beyond about the 3rd routine before the board resets again. So I've got to have something in the electrical circuit that's causing the board to reset. OR, I wonder if the board has enough power that maybe the power dips low enough when the servos are moving that it resets the board. I'm powering it off of 8 AA batteries. Eventually I'll used rechargeables but right now they are just alkalines.

1-40 of 168Next »