Making Things Interactive

May 9, 2008

Interactive Hovercraft

Filed under: Will Not Count Towards Your Grade — lingshui @ 9:33 pm

This hovercraft project is a hovercraft made of balsa wood and garbage bags, powered by a single computer fan. The hovercraft works by building up air pressure underneath the frame and then forcing the air out from the sides, thus creating a cushion of air for the hovercraft to sit on. This hovercraft is also interactive in that it activates the hover ability when it senses human presence (through the use of an ultrasonic rangefinder). Additionally, since the hovercraft is meant to be eventually developed into a hovering interactive pet of some kind, I have integrated the beginnings of a “personality” for the pet in that the hovercraft gets “mad” and lets out an annoying noise when it is bumped too hard against any surface laterally.

Pictures:

#1

#2

#3

Schematic:

Here

Code:

int RF = 5; //set rangefinder to analog 5
int bumpSwitch = 2; //switch for “bump” reaction to digital 2
int trans = 6; //transistor for fan activation to digital 6
int buzzer = 8; //buzzer for “bump” reaction to digital 8
const int sWait = 0; //setting state machine ints
const int sHover = 1;
int currentState = sWait;
int nextState = sHover;
int timeDelay = 0; //set amount for idle turnoff of fan
int led1 = 3; //set output status lights on hovercraft
int led2 = 4;
int ledCount = 0;

void setup()
{
pinMode (RF, INPUT); //setting inputs and outputs
pinMode (bumpSwitch, INPUT);
pinMode (trans, OUTPUT);
pinMode (buzzer, OUTPUT);
pinMode (led1, OUTPUT);
pinMode (led2, OUTPUT);
Serial.begin (9600);
currentState = sWait;
}

void loop()
{
switch (currentState) //state machine for hovercraft states
{
case sWait: //state “waiting for interaction”
digitalWrite (trans, LOW);
timeDelay = 0;
digitalWrite (led1, LOW);
digitalWrite (led2, LOW);
Serial.println (“Wait”);
if (analogRead(RF) <= 15) //if rangefinder detects human proximity... { currentState = sHover; //turn hover on } break; case sHover: //state "hovering" digitalWrite (trans, HIGH); //turn on fan digitalRead (bumpSwitch); if (ledCount < 25) //begin script for led flash pattern to cut out delay lag { digitalWrite (led1, HIGH); digitalWrite (led2, LOW); } if (ledCount == 25) { digitalWrite (led1, LOW); digitalWrite (led2, HIGH); } if (ledCount == 50) { ledCount = 0; } //end script for led flash pattern Serial.println ("Hover"); if (digitalRead(bumpSwitch) == HIGH) //if the hovercraft is bumped... { digitalWrite (buzzer, HIGH); //initiate buzzer and angry led pattern digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (led1, HIGH); digitalWrite (led2, HIGH); delay(100); digitalWrite (led1, LOW); digitalWrite (led2, LOW); delay(100); digitalWrite (buzzer, LOW); } timeDelay ++; //increment idle count ledCount ++; //increment led flash pattern count delay (10); if (timeDelay == 1700) //if idle count reaches 17 seconds... { currentState = sWait; //go back to waiting for interaction state } break; default: //default state, error, go back to waiting state Serial.println ("default state, ERROR"); currentState = sWait; break; } } [/sourcecode] The code for the hovercraft is a simple state machine with two states: waiting and hover. Hover state includes all script for flashing LEDs and "angry response" behavior. There was a problem with flashing the LEDs during the hover state while still reading the "bump switch" (because of delay command in led flash script it would stop reading bump switch during the delay). Thus I created a simple counting increment script for the bumpswitch which is outlined in the comments inside the "hover" state.

May 6, 2008

PIR trouble

Filed under: Cat Adams,Will Not Count Towards Your Grade — catadams @ 6:42 pm

I have been trying for a long time now to get the PIR sensor from Spark fun (found here) to work, but to no avail. Does anyone have experience with this sensor, or a similar one, and knows a sure-fire way of getting it to work? I’m trying to do a simple digital read and the numbers keep coming out all wonky.

April 30, 2008

Course Feedback

I enjoyed the concept of giving us weekly assignments to keep us occupied as well as learning. There is no better method of learning than by actually doing. Additionally, people in the class all came in with varying levels of knowledge, and for them to have to learn everything about electronics is unnecessary. With doing things by hand, the level of complexity is determined by one’s self.

I enjoyed the classes where jet would bring in and show us various links online of interesting projects. Firstly, it was good inspiration for our projects, and secondly for someone not coming from a purely artistic background, my exposure to this “culture” is very limited. It was very interesting to see what people are doing in this design space.

The idea of having a fairly complex midterm project forced us to push ourselves and understand how long building something would take. I learned from my midterm fiasco and began planning my final project much earlier.

The class blog is also a great place to look for ideas, assistance and just a simple, easy to use information interface for everyone. I’ve never used a blog for a class, but I think it is a great tool.

There was hardly anything I felt negatively about in the class. My comment is more of a suggestion to improve the class for others. I felt that diving straight into Arduino code was difficult for many people who did not have a programming background. I would suggest, the first few classes should be devoted to getting the class to think in steps, block diagrams, flowcharts etc. this way it is a little less daunting than having to decipher a foreign language.

Reflecting on the semester that was, I have really enjoyed this class for two major reasons. The freedom it gave me in pursuing projects that brought enjoyment to me and really giving me confidence in my ability to learn and undertake tasks associated with electronics and microcontrollers.

April 29, 2008

Making better video

Filed under: Will Not Count Towards Your Grade — mdgross @ 8:56 am

Make Magazine had a helpful guide to making videos, mistakes not to make:

http://www.make-digital.com/make/vol08/?pg=158&search=bad+video+more:make_magazine

April 25, 2008

“So, what can you do with what you learned?”

Take a look at the products on this blog and count how many you could make now, if you wanted to: talk2myshirt.

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

 

March 28, 2008

International Dance Party

Filed under: Will Not Count Towards Your Grade — Jesse @ 12:45 am

This the Int’l Dance Party (IDP) system I describe in class. 

March 27, 2008

PhotoSensor State Machine

Filed under: Will Not Count Towards Your Grade — bkish @ 1:43 pm

Filed under: Will Not Count Towards Your Grade — sbutalia @ 1:46 am

for my state machine, I created something which would help me in my final term project. It is very simple but i managed to take in 3 different inputs (light, temp & play) and then determine what they would output. There are 3 basic states visualized, Decreasing, Increasing and Equilibrium.

int Light = 0; //light intensity
int Temp = 0; //temperature level
int Switch = 0;//current Switch state
int Switch2 = 0;// Previous switch state
int State = 0; //Play or not Play
int PlayCount = 0; //Amount of Play
int LightCount = 0; //Amount of Light
int TempCount = 0; //Amount of Temperature
int Emotion = 0; //Current Amount of Emotion
int Emotion2 = 0;//Previous amount of Emotion

void setup() {

pinMode(2, INPUT);
  pinMode(8, OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(10, OUTPUT);

Serial.begin(9600);

}

void loop(){

Light = analogRead(5);
  Temp = analogRead(4);
  Switch2 = Switch; //Assigning past value
  Switch = digitalRead(2); //Assigning new value

if(Switch != Switch2 && Switch == HIGH){ //Determining & Assigning new switch state
  if(State == 1){
  State = 0;}
  else State = 1;
  }

if(State == 1){ //Accumulating Play
  digitalWrite(8,HIGH);
  PlayCount++;
  }
  else {PlayCount = PlayCount – 1; // Reducing Play
  digitalWrite(8,LOW);
  }

if(Light > 512) //Accumulating Light
  {
  LightCount++;
  }else LightCount = LightCount – 1; // Reducing Light

if(Temp > 512) //Accumulating Temp
  {
  TempCount++;
  }
  else TempCount = TempCount – 1; //Reducing Temp

Emotion2 = Emotion; //Previous emotion value
  Emotion = LightCount/2 + TempCount/2 + PlayCount; //Current Emotion value

if(Emotion > Emotion2){
  digitalWrite(10,HIGH);
  digitalWrite(9,LOW);
  Serial.println(“Increasing”);
  }
  if(Emotion < Emotion2){   digitalWrite(9,HIGH);   digitalWrite(10,LOW);   Serial.println("Decreasing");   }   if(Emotion == Emotion2){   digitalWrite(9,HIGH);   digitalWrite(10,HIGH);   Serial.println("Equilibrium");   } //Serial.print(LightCount/10);   //Serial.print(":");   //Serial.print(TempCount/10);   //Serial.print(":");   //Serial.println(PlayCount/10); } [/sourcecode]

February 28, 2008

Filed under: Will Not Count Towards Your Grade — jmarshman @ 6:33 pm

K none of these posts are working I will fix them and post the rest

Create a free website or blog at WordPress.com.