Monkey Monkey

For my automaton I made a swinging monkey using a cereal box, three plastic knives, real leaves and an arduino with servo. I used a simple sweep code for the servo and attached the monkey to the knife (for support) which is attached to the servo. Sadly, the monkey’s limbs are magnetic so the hand and feet kept sticking together. In general, though, this was a very fun project to work with and show people.

IMG_3823
Untitled Sketch_bb

#include  
 
Servo myservo;  // create servo object to control a servo 
                // twelve servo objects can be created on most boards
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
void loop() 
{ 
  for(pos = 0; pos < = 120; pos += 1) // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 120; pos>=0; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
} 

please don’t touch me : sensor display

I enjoy the idea that a computer can have the capacity to feel and relay back those feelings, so I wanted to create a simple default, visual state for the computer. The default state is represented by a loop of three ellipses (like an ellipsis), and when this state is interrupted by the touch of a person the program responds with a very human-like response.

 

Screen Shot 2014-11-12 at 16.05.58

DSC05539

Screen Shot 2014-11-12 at 15.24.07

 

 

Processing Code:

import processing.serial.*;
Serial myPort;


int valueA;  // Sensor Value A
int valueB;  // Sensor Value B

int count = 2;

//------------------------------------
void setup() {
size(600, 200);


smooth ();
// List my available serial ports
int nPorts = Serial.list().length;
for (int i=0; i &lt; nPorts; i++) {
println("Port " + i + ": " + Serial.list()[i]);
}


String portName = Serial.list()[2];
myPort = new Serial(this, portName, 9600);
serialChars = new ArrayList();
}
//------------------------------------

//------------------------------------
void draw() {

// Process the serial data. This acquires freshest values.
processSerial();

background (130);

// moment sensor is touched, text shows
if (valueA &gt; 5) {

textSize (25);
fill (180);
text ("please stop, i don't feel like being touched", 50,45);

// this sets up ellipses to loop
}
else{
if(count&lt;50){
noStroke ();
fill(240);
ellipse(250,100,20,20);
count++;
}
else if(count&lt;100){
fill(240);
ellipse(250,100,20,20);
ellipse(300,100,20,20);
count++;
}
else if(count&lt;150){
fill(240);
ellipse(250,100,20,20);
ellipse(300,100,20,20);
ellipse(350,100,20,20);
count++;
}
else if (count&lt;175){
fill(130);
noStroke();
ellipse(250,100,20,20);
ellipse(300,100,20,20);
ellipse(350,100,20,20);
count++;
}
else{
count=2;
}
}
}


//---------------------------------------------------------------


ArrayList serialChars;      // Temporary storage for received serial data
int whichValueToAccum = 0;  // Which piece of data am I currently collecting?
boolean bJustBuilt = false; // Did I just finish collecting a datum?

void processSerial() {

while (myPort.available () &gt; 0) {
char aChar = (char) myPort.read();

// You'll need to add a block like one of these
// if you want to add a 3rd sensor:
if (aChar == 'A') {
bJustBuilt = false;
whichValueToAccum = 0;
} else if (aChar == 'B') {
bJustBuilt = false;
whichValueToAccum = 1;
} else if (((aChar == 13) || (aChar == 10)) &amp;&amp; (!bJustBuilt)) {
// If we just received a return or newline character, build the number:
int accum = 0;
int nChars = serialChars.size();
for (int i=0; i &lt; nChars; i++) {
int n = (nChars - i) - 1;
int aDigit = ((Integer)(serialChars.get(i))).intValue();
accum += aDigit * (int)(pow(10, n));
}

// Set the global variable to the number we captured.
// You'll need to add another block like one of these
// if you want to add a 3rd sensor:
if (whichValueToAccum == 0) {
valueA = accum;
// println ("A = " + valueA);
} else if (whichValueToAccum == 1) {
valueB = accum;
// println ("B = " + valueB);
}

// Now clear the accumulator
serialChars.clear();
bJustBuilt = true;

} else if ((aChar &gt;= 48) &amp;&amp; (aChar &lt;  57)) {
// If the char is between '0' and '9', save it.
int aDigit = (int)(aChar - '0');
serialChars.add(aDigit);
}
}
}

Arduino Code:

// This Arduino program reads two analog signals,
// such as from two potentiometers, and transmits
// the digitized values over serial communication.

