# Don´t Mess With Da Monkey

156

2

1

Published

## Introduction: Don´t Mess With Da Monkey

This useless robot will panic if you get very close. By shaking its arms it will try to push you away but truth is this monkey needs love!

Material Needed:

Servo Motor 1 (HS-422)

Servo Motor 2 (HS-805)

Ultrasonic Range Detector

Mainboard

Wires

0.5mm Plexiglass

0.5mm plastic

strong glue

double side tape

EPS Polystyrene

Foam board

## Step 1: Designing the Monkey

The first step for building our robot is to decide on its shape. We used Rhino to define the geometry of the parts and the inner gear system and later created a laser file.

## Step 2: Cutting the Parts

Our lovely monkey is made out of different pieces which have been laser cut out of a 0.5mm polystyrene sheet. Each of the parts is layered out of two pieces of 0.5mm polystyrene to provide estability to its core gear system. This means that the parts have to be cut twice.

## Step 3: Assembling the Body

The monkey parts fit perfectly together. The articulations are glued to the outer layers and the three layers (front and back outer layers and inner gear system) are later put together with some subtle double sided tape. We decided to cut one of the outer layers of the monkey out of transparent plexiglas to allow to see through into the working of the inner gear system.

## Step 4: Understanding the Circuit

The movement of the monkey robot will be triggered by the proximity of humans. An ultrasonic sensor will give an input whenever somebody gets too close to the robot and will activate two servo motors. One of them will provide the movement to the arms and the other will spin around the whole body of the monkey.

## Step 5: Creating the "engine"

In order to give the monkey the power to move and express his feelings we installed two servo motors on it. One will help him move his arms and the second servo will help him spin around his whole body.

## Step 6: The Code

The following code was used to cotrol the robot. Two different levels of panic are defined depending in the distance from a human to the monkey: the closer the human, the stronger the panic.

```#include <br>#define trigPin 7
#define echoPin 6
Servo firstServo;
Servo secondServo;
int sound = 250;
//
void setup()
{
firstServo.attach(8);
secondServo.attach(3);
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop()
{
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(2);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
//
if(distance < 20){
firstServo.write(90);
secondServo.write(10);
delay(350);
firstServo.write(150);
secondServo.write(90);
delay(350);
Serial.println("the distance is less than 20");
}
if(distance > 21){
firstServo.write(0);
secondServo.write(0);
delay(2700);
firstServo.write(180);
secondServo.write(180);
delay(2700);
Serial.println("the distance is larger 40");
}
}```

## Recommendations

• ### Arduino Class

69,085 Enrolled

• ### Casting Contest

We have a be nice policy.