Changes

Students/Tung Mach

5,374 bytes added, 21:27, 22 September 2011
Field Research
== Electronic Technologies for Art I ==
In the quarter of Winter 2010, Lance registered for a class called Electronic Technologies for the Art with Robert Twomey, due to his passion for electronics. Lance finds the class intriguing because he likes the work behind electricity and the process of assembling. Though, Lance doesn't have any knowledge nor previous experience with electronics, he hopes to gain the intelligence to strengthen his creative mind in the art and perhaps acquire a new hobby.
 
== Field Research ==
http://hphotos-snc3.fbcdn.net/hs421.snc3/24329_1288334601720_1030830148_30803241_4864940_n.jpg
 
http://photos-d.ak.fbcdn.net/hphotos-ak-snc3/hs421.snc3/24329_1288334681722_1030830148_30803243_6817497_n.jpg
 
http://photos-f.ak.fbcdn.net/hphotos-ak-snc3/hs401.snc3/24329_1288334641721_1030830148_30803242_4305363_n.jpg
 
http://photos-d.ak.fbcdn.net/hphotos-ak-snc3/hs421.snc3/24329_1288334681722_1030830148_30803243_6817497_n.jpg
 
http://hphotos-snc3.fbcdn.net/hs401.snc3/24329_1288334561719_1030830148_30803240_533241_n.jpg
 