int sensorValue0 = 0;  // variable to store the value coming from the sensor
int sensorValue1 = 0;  // variable to store the value coming from the other sensor

void setup() {
Serial.begin(9600);  // initialize serial communications
}

void loop() {

// Read the value from the sensor(s):
sensorValue0 = analogRead (A0);  // reads value from Analog input 0
sensorValue1 = analogRead (A1);  // reads value from Analog input 1

Serial.print ("A");
Serial.println (sensorValue0);
Serial.print ("B");
Serial.println (sensorValue1);

delay (50);   // wait a fraction of a second, to be polite
}

“Learning” Clair Chin

Here is my glorious wooden creation. The concept- I learned about what sex is in an a very basic way that I could understand, the penis goes into the vagina. I’m sure peoples’experiences in learning about sex differ greatly but sex is something fundamental to humans that we learn about at typically a young age. Sex is not so black and white or simple or anything like the explanation “the penis goes into the vagina”- thats something I wanted to comment on. Anyway, chaneling my childhood confusion on the subject of sex I made this odd object.

video documentation

sketches:
IMG_3232

fritzing diagram:
motorblocks_bb

code:

/*     -----------------------------------------------------------
 *     |  Arduino Experimentation Kit Example Code               |
 *     |  CIRC-03 .: Spin Motor Spin :. (Transistor and Motor)   |
 *     -----------------------------------------------------------
 * 
 * The Arduinos pins are great for driving LEDs however if you hook 
 * up something that requires more power you will quickly break them.
 * To control bigger items we need the help of a transistor. 
 * Here we will use a transistor to control a small toy motor
 * 
 * http://tinyurl.com/d4wht7
 *
 */

int motorPin = 9;  // define the pin the motor is connected to
                   // (if you use pin 9,10,11 or 3you can also control speed)

/*
 * setup() - this function runs once when you turn your Arduino on
 * We set the motors pin to be an output (turning the pin high (+5v) or low (ground) (-))
 * rather than an input (checking whether a pin is high or low)
 */
void setup()
{
 pinMode(motorPin, OUTPUT); 
}


/*
 * loop() - this function will start after setup finishes and then repeat
 * we call a function called motorOnThenOff()
 */

void loop()                     // run over and over again
{
 motorOnThenOff();
 //motorOnThenOffWithSpeed();
 //motorAcceleration();
}

/*
 * motorOnThenOff() - turns motor on then off 
 * (notice this code is identical to the code we used for
 * the blinking LED)
 */
void motorOnThenOff(){
  int onTime = 2500;  //the number of milliseconds for the motor to turn on for
  int offTime = 0; //the number of milliseconds for the motor to turn off for
  
  digitalWrite(motorPin, HIGH); // turns the motor On
  delay(onTime);                // waits for onTime milliseconds
 // digitalWrite(motorPin, LOW);  // turns the motor Off
  //delay(offTime);               // waits for offTime milliseconds
}

/*
 * motorOnThenOffWithSpeed() - turns motor on then off but uses speed values as well 
 * (notice this code is identical to the code we used for
 * the blinking LED)
 */
void motorOnThenOffWithSpeed(){
  
  int onSpeed = 255;  // a number between 0 (stopped) and 255 (full speed) 
  int onTime = 2500;  //the number of milliseconds for the motor to turn on for
  
  int offSpeed = 50;  // a number between 0 (stopped) and 255 (full speed) 
  int offTime = 0; //the number of milliseconds for the motor to turn off for
  
  analogWrite(motorPin, onSpeed);   // turns the motor On
 // delay(onTime);                    // waits for onTime milliseconds
//analogWrite(motorPin, offSpeed);  // turns the motor Off
  //delay(offTime);                   // waits for offTime milliseconds
}

/*
 * motorAcceleration() - accelerates the motor to full speed then
 * back down to zero
*/
void motorAcceleration(){
  int delayTime = 50; //milliu;seconds between each speed step
  
  //Accelerates the motor
  for(int i = 0; i &lt; 256; i++){ //goes through each speed from 0 to 255
    analogWrite(motorPin, i);   //sets the new speed
    delay(delayTime);           // waits for delayTime milliseconds
  }
  
  //Decelerates the motor
  for(int i = 255; i &gt;= 0; i--){ //goes through each speed from 255 to 0
    analogWrite(motorPin, i);   //sets the new speed
    delay(delayTime);           // waits for delayTime milliseconds
  }
}

