Students/Tung Mach

From Robert-Depot
Revision as of 01:23, 12 March 2010 by Lanceloter (talk | contribs) (Final Project Documentation)

Jump to: navigation, search

Tung Mach (January 15, 1989), better known by his preferred name Lance, is a 3rd year undergraduate student at the University of California, San Diego, currently majoring in both Interdisciplinary Computing and the Arts and Computer Science and Engineering.

Early Life

Lance received his diploma at Alameda High School, where he was involved in many clubs, and was the varsity of the badminton club for all 4 years. After his graduation, he decided to attend a community college in order to shorten his college expenses. In shortly after 2 years, he soon transferred into the University.

Personal Life

Lance was cool. He's still cool. Everyone likes him.

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

24329_1288334601720_1030830148_30803241_4864940_n.jpg 24329_1288334681722_1030830148_30803243_6817497_n.jpg 24329_1288334641721_1030830148_30803242_4305363_n.jpg 24329_1288334721723_1030830148_30803244_6507300_n.jpg 24329_1288334561719_1030830148_30803240_533241_n.jpg

Midterm Project Proposal

"For this upcoming midterm project, there are a few ideas that came to mind, but I can’t decide yet on which I want to do. My very first idea was an anti-theft device mechanism, which can be installed into a product. If one was to steal and open a product, a sensor would go off, alarming others. My second idea could be a simple mouse trap, where if a mouse gets near one, it would get caught and a loud sensor would go off. This would alert the owner of the house, can quickly dispose of the rat, and reinstall it again. My third idea is a mini elevator, which I could incorporate the knife switch into my project. If I turn the switch up, it would move the elevator up, switching it down would move it down.

When it comes to looks, my first idea would probably look like a CD case, or some kind of box. Being a closed switch, if one was to open it, a button would be released, allowing the circuits to connect to set off the alarm. Upon looking inside the box, you can see all the mechanics that are made up into this anti-theft system. My second idea would simply be a mouse trap, probably with lights and sounds coming out of it. My third idea would probably involve the most work, building a small elevator and having at least two floors with a switch."


The Midterm Project

When I wrote my project proposal, I had a lot of ideas that I wanted to do, but not everything went well. I decided to start off with some new ideas from scratch. Then suddenly, I came up with something. I decided to make a netbook cooler, as no company has made one yet. The purpose of this cooler is to decrease the temperature of the netbook by fanning below . This project is simple, but yet simple. The cooler will have two features, an automatic switch so when a netbook is placed on top, the cooler will automatically start fanning, and a turning knob to adjust the speed of the fan. The cooler was easy to make, I placed the red switch on top of the box, so that way when something is pressed against it, it would connect the circuit all together, making the fan spin. I placed the knob on the back so adjust the volume of the fan, which is also connected to the circuit. The turning knob is also known as a potentiometer, it can be treated as a resistor as you can change the volume of the electricity flowing through the motor that is rotating the fan. The box is actually made out of a cereal box, wrapped with black construction paper. Inside the box, the circuit board is placed in the back, which also connects the wire from the battery, potentiometer (turning knob), and the switch button. Upon use, this product actually works. Though, it will only fit netbooks only, it still cools down the netbook slightly. The unique feature about this cooler is that it doesn't require USB to connect to a netbook, as it could run on either battery for high mobility or simply through AC power.

22779_1263308816091_1030830148_30747202_990259_n.jpg Front View 22779_1263308856092_1030830148_30747203_6125969_n.jpg Back View 22779_1263308896093_1030830148_30747204_5043710_n.jpg Netbook placed on top of the cooler

Final Project Proposal

For my final, I would like to propose a project that is related to the topic of Bionic Arduino. The definition on bionic means having normal biological capability or performance enhanced by or as if by electronic or electromechanical devices. I would like to get a 3-axis accelerometer that would be able to control a robot by just tilting and or rotating the accelerometer. With the accelerometer, I will be able to measure proper acceleration, detecting magnitude and direction of the acceleration as a vector quantity, and can be used to sense orientation, vibration and shock.

I will be using Arduino to produce the code that will work with my robot. The robot won't actually have any movement to move, it will be stationary. However, I will controlling the robot's body, like moving the body for an example. I will also probably add lights and sounds to the robot, so a button would probably activate the lights.

24329_1288317641296_1030830148_30803189_5324550_n.jpg Illustration of Project 24329_1288317721298_1030830148_30803191_3231918_n.jpg

Final Project Documentation

Presented on March 11 (Thursday), 2010.

For 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.

26393_1294431994151_1030830148_30814980_6621906_n.jpg 26393_1294432034152_1030830148_30814981_863787_n.jpg 26393_1294432074153_1030830148_30814982_2379686_n.jpg 26393_1294432114154_1030830148_30814983_5056626_n.jpg 26393_1294432154155_1030830148_30814984_2240416_n.jpg Spazzy: BEEP! BEEP!

Arduino Sketch

#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 motor
int servoPin2 = 6;      // Control pin 6 for servo motor
int pulseWidth = 0;	// Amount to pulse the servo
int 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 pulses
int minPulse = 1000;	// Minimum pulse width
int minPulse2 = 500;
int dtime=10;

#define pwbuffsize 10
long 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()
    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);

        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:
                case 1:
            case 0:
                switch (z_button) {
                case 0:
                case 1:
        cnt = 0;
    } // if(t==)
    updateServo	// Update servo position

void updateServo() {

    if (millis() - lastPulse >= refreshTime) {
        digitalWrite(servoPin, HIGH);
        digitalWrite(servoPin, LOW);
        digitalWrite(servoPin2, HIGH);
        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");

char nunchuk_decode_byte (char x)
    x = (x ^ 0x17) + 0x17;
    return x;

void muovi (){
    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;
    for( int p=0; p<pwbuffsize; p++ ){
        pulseWidth += pwbuff[p];
        pulseWidth2 += pwbuff2[p];
    pulseWidth /= pwbuffsize;
    pulseWidth2 /= pwbuffsize;