== Midterm Project Proposal ==
== Final Project Documentation ==
This section is going under constructionPresented on March 11 (Thursday), 2010For my final project, I made a bionic puppet. Instead of controlling a puppet with your hands, you can now control your puppet using a controller. Using the Nintendo Wii Nunchuck as a 3-axis accelerometer, you control the puppet by tilting, rotating, and pushing buttons. Tilting down and up controls the Y-axis, moving the head up and down, and rotating it left and right controls the X-axis, moving the head left and right. Pressing the "C" button will make the puppet beep, pressing the "Z" button will hold the head in its place. I would like to name him Spazzy, because he likes to twitch a lot. http://hphotos-snc3.fbcdn.net/hs482.snc3/26393_1294431994151_1030830148_30814980_6621906_n.jpghttp://hphotos-snc3.fbcdn.net/hs482.snc3/26393_1294432034152_1030830148_30814981_863787_n.jpghttp://photos-b.ak.fbcdn.net/hphotos-ak-ash1/hs482.ash1/26393_1294432074153_1030830148_30814982_2379686_n.jpghttp://hphotos-snc3.fbcdn.net/hs502.snc3/26393_1294432114154_1030830148_30814983_5056626_n.jpghttp://hphotos-snc3.fbcdn.net/hs502.snc3/26393_1294432154155_1030830148_30814984_2240416_n.jpgSpazzy: BEEP! BEEP! Arduino Sketch<pre>#include <Wire.h>#include <string.h>#include <stdio.h> uint8_t outbuf[6];int cnt = 0;int ledPin = 13;int servoPin = 7; // Control pin 7 for servo motorint servoPin2 = 6; // Control pin 6 for servo motorint pulseWidth = 0; // Amount to pulse the servoint pulseWidth2 = 0;long lastPulse = 0;long lastPulse2 = 0;int z_button = 0;int c_button = 0;int refreshTime = 20; // The time in millisecs needeed in between pulsesint minPulse = 1000; // Minimum pulse widthint minPulse2 = 500;int dtime=10; #define pwbuffsize 10long pwbuff[pwbuffsize];long pwbuffpos = 0;long pwbuff2[pwbuffsize];long pwbuffpos2 = 0; void setup(){ beginSerial (19200); Wire.begin (); nunchuck_init (); pinMode(servoPin, OUTPUT); // Set servoPin as an output pin pinMode(servoPin2, OUTPUT); // Set servoPin2 as an output pin pulseWidth = minPulse; // Set the motor position to the minimum pulseWidth2 = minPulse2; Serial.print ("Finished setup\n");} void nunchuck_init(){ Wire.beginTransmission (0x52); Wire.send (0x40); Wire.send (0x00); Wire.endTransmission ();} void send_zero(){ Wire.beginTransmission (0x52); Wire.send (0x00); Wire.endTransmission ();} int t = 0;void loop(){ t++; long last = millis(); if( t == 1) { t = 0; Wire.requestFrom (0x52, 6); while (Wire.available ()) { outbuf[cnt] = nunchuk_decode_byte (Wire.receive ()); digitalWrite (ledPin, HIGH); cnt++; }  if (cnt >= 5) { // printNunchuckData(); int z_button = 0; int c_button = 0; if ((outbuf[5] >> 0) & 1) z_button = 1; if ((outbuf[5] >> 1) & 1) c_button = 1;  switch (c_button) { case 1: switch (z_button) { case 0: break; case 1: muovi(); break; } break; case 0: switch (z_button) { case 0: delay(10000); break; case 1: delay(3000); break; } break; } } cnt = 0; send_zero(); } // if(t==) updateServo // Update servo position delay(dtime);}  void updateServo() {  if (millis() - lastPulse >= refreshTime) { digitalWrite(servoPin, HIGH); delayMicroseconds(pulseWidth); digitalWrite(servoPin, LOW); digitalWrite(servoPin2, HIGH); delayMicroseconds(pulseWidth2); digitalWrite(servoPin2, LOW); lastPulse = millis(); }} int i=0;void printNunchuckData(){ int joy_x_axis = outbuf[0]; int joy_y_axis = outbuf[1]; int accel_x_axis = outbuf[2]; // * 2 * 2; int accel_y_axis = outbuf[3]; // * 2 * 2; int accel_z_axis = outbuf[4]; // * 2 * 2; int z_button = 0; int c_button = 0; if ((outbuf[5] >> 0) & 1) z_button = 1; if ((outbuf[5] >> 1) & 1) c_button = 1; if ((outbuf[5] >> 2) & 1) accel_x_axis += 2; if ((outbuf[5] >> 3) & 1) accel_x_axis += 1; if ((outbuf[5] >> 4) & 1) accel_y_axis += 2; if ((outbuf[5] >> 5) & 1) accel_y_axis += 1; if ((outbuf[5] >> 6) & 1) accel_z_axis += 2; if ((outbuf[5] >> 7) & 1) accel_z_axis += 1; Serial.print (i,DEC); Serial.print ("\t"); Serial.print ("X: "); Serial.print (joy_x_axis, DEC); Serial.print ("\t"); Serial.print ("Y: "); Serial.print (joy_y_axis, DEC); Serial.print ("\t"); Serial.print ("AccX: "); Serial.print (accel_x_axis, DEC); Serial.print ("\t"); Serial.print ("AccY: "); Serial.print (accel_y_axis, DEC); Serial.print ("\t"); Serial.print ("AccZ: "); Serial.print (accel_z_axis, DEC); Serial.print ("\t"); Serial.print (z_button, DEC); Serial.print (" "); Serial.print (c_button, DEC); Serial.print ("\r\n"); i++;} char nunchuk_decode_byte (char x){ x = (x ^ 0x17) + 0x17; return x;}
Five pictures will be posted up.void muovi (){Project source code will be posted. float tilt = (700 - outbuf[3]*2*2); float tilt2 = outbuf[2]*2*2; tilt = (tilt); pulseWidth = (tilt * 5) + minPulse; tilt2 = (tilt2-288); pulseWidth2 = (tilt2 * 5) + minPulse2; pwbuff[pwbuffpos] = pulseWidth; pwbuff2[pwbuffpos2] = pulseWidth2; if( ++pwbuffpos == pwbuffsize ) pwbuffpos = 0; if( ++pwbuffpos2 == pwbuffsize ) pwbuffpos2 = 0; pulseWidth=0; pulseWidth2=0; for( int p=0; p<pwbuffsize; p++ ){ pulseWidth += pwbuff[p]; pulseWidth2 += pwbuff2[p]; } pulseWidth /= pwbuffsize; pulseWidth2 /= pwbuffsize;}</pre>
47
edits