Rhodopsin Simulation

Statement:

This project was designed to be a simulation of the function of the rhodopsin protein. This protein is in the rods located in the eye. As it senses light it changes form and help the eye see the light is it receiving. So we started this project by getting the genetic sequence of human rhodopsin. Once we had this sequence, we translated it to a midi output that would translate the genetic code into an auditory set of sounds. This transcoding of the genetic code into another format was the basis for the project. With the midi producing the audio output we then connected an Arduino up to some LEDs and attached them to a pair of glasses. We put a diffusing material behind the LEDs so that they would spread light over the users vision and not blind them with straight light. The final part was integrating a light sensor that would give feedback to the LEDs and midi. As the light increased in intensity the LEDs would change color and the audio output would increase in tempo. Just as the rhodopsin changes with the light it receives, the glasses would change color and the sound would change to give a translated representation of what is happening on the molecular level.

Contribution:

For this project I was in charge of constructing the wearables. I also helped with some of the wiring and the conceptualization of the project. The wearable was constructed out of safety glasses, tape, mylar(diffuser), and two LEDs wired to the breadboard and Arduino.

Processing Code:

#include <Boards.h>
//#include <Firmata.h>
const boolean ON = LOW;
const boolean OFF = HIGH;
const boolean RED[] = {ON, OFF, OFF};
const boolean GREEN[] = {OFF, ON, OFF};
const boolean BLUE[] = {OFF, OFF, ON};
const boolean YELLOW[] = {ON, ON, OFF};
const boolean CYAN[] = {OFF, ON, ON};
const boolean MAGENTA[] = {ON, OFF, ON};
const boolean WHITE[] = {ON, ON, ON};
const boolean BLACK[] = {OFF, OFF, OFF};
int redLed   = 11;  // red LED in Digital Pin 11 (PWM)
int greenLed = 10;  // green LED in Digital Pin 10 (PWM)
int blueLed  = 9;   // blue LED in Digital Pin 9 (PWM)
int redLed2 = 6;
int greenLed2 = 5;
int blueLed2  = 3;
int ledDigitalOne[] = {11, 10, 9};
int lightPin = 0;  //define a pin for Photo resistor
int ledPin = 11;   //define a pin for LED
void setup() {
  pinMode(redLed, OUTPUT); // tell arduino it’s an output
  pinMode(greenLed, OUTPUT); // tell arduino it’s an output
  pinMode(blueLed, OUTPUT); // tell arduino it’s an output
  // set all the outputs to low
  digitalWrite(redLed, LOW);
  digitalWrite(greenLed, LOW);
  digitalWrite(blueLed, LOW);
  pinMode(redLed2, OUTPUT); // tell arduino it’s an output
  pinMode(greenLed2, OUTPUT); // tell arduino it’s an output
  pinMode(blueLed2, OUTPUT); // tell arduino it’s an output
  pinMode(lightPin, INPUT);
  digitalWrite(redLed2, LOW);
  digitalWrite(greenLed2, LOW);
  digitalWrite(blueLed2, LOW);
  Serial.begin(9600);  //Begin serial communcation
  //pinMode( ledPin, OUTPUT );
}
void turnLedWhite(int r, int g, int b) {
  digitalWrite(r, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(b, HIGH);
}
void loop() {
  int Lval = analogRead(lightPin);
  Serial.println(analogRead(lightPin)); //Write the value of the photoresistor to the serial monitor.
  analogWrite(ledPin, analogRead(lightPin) / 4); //send the value to the ledPin. Depending on value of resistor
  //you have  to divide the value. for example,
  //with a 10k resistor divide the value by 2, for 100k resistor divide by 4.
  delay(500); //short delay for faster response to light.
  //color constraints for LED
  if ((Lval >= 0) && (Lval <= 39)) {
    //*alternate way to call variables
    digitalWrite(11, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(redLed2, LOW);
    digitalWrite(greenLed2, HIGH);
    digitalWrite(blueLed2, HIGH);
    //WHITE
  }
  else if ((Lval >= 40) && (Lval <= 80)) {
    digitalWrite(11, LOW);
    digitalWrite(10, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(redLed2, LOW);
    digitalWrite(greenLed2, HIGH);
    digitalWrite(blueLed2, HIGH);
    //CYAN
  }
  else if ((Lval >= 81) && (Lval <= 120)) {
    digitalWrite(11, LOW);
    digitalWrite(10, LOW);
    digitalWrite(9, HIGH);
    digitalWrite(redLed2, LOW);
    digitalWrite(greenLed2, LOW);
    digitalWrite(blueLed2, HIGH);
    //BLUE
  }
  else if ((Lval >= 121) && (Lval <= 140)) {
    digitalWrite(11, LOW);
    digitalWrite(10, HIGH);
    digitalWrite(9, LOW);
    digitalWrite(redLed2, LOW);
    digitalWrite(greenLed2, HIGH);
    digitalWrite(blueLed2, LOW);
    //GREEN
  }
  else if ((Lval >= 141) && (Lval <= 180)) {
    digitalWrite(11, HIGH);
    digitalWrite (10, LOW);
    digitalWrite (9, HIGH);
    digitalWrite(redLed2, HIGH);
    digitalWrite (greenLed2, LOW);
    digitalWrite (blueLed2, HIGH);
    //MAGENTA
  }
  else if ((Lval >= 181) && (Lval <= 220)) {
    digitalWrite (11, HIGH);
    digitalWrite (10, HIGH);
    digitalWrite (9, LOW);
    digitalWrite (redLed2, HIGH);
    digitalWrite (greenLed2, HIGH);
    digitalWrite (blueLed2, LOW);
    //YELLOW
  }
  else if ((Lval >= 221) && (Lval <= 250)) {
    digitalWrite (11, HIGH);
    digitalWrite (10, LOW);
    digitalWrite (9, LOW);
    digitalWrite (redLed2, HIGH);
    digitalWrite (greenLed2, LOW);
    digitalWrite (blueLed2, LOW);
    //RED
  }
  else {
    digitalWrite (11, LOW);
    digitalWrite (10, LOW);
    digitalWrite (9, LOW);
    digitalWrite (redLed2, LOW);
    digitalWrite (greenLed2, LOW);
    digitalWrite (blueLed2, LOW);
    //BLACK / OFF
  }
}
IMAG0318 IMAG0319 IMAG0321 IMG_1679 IMG_1680 IMG_1682 IMG_1683 IMG_1684 IMG_1685 IMG_1687
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s