Automaton: Physical Physics Simulation

photo(2)

The Physical Physics Simulation is a miniature mechanical self contained universe that consists of one body and three universal constants (gravity, friction, and elasticity).

The machine was inspried by events that live inside boxes, cabinets of curiosity, and the orrery, which is essentially a solar system simulation.

Screen Shot 2014-11-10 at 4.34.17 PM

// simple physics for physical physics simulation
// by luca and zach

#include 

Servo servoX;
Servo servoY;

// position
float px = 180;
float py = 0;

// velocity
float vx = 8;
float vy = 0;

float g = 800 * 0.001f; // gravitational constant
float f = 0.9f;         // friction constant
float e = 0.98f;        // elasticity constant

float tickTime = 105; // how often to update? 

void setup()
{
  servoX.attach(10);
  servoY.attach(11);
}

void loop()
{
  // add gravity to y veloctity (ball falling)
  vy += g;
  
  // update position
  px += vx;
  py += vy;
  
  // save old positions
  float ppx = px;
  float ppy = py;
  
  // collision with walls
  if(px < 0 || px > 180) {
    px = ppx;
    vx = -vx*e;
  }
  if(py < 0 || py > 180) {
    py = ppy;
    vy = -vy*e;
  }
  
  // friction (ball on floor)
  if(py < 2) {
    vx = vx * f;
  }
  
  // bounds
  float agpx;
  float agpy;
  agpx = map(px, 0, 180, 35, 150);
  agpy = map(py, 0, 180, 25, 165);
  
  //move servos
  servoX.write(agpx);
  delay(tickTime);
  servoY.write(agpy);
  delay(tickTime);
  
}

Servo Motor

Other Motor

photo 2

Servo Motor FRITZ

// Sweep
// by BARRAGAN  

#include  
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
} 

Separation Engine

IMG_8143

The Separation Engine is a machine that types pre-determined messages onto a keyboard, indirectly interfacing with a computer to write these messages for the viewer.

I originally intended for this machine to be able to type any character on the top row of a qwerty keyboard. However, the Arduino Mega I needed to make this happen never shipped, so I was ham-stringed to 6 servos, 2 of which were needed for the space bar and the enter key.

Since this piece is so much about communication, I decided to limit myself to the words ‘i’ and ‘you’, using these as a basis for morse code. Currently, the piece types the following, looping forever:

Screen Shot 2014-11-10 at 12.49.59

this translates to ‘I don’t want this.’ I recently ended a relationship, and this ended up guiding the subject matter of the piece.

IMG_8144

IMG_8145

I’m ultimately dissatisfied with the piece, since I wanted it to originally be so much more than what it currently is. There’s also a lot more I would like to do with this technology. There are a lot of different designs I’ve been considering for ways to hit the keys that would be more engaging and faster than this setup. I also want to change the subject matter. something that I discovered while making this (with the help of Luca) was that it would be entirely feasible to make a machine that could re-write the code that programs it, and then upload that code to the machine itself.

Tyro_bb

#include <Servo.h> 
 
Servo ent;  // create servo object to control a servo 
Servo o;                // twelve servo objects can be created on most boards
Servo i;
Servo u;
Servo spc;
Servo y;
 
int d = 100;
 
void setup() 
{ 
  ent.attach(3);  // attaches the servo on pin 9 to the servo object 
  o.attach(5);
  i.attach(6);
  u.attach(9);
  spc.attach(10);
  y.attach(11);
} 


void hitent(){
  ent.write(30);
    delay(d);
  ent.write(45);
    delay(d);
}

void hito(){
  o.write(25); 
    delay(d);
  o.write(40); 
    delay(d);
}

void hiti(){
  i.write(152);
    delay(d); 
  i.write(135); 
    delay(d);
}

void hitu(){
  u.write(15); 
    delay(d);
  u.write(30); 
    delay(d);
}

void hitspc(){
    spc.write(140);
    delay(d); 
  spc.write(130); 
    delay(d);
}

void hity(){
    y.write(145); 
    delay(d);
  y.write(130); 
    delay(d);
}


void hityou(){
  hity();
  hito();
  hitu();
  hitspc();
}  

