Friday, May 4, 2012

Final Project

For my final project, I started with an interest in eye-motion as a form of input, and after looking around a bit, I came across the eye-writer project, which was an initiative set forth to help bring an affordable means of eye-control as a form of communication to those who are otherwise paralyzed:

This left the question of what physical medium I'd be able to incorporate into all of this, and after plenty of deliberation, I decided I'd try and start with something small and simple, such as a servo-mounted laser pointer, which would ideally point in the direction that the user was looking at, based on values taken from the eye-writer software.

In the end I was able to get the eyewriter together and functioning, as well as the laser, as shown in the videos below:






One drawback to the eyewriter is that the user isn't really able to move his or her head, as it throws the calibration(shown below) totally off. The tracker is calibrated by making the user look at an array of points on the screen or surface that will be being used, and interpolates the corresponding eye motions, so that the cursor can move smoothly in response to the eye. Thus, if the user even slightly moves his or her head, the eye is moved to a new baseline position so to speak, and can't use the previously calibrated values. I figured that one interesting way around this might be to mount the laser (which would be acting in place of the on-screen cursor) on to the user's head somehow, thus making it independent of the constraints that the head's position relative to the screen presents, but this was something I didn't get a chance to work on.


What ultimately prevented me from achieving my original goal, was that I ended up being unable to locate the independent interpolated values from within the software, that I could serially send out to the arduino, although I imagine that I should be able to find them if i poke around some more.

I also think that a similar calibration system would need to be implemented, where the laser might point to a series of different points on a given surface, and using those results, the laser could be controlled more precisely.

Mid-Term Documentation

For our Mid-term project, we decided to work on a device that would display info about a user's menstrual cycle, in relation to two input-dates. The idea being that based on a 28-day cycle, a user would input the start date of her cycle, and a future date, and receive an output consisting of the day of her cycle (1 out of 28) that would fall on said future date, as well as a reading of certain hormone levels associated with that day of the cycle. This would be useful for instance, if someone trying to conceive wanted to know whether or not to make certain plans on a certain day. 


The difference in days was calculated using the following algorithm: 



function g(y,m,d)
m = (m + 9) % 12
y = y - m/10
return 365*y + y/4 - y/100 + y/400 + (m*306 + 5)/10 + ( d - 1 )

g(y2,m2,d2) - g(y1,m1,d1).

This difference in days was then divided by 28 to return the day value, along with its respective hormone values, as outlined in this Data Set. (organized and visualized by kai). 







Transistor and H-Bridge

The transistor lab went fairly smoothly.



The H-Bridge on the other gave me a bit of trouble. I'm fairly positive that I had everything wired up properly, especially since I'd rewired it about four times..

using the code from the lab:


  const int switchPin = 2;    // switch input
  const int motor1Pin = 3;    // H-bridge leg 1 (pin 2, 1A)
  const int motor2Pin = 4;    // H-bridge leg 2 (pin 7, 2A)
  const int enablePin = 9;    // H-bridge enable pin

  void setup() {
    // set the switch as an input:
    pinMode(switchPin, INPUT);

    // set all the other pins you're using as outputs:
    pinMode(motor1Pin, OUTPUT);
    pinMode(motor2Pin, OUTPUT);
    pinMode(enablePin, OUTPUT);
    //pinMode(ledPin, OUTPUT);
    Serial.begin(9600);

    // set enablePin high so that motor can turn on:
    digitalWrite(enablePin, HIGH);
  }


  void loop() {
    // if the switch is high, motor will turn on one direction:
    if (digitalRead(switchPin) == HIGH) {
      Serial.println("high");
      digitalWrite(motor1Pin, LOW);   // set leg 1 of the H-bridge low
      digitalWrite(motor2Pin, HIGH);  // set leg 2 of the H-bridge high
    }
    // if the switch is low, motor will turn in the other direction:
    else {
      Serial.println("low");
      digitalWrite(motor1Pin, HIGH);  // set leg 1 of the H-bridge high
      digitalWrite(motor2Pin, LOW);   // set leg 2 of the H-bridge low
    }
  }

- I noticed that i was able to get HI and LO responses from the switch, and so the corresponding If conditions should have been executed, and yet the motor remained motionless. I was also sure to check that the motor was still working quite a few times. I'm thinking that something might be wrong with the H-bridge, as it would get incredibly hot any time I'd plug pin 8 to the power source, so I may have plugged something in wrong one of the first times around, and done some damage?