Jessica CedroneScott Mendenhall
Published © GPL3+

Useless Robot

Just like the useless box, this useless robot does nothing productive except provide hours of mediocre fun, & it looks good on your desk!

BeginnerFull instructions provided8 hours1,602
Useless Robot

Things used in this project

Hardware components

Photon
Particle Photon
×2
4ft x 1/8in Diameter Metal Dowel Rod
×1
EMax ES08All Servo Motor
×3
Breadboard (generic)
Breadboard (generic)
×2
3D Printed Parts
Total of 10 different 3D printed parts
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Battery Pack - Max 6 Volts
We used a 6 Volt - 4.5 Amp Hr Power Sonic sealed rehcargeable battery
×1
Missile Switch
×1

Hand tools and fabrication machines

Screw Driver
Flat Phillips with Nuts (#4-40 x 1/2 in)
Pack of 14
3D Printer (generic)
3D Printer (generic)
Hacksaw
File
250 Grit Sand Paper
Super Glue

Story

Read more

Custom parts and enclosures

Base For Metal

Bone

Middle Connection

Middle Pivot

Post Stop

Servo Claw House

Servo House 1

Short Arm Cover

Short Claw Cover

Schematics

Switch Photon Circuit Diagram

This is the circuit diagram for the photon gathering the information from the switch.

Robot Photon Circuit Diagram

This is the circuit diagram for the photon that controls the motors and moves the robot.

Code

Switch Photon Code

C/C++
int flipswitch = D7;                                                    // physical missile switch is connected to D7 pin and D6 pin
int debounce;                                                           // ensures the publishing events happen only once when switch is turned on

void setup() {
    pinMode(flipswitch, INPUT);                                         // allows D7 pin to turn on LED
    pinMode(D6, OUTPUT);                                                // D6 pin is output connected to one end of switch
    digitalWrite(D6,HIGH);                                              // when switch turns on it will turn on D7 LED 
}

void loop() {
    if (digitalRead(flipswitch) == LOW)                                 // checks to make sure the switch was off before a publishing event can occur
        debounce = TRUE;
    
    if (digitalRead(flipswitch) == HIGH && debounce == TRUE) {          // limits publish to be when the switch is on and debounce is true
        Particle.publish("move", "switch");                             // sends the data to move the robot arm to the missile switch
        debounce = FALSE;                                               // resets 'debounce' so publish is not called repeatedly
    }
}

Robot Motor Photon Code

C/C++
Servo pivot, claw, arm;                             // create multiple servo objects

void move(const char *event, const char *data) {
        digitalWrite(D7, HIGH);                     // when event is received light turns on
        delay(3000);
        
        int taunts = random(5);                     // set initial amount of taunts to random 0 - 4
        while(taunts > 0) {                         // loop for decrementing the remaining amount of taunts
            int taunt_type = random(2);             // type of taunt to use on this interation (0 or 1)
            if(taunt_type == 0) {                   // runs taunt type 0 (open / close claw)
                claw.write(70 + random(45));        // open claw to random position (70° - 114°)
                delay(500);
                claw.write(50);                     // close claw
                if(taunts != 1)                     // only delay after closing the claw on NOT last time                     
                    delay(500);
            } else {                                // runs taunt type 1 (pivot arm UP)
                pivot.write(110);                   // move arm up to 110°
                delay(600);
                pivot.write(90);                    // lower arm back to original position
                if(taunts != 1)                     // only delay after closing the claw on NOT last time
                    delay(600);
            }
            taunts--;                               // decrement the number of remaining taunts
        }
        
        delay((random(6)) * 1000);                  // delay turning off of switch up to 5 seconds (5000ms)

        pivot.write(45);                            // lower arm to switch (and flip it)
        digitalWrite(D7, LOW);                      // turn off indicator light
        delay(750); 
        pivot.write(90);                            // return to original position
}

void setup() {
    pivot.attach(D0);                               // attach each servo to PWM pins
    claw.attach(D2);
    //arm.attach(D1);                               // the servo was shorted so we are no longer using 'arm'
    
    pivot.write(90);                                // set each servo's initial position
    claw.write(50);
    //arm.write(90);                                // the servo was shorted so we are no longer using 'arm'
   
    pinMode(D7, OUTPUT);                            // enable output for the indicator light

    Particle.subscribe("move",move);                // subsribe to second particle for data on move function
}


void loop() {
 
}

Credits

Jessica Cedrone

Jessica Cedrone

1 project • 1 follower
Scott Mendenhall

Scott Mendenhall

3 projects • 8 followers
Mechanical Engineering Student at UNC Charlotte

Comments