void hitI(){
 hiti();
 hitspc(); 
}

 
void loop() 
{ 
  hitI();  //i
  hitI();
  hitent();
  hitent();
  
  hityou();//dont
  hitI();
  hitI();
  hitent();
  hityou();
  hityou();
  hityou();
  hitent();
  hityou();
  hitI();
  hityou();
  hitent();
  hityou();
  hitent();
  hitent();
  
  hitI();  //want
  hityou(); 
  hityou(); 
  hitent();
  hitI(); 
  hityou(); 
  hitent();
  hityou();
  hitI(); 
  hitent();
  hityou(); 
  hitent();
  hitent();

  hityou();//this
  hitent();
  hitI(); 
  hitI(); 
  hitI(); 
  hitI(); 
  hitent();
  hitI(); 
  hitI(); 
  hitent();
  hitI(); 
  hitI(); 
  hitI(); 
  hitent();
  hitent();
  hitent();
}

 

Dc Motor

DC Motor

photo 1

DC Motor FRITZ

/*     -----------------------------------------------------------
 *     |  Arduino Experimentation Kit Example Code               |
 *     |  CIRC-03 .: Spin Motor Spin :. (Transistor and Motor)   |
 *     -----------------------------------------------------------
 * 
 * The Arduinos pins are great for driving LEDs however if you hook 
 * up something that requires more power you will quickly break them.
 * To control bigger items we need the help of a transistor. 
 * Here we will use a transistor to control a small toy motor
 * 
 * http://tinyurl.com/d4wht7
 *
 */

int motorPin = 9;  // define the pin the motor is connected to
                   // (if you use pin 9,10,11 or 3you can also control speed)

/*
 * setup() - this function runs once when you turn your Arduino on
 * We set the motors pin to be an output (turning the pin high (+5v) or low (ground) (-))
 * rather than an input (checking whether a pin is high or low)
 */
void setup()
{
 pinMode(motorPin, OUTPUT); 
}


/*
 * loop() - this function will start after setup finishes and then repeat
 * we call a function called motorOnThenOff()
 */

void loop()                     // run over and over again
{
 motorOnThenOff();
 //motorOnThenOffWithSpeed();
 //motorAcceleration();
}

/*
 * motorOnThenOff() - turns motor on then off 
 * (notice this code is identical to the code we used for
 * the blinking LED)
 */
void motorOnThenOff(){
  int onTime = 2500;  //the number of milliseconds for the motor to turn on for
  int offTime = 1000; //the number of milliseconds for the motor to turn off for
  
  digitalWrite(motorPin, HIGH); // turns the motor On
  delay(onTime);                // waits for onTime milliseconds
  digitalWrite(motorPin, LOW);  // turns the motor Off
  delay(offTime);               // waits for offTime milliseconds
}

/*
 * motorOnThenOffWithSpeed() - turns motor on then off but uses speed values as well 
 * (notice this code is identical to the code we used for
 * the blinking LED)
 */
void motorOnThenOffWithSpeed(){
  
  int onSpeed = 200;  // a number between 0 (stopped) and 255 (full speed) 
  int onTime = 2500;  //the number of milliseconds for the motor to turn on for
  
  int offSpeed = 50;  // a number between 0 (stopped) and 255 (full speed) 
  int offTime = 1000; //the number of milliseconds for the motor to turn off for
  
  analogWrite(motorPin, onSpeed);   // turns the motor On
  delay(onTime);                    // waits for onTime milliseconds
  analogWrite(motorPin, offSpeed);  // turns the motor Off
  delay(offTime);                   // waits for offTime milliseconds
}

/*
 * motorAcceleration() - accelerates the motor to full speed then
 * back down to zero
*/
void motorAcceleration(){
  int delayTime = 50; //milliseconds between each speed step
  
  //Accelerates the motor
  for(int i = 0; i < 256; i++){ //goes through each speed from 0 to 255
    analogWrite(motorPin, i);   //sets the new speed
    delay(delayTime);           // waits for delayTime milliseconds
  }
  
  //Decelerates the motor
  for(int i = 255; i >= 0; i--){ //goes through each speed from 255 to 0
    analogWrite(motorPin, i);   //sets the new speed
    delay(delayTime);           // waits for delayTime milliseconds
  }
}

At the Dentist

So what I was trying to do was make a scene at the dentist where the dentist would try to pull out the tooth of the patient and the patient would scream with his legs being raised and his head going up. So I searched for some time to see how other automatons functioned. I sketched out the automaton parts.

20141110_153418

20141110_153443

 

