Project 2

Assignment

Create a physically interactive system of your choice. Your focus in this assignment should be on careful and timely sensing of the relevant actions of the person or people you’re designing for, and on a clear, prompt, and effective response. Remember that any interactive system involves listening, thinking, and speaking from both parties. Your project must demonstrate a clear and engaging physical interaction.

The interaction should be iterative (according to Crawford’s definition). Don’t just make a system where the user takes one action, the system responds, and it’s over. Make a system where the user sees the system’s response, and takes more action in response, in a continued loop.

Overview

I loved to saving coins for emergency use, especially for laundry. But I never have a proper container to hold them all. So for my final project, I wanted to make a coin robot that will eat the coins when users put their hands close to robot’s mouth. Also, I wanted to make a robot for emotional purpose that makes people smile and feels good. The target audiences are kids or someone who have need to in coins. And it’s fun for kids since the mouth has a sensor and will start to move when user put the hand close to it.

Parts

  • Arduino Nano
  • Distance sensor
  • Servo motor
  • Cable tie
  • Jump wire

 

WechatIMG83

Enclosure

The first step of my project was to ensure that I could get all of the components to function. Learning from my first project, I decided to start with enclosure. I knew I wanted my enclosure to be 3d printing, so I downloaded a 3D robot file online and did some iterations on sizes of the component. Overall, it was a success since I started the enclosure very early and I haven’t encounter any problem with 3D printing machine.

 

 

 

 Electronics

Screen Shot 2018-05-07 at 4.48.14 PM

The circuit is fairly simple. A servo motor uses 3 pins. Vcc and GND is essential. A PWM pin must be allocated with the servo motor.

The reason I choose Nano because it was way more compact than Uno which could help me to save spaces for storing components. Other than that, they both have same microcontroller(ATMega328/P) and they run exactly the same code.

Related image

This sensor is an infrared sensor. It is able to detect the presence of nearby objects. The sensor uses three wires. In order to read distance from an object, the Arduino needs to read analog signal from this sensor. I used pin A7 for obtaining the sensor value

WechatIMG85

In this circuit, all parts are connected with Female – Female Dupont Cable. In order to save space in the robot, I cut it and re-wire manually.

WechatIMG84

Continuing on, there are a few things that I’d change. First, I would 3D print the inner parts that separate out the coins and the electric components. In that way, the coins would not damage other parts when it drops. I also wanted to add a display that indicates how much coins does user put in the body in response to LED indication. I also noticed that I have to push down the robot’s hand every single time in order to get the response from the motor. This probably due to the connection between the body and the hand aren’t tighten enough. If I still have a few days to work on this, I’ll definitely make those iterations I mention above.

Here is the code

#include <Servo.h>

Servo armServo;

void setup() {
armServo.attach(12);
armServo.write(90);

pinMode(A7, INPUT) ;
pinMode(13, OUTPUT);
pinMode(0, OUTPUT);
pinMode(1, OUTPUT);
}

int sensorValue = 0;
int prevSensorValue = 0;
const int THRESHOLD = 360;
void loop() {

sensorValue = analogRead(A7);
if (prevSensorValue <= THRESHOLD) {
if (sensorValue > THRESHOLD) {
action();
}
}

prevSensorValue = sensorValue;
delay(10);
}

void action() {
led(true);

//eating
delay(1000);
armServo.attach(12);
armServo.write(10);
delay(300);
armServo.write(70);
delay(500);

//after ate
delay(100);
armServo.write(50);
delay(250);
armServo.write(70);
delay(250);
armServo.write(50);
delay(250);
armServo.write(70);
delay(250);
armServo.write(50);
delay(250);
armServo.write(70);
delay(250);
armServo.write(50);
delay(250);
armServo.write(90);
delay(250);

//release arm’s torque
armServo.detach();
led(false);
}

void led(bool onOff) {
if (onOff) {
digitalWrite(13, HIGH);
digitalWrite(0, LOW);
digitalWrite(1, LOW);
} else {
digitalWrite(13, LOW);
digitalWrite(0, HIGH);
digitalWrite(1, HIGH);
}
}