MOTION ACTIVATED HALLOWEEN SPIDER

DIY TIME - This Halloween, scare Trick-or-Treaters with an automated spider that drops down when someone walks in front of your Sumo Robot!

DIY TIME - This Halloween, scare Trick-or-Treaters with an automated spider that drops down when someone walks in front of your Sumo Robot!

What will you need?

  • Sumo Robot Kit

  • Fishing line

  • Hook or Pulley

  • Fake Spider

  • 3D Printer

  • Optional: 3D Modeling Software

What will you learn about?

  • Speed of Sound

    • Rotational velocity and Speed

    • Timing and intervals

    • Circumference

 

 

Steps:

  1. This activity assumes you have an already assembled Sumo Robot League kit. If you do not, please assemble following the instructions included with your kit.

  2. Pick your location for scaring trick-or-treaters and determine where you want to place your robot. Mark the spot on the ceiling above where your spider will drop and attach your hook or pulley. Measure the maximum horizontal distance to detect passersby that you want to attack. After that, measure the distance from your robot to the ceiling hook. Then determine how far from the hook your spider will hang while it waits for a victim, and how far it will drop when it attacks.

  3. Add the distances from your robot to the hook together with the vertical distances for the start and finish of your attack, and add a few inches for your knots at each end to make sure your fishing line is long enough.

  4. 3D print a spindle wheel (Sample Download Link) and attach fishing line

    1. You can customize this step by designing your own spindle. Increasing the radius will increase the speed of your spider’s attack, but be careful. When you increase the radius, you increase the amount of torque required to carry your spider. Challenge your friends to see who’s spider can attack the fastest and still be able to climb back up.

  5. Determine the inner circumference of your spindle so that you will know how many revolutions it takes for your spider to travel the distance needed for it’s attack.

  6. Remove your robot’s motor wheel and replace with loaded spindle wheel. Unwind enough line and feed it over the ceiling hook and back down. Then tie spider to fishing line and wind/unwind the fishing line so that your spider is in position to attack.

  7. Now that your robot and spider are setup and ready to attack, they just need the code to do it successfully. Here is the basic code to do it, but in order to dial in the perfect attack you’ll need to adjust your variables to set the appropriate sensor distance and motor run times.

    1. ( Sensor Loop Hint: the robot’s ‘eyes’ bounce high frequency sound off objects to detect distance. If you know the speed of sound you can calculate how long it should take for sound to travel to and from an object at the distance you want )

    2. ( Spider Attack Hint: remember that circumference calculation? At full speed, your motor should spin at approximately 150 RPM. How many revolutions do you need for your attack distance and how long will that take?)

This is your code to copy and paste into your IDE   (select the appropriate pin assignments for you board)

// use these pin assignments if your circuitboard is red
#define echoPin         A0
#define leftSensor      A1
#define rightSensor     A2
#define rearSensor      A3
#define buttonPin       2
#define pingPin         3
#define leftDirection   4
#define buzzerPin       5
#define IREmitter       6
#define LED             7
#define rightDirection  8
#define leftMotorSpeed  9
#define rightMotorSpeed 10

// use these pin assignments if your circuitboard is black
#define echoPin         A0
#define leftSensor      A1
#define rightSensor     A2
#define rearSensor      A3
#define buttonPin       2
#define buzzerPin       3
#define IREmitter       4
#define leftMotorSpeed  5
#define rightMotorSpeed 6
#define leftDirection   7
#define rightDirection  8
#define pingPin         10
#define LED             13


void setup() {
  pinMode(pingPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(leftDirection, OUTPUT);
  pinMode(rightDirection, OUTPUT);
  pinMode(leftMotorSpeed, OUTPUT);
  pinMode(rightMotorSpeed, OUTPUT);
  pinMode(leftSensor, INPUT);
  pinMode(rightSensor, INPUT);
  pinMode(IREmitter, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP);
}

void loop() {
  long notes[5] = {};
  long duration;
  for (int i = 0; i < 5; i++) {
    digitalWrite(pingPin, LOW);
    delayMicroseconds(2);
    digitalWrite(pingPin, HIGH);
    delayMicroseconds(10);
    digitalWrite(pingPin, LOW);
    duration = pulseIn(echoPin, HIGH);
    Serial.print(" Ping: ");
    Serial.println(duration);
    notes[i] = duration;
  }
  if (duration <= 9000)
    spider();
  delay(100);
}

void spider() {
  digitalWrite(leftDirection, HIGH);
  analogWrite(leftMotorSpeed, 0);
  digitalWrite(rightDirection, LOW);
  analogWrite(rightMotorSpeed, 250);
  delay(2500);
  digitalWrite(rightDirection, LOW);
  analogWrite(rightMotorSpeed, 0);
  delay(5000);
  digitalWrite(rightDirection, HIGH);
  analogWrite(rightMotorSpeed, 250);
  delay(2500);
  digitalWrite(rightDirection, LOW);
  analogWrite(rightMotorSpeed, 0);
  delay(5000);
}

Other Challenge Activities:

Can you use both motors so that two spiders attack from different positions or intervals?

Can you incorporate scary sounds with your robot’s piezo buzzer to make trick-or-treaters jump even more?