I used the laser cutter to cut out the parts on a 1/8 thick paper but it was too thin that it wouldn’t work. So I stacked 3 papers on top of each other so it would work better. Three out of two had worked and the last one, where the horizontal movement was transferred to the vertical movements were not functioning properly due to the less amount of friction that the paper had. I tried to fix it but the paper wasn’t strong enough to hold it tightly in place. Below is the video to the automaton that I had made.

For the Arduino part I just used the sample code given instead of trying something difficult since I had too much trouble with the making the gears part that I really didn’t have much time to invest in coding.

CIRC03

 

 

int motorPin = 9;  // define the pin the motor is connected to
                   // (if you use pin 9,10,11 or 3you can also control speed)

/*
 * setup() - this function runs once when you turn your Arduino on
 * We set the motors pin to be an output (turning the pin high (+5v) or low (ground) (-))
 * rather than an input (checking whether a pin is high or low)
 */
void setup()
{
 pinMode(motorPin, OUTPUT); 
}


/*
 * loop() - this function will start after setup finishes and then repeat
 * we call a function called motorOnThenOff()
 */

void loop()                     // run over and over again
{
 motorOnThenOff();
 //motorOnThenOffWithSpeed();
// motorOnThenOff(); 
motorOnThenOffWithSpeed(); 
//motorAcceleration(); 
 //motorAcceleration();
}

/*
 * motorOnThenOff() - turns motor on then off 
 * (notice this code is identical to the code we used for
 * the blinking LED)
 */
void motorOnThenOff(){
  int onTime = 2500;  //the number of milliseconds for the motor to turn on for
  int offTime = 1000; //the number of milliseconds for the motor to turn off for
  
  digitalWrite(motorPin, HIGH); // turns the motor On
  delay(onTime);                // waits for onTime milliseconds
  digitalWrite(motorPin, LOW);  // turns the motor Off
  delay(offTime);               // waits for offTime milliseconds
}

/*
 * motorOnThenOffWithSpeed() - turns motor on then off but uses speed values as well 
 * (notice this code is identical to the code we used for
 * the blinking LED)
 */
void motorOnThenOffWithSpeed(){
  
  int onSpeed = 200;  // a number between 0 (stopped) and 255 (full speed) 
  int onTime = 2500;  //the number of milliseconds for the motor to turn on for
  
  int offSpeed = 50;  // a number between 0 (stopped) and 255 (full speed) 
  int offTime = 1000; //the number of milliseconds for the motor to turn off for
  
  analogWrite(motorPin, onSpeed);   // turns the motor On
  delay(onTime);                    // waits for onTime milliseconds
  analogWrite(motorPin, offSpeed);  // turns the motor Off
  delay(offTime);                   // waits for offTime milliseconds
}

/*
 * motorAcceleration() - accelerates the motor to full speed then
 * back down to zero
*/
void motorAcceleration(){
  int delayTime = 50; //milliseconds between each speed step
  
  //Accelerates the motor
  for(int i = 0; i < 256; i++){ //goes through each speed from 0 to 255     analogWrite(motorPin, i);   //sets the new speed     delay(delayTime);           // waits for delayTime milliseconds   }      //Decelerates the motor   for(int i = 255; i >= 0; i--){ //goes through each speed from 255 to 0
    analogWrite(motorPin, i);   //sets the new speed
    delay(delayTime);           // waits for delayTime milliseconds
  }
}

I think I should have tried different materials and maybe made it in bigger and thicker in size due to the fraction it had. And a little bet of miss placement and measuring caused a lot of trouble in this automaton, and that accuracy is really important in it. Also I think that the simple gears functioned well and that more time should be put into how the gears connect to each other rather than how motor can actually make it work.

Wind-Up Automaton Rocking Chair Boat!

From inception…

20141110_160050

to realization…

20141110_111901

20141110_111911

20141110_111918

20141110_111925

The wind-up automaton rocking chair was thoroughly outside of my comfort zone. I have lots of trouble executing precision cuts, which effective kinetic machinery requires. However, the laser cutter and calipers proved perfect tools for the job. I experimented with several different methods of connecting pieces which are evident throughout the piece, although most of the components are connected using Elmer’s glue. If I were to continue with this concept, I would scale the piece up to the point that someone could actually sit on it, and use a more powerful wind up motor. I would also gear down the motor, so as to create a less rapid rocking motion.