IMG_6316.JPG

itp

Week 6 Fabrication: Mounting Motors

This week’s assignment was to mount a motor, and then mount something to that motor. I knew I wanted to use my micro servo motor, and that I wanted there to be an interaction component. I was also interested in using the ultrasonic sensor.

The idea for the HANDS-OFF came from the high five game we all learned as kids (high five/ down low, too slow.) I wanted to create a hand that would move away from a person’s hand when they reached for it.

Materials

  • Cardboard

  • Arduino

  • Micro-servo

  • Ultrasonic sensor

  • Various jumper cables

  • Duct tape

  • Stickers

  • Hot glue

Tools

  • Calipers

  • Laser cutter

  • Scissors

Method

I originally planned to buy my motor mount. However, I was gone all weekend, and when I visited Tinkersphere on my way back, they didn’t have the kind of mount I needed. I ended up measuring the servo with calipers and lasercutting a mount out of cardboard. It took a few tries to get the tolerance right.

IMG_7174.JPG

I then laser printed five pieces to create a box that I could attach the mounted servo to, and that would tidily enclose the arduino and sensor. I also laser printed the arm and hand. I bought extra attachments for the servo, and chose to hot-glue the cardboard hand to the attachment.

The cardboard box didn’t look very inviting or interesting, so I wrapped it in green duct tape and added some stickers.

IMG_7192.JPG
IMG_7186.JPG
IMG_7184.jpg

The code that ran the servo, for anyone interested:

#include <Servo.h>

#define trigPin 11

#define echoPin 12

Servo servo;

int sound = 250;

void setup() {

Serial.begin (9600);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

servo.attach(3);

}

void loop() {

long duration, distance;

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;

if (distance < 30) {

Serial.println("the distance is less than 20");

servo.write(0);

}

else {

servo.write(90);

}

if (distance > 60 || distance <= 0){

Serial.println("The distance is more than 60");

}

else {

Serial.print(distance);

Serial.println(" cm");

}

delay(500);

}