Saturday, 5 November 2011

model making

This is the ardurino wristband model. I carved a piece of foam in the shape of a wrist with the wrist band on. My plan was to put lights through small holes of the wristband however the holes needed to be too big and I ended up breaking the foam in half and glueing the LED's into it.
The code in the ardurino unit controlls the LED's. The array is aimed at giving feedback to the user by flashing to the pulse of their heartbeat. My lack of practice with C programming only allows me to set the heart beat to a pre determined number. The LED array that Yasu and I programmed is similar. However instead of the lights strictly turning on and off, I would rather they glow and fade on and off according to the speed of the hearbeat. My array consists of "separating" LED light array so I welded 2 LED's to each positive wire. I thought that this would give it a trippy effect.  I envisioned it like this.


 Here is the code:

// Switch Input 02 (with if...then statements)
// prepared by Yoakim Vasdekis August 2011
// refer to Language Reference at www.arduino.cc for detailed descriptions of commands

#define pbPin1 2                        // assign 0 to constant "pbPin1" --- Push-button 1

int button1 = 0;                               // assign "0" to variable "button1"
int butStatus = 0;
int seqTimer = 0; // for led sequence speed
int seqDelay = 5; // 0.5 second
int ledStatus = 0;
int butTimer = 0; // for button
int butDelay = 5; // 0.5 second
boolean detectStatus = true;

void setup(){
  Serial.begin(9600);                        // open serial port with a specified baud rate
  pinMode(pbPin1, INPUT);        // set the digital pin as INPUT
  pinMode(3,OUTPUT); 
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);
}

void loop(){
  button1 = digitalRead(pbPin1);  // read the pin state ("high" or "low")
  Serial.print("but:");                  // send "status = " to serial monitor window
  Serial.print(butStatus);
  Serial.print(" led:");
  Serial.println(ledStatus);
  
  if(detectStatus){
    if(button1 == 0){   // if both switches are "0" or ON then
      butStatus=1;
      detectStatus=false;
      butTimer=millis()/100;
    }
  }
  
  if(millis()/100-butDelay > butTimer){
    detectStatus = true;
  }
  
  if(butStatus==1){
    ledStatus = (ledStatus & 62) +  1;
    butStatus=0;
  }
  
  if(millis()/100-seqDelay > seqTimer){
   seqTimer = millis()/100;  // reset the timer
   int lastDigit = ledStatus & 32;
   ledStatus = (63 & (ledStatus << 1)) + (lastDigit >> 5);
  } 
   
  for(int x=0;x<6;x++){
   digitalWrite(3+x,(ledStatus >> x)&1);
  }
  
  //  if(ledStatus > 5){
  //    butStatus=0;
  //    ledStatus=0;
  //  }
  delay(10);                                    // wait for 100 milliseconds
}
To make the fish I had to model them in solidworks. This proved to be one of the hardest models i have ever made because of the excessive lofts and extra planes needed for the rounded body of the fish. it also tapers in at the front and back and at the fins also. The fish were transformed into a tangable form by the 3D prototyper via an STL file.  Below is the finished model of the fish inside the tank. The perspex model tank was made by my team members Bec and Lisa.

No comments:

Post a Comment