Making Things Interactive

April 15, 2008

Final Project

Currently I have a manually working plant which can rotate from left to right and move up and down with inputs from two potentiometers. I have been having difficulty working with the input values from the photosensor (eliminating noise) and then problems with the servo twitching and not responding correctly to the photosensor values.

int pulse = 0;
int StemServoPin = 10;
int BaseServoPin = 11;
int LED = 5;
long count = 0;
int phi[] = {100};
int theta[] = {180} ;
int buffer = 5000;

void setup() {
  pinMode(StemServoPin, OUTPUT);
  pinMode(BaseServoPin, OUTPUT);
  pinMode(LED, OUTPUT);
  pinMode(0, INPUT);
  pinMode(1, INPUT);
  Serial.begin(9600);
  digitalWrite(13,HIGH);
  }

void pulseStemServo(int phi)
{
  int time;
  time = phi*10+1500;
  digitalWrite(StemServoPin, HIGH);
  delayMicroseconds(time);
  digitalWrite(StemServoPin, LOW);
}

void pulseBaseServo(int theta)
{
  int time;
  time = theta*0.555+1450;
  digitalWrite(BaseServoPin, HIGH);
  delayMicroseconds(time);
  digitalWrite(BaseServoPin, LOW);
}

int smooth(int buffer, int Pin){
  long sum = 0;
  for(int i = 0; i  100){
    count = 0;}
  count++;

  phi[count] = smooth(buffer, 0);
  theta[count] = smooth(buffer, 1);

  Serial.print(phi[count]);
  Serial.print(":");
  Serial.println(theta[count]);

  pulseBaseServo(theta[count]);
  pulseStemServo(phi[count]);

}

These photos are of my project from Saturday.

Laser Cut Parts before assembly

some of the mounting parts

The base assembled

closeup of the stem which shows the actuator cable

Initial version of the plant which broke

 

Advertisements

1 Comment »

  1. tag your post sir!

    Comment by ponkotsu — April 22, 2008 @ 8:37 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: