Team:TU Munich/lab/notebook/lightbox

From 2011.igem.org

(Difference between revisions)
 
(2 intermediate revisions not shown)
Line 1: Line 1:
<html>
<html>
 +
<script src="https://2011.igem.org/Team:TU_Munich/slimbox2.js?action=raw&ctype=text/js" type="text/javascript"></script>
 +
<link rel="stylesheet" href="https://2011.igem.org/Team:TU_Munich/slimbox2.css?action=raw&ctype=text/css" type="text/css" media="screen">
<div class="ui-corner-all subcontent tabcontent">
<div class="ui-corner-all subcontent tabcontent">
<h1>Lightbox design</h1>
<h1>Lightbox design</h1>
 +
 +
<p><b>People: Fabian, Leonhard</b></p>
<p>For the assays an apparatus to irradiate the bacteria with light of different wavelengths was needed.
<p>For the assays an apparatus to irradiate the bacteria with light of different wavelengths was needed.
Line 11: Line 15:
</p>
</p>
<h2><span class="mw-headline" id="Setup">Setup</span></h2>
<h2><span class="mw-headline" id="Setup">Setup</span></h2>
-
<p>Bild1
+
<p><a href="/wiki/images/7/72/Sketch.jpg" class="image" rel="lightbox"><img alt="Sketch.jpg" src="/wiki/images/7/72/Sketch.jpg" width="500" /></a>
-
</p><p><a href="/wiki/images/7/72/Sketch.jpg" class="image" rel="lightbox"><img alt="Sketch.jpg" src="/wiki/images/7/72/Sketch.jpg" width="500" /></a>
+
</p>
</p>

Latest revision as of 23:45, 21 September 2011

Lightbox design

People: Fabian, Leonhard

For the assays an apparatus to irradiate the bacteria with light of different wavelengths was needed. Basically any sufficiently dark box that is small enough to fit in your incubator is usable as chassis.

We used an old paperboard container and drilled some small holes into it to fix the LEDs (we used the wavelengths 450 for blue light activation, 650 for red light deactivation and 710 for red light activation).

On the inside the tubes with the bacteria need to be adequatly bound to the box such that they dont damage anything.

To do the dimming and on and off switching of LEDs we used a Arduino board with the following setup and code:

Setup

Sketch.jpg

Code

int inPinmod = 2;
int inPindim = 4;// the number of the input pin
int redoffPin = 11;       // the number of the output pin
int redonPin = 9;
int blueonPin = 10;

int state = 0;      // the current state of the output pin
int readingmod;  
int readingdim;  // the current reading from the input pin
int previousmod = LOW; 
int previousdim = LOW; // the previous reading from the input pin
int intensity = 255;

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long modtime = 0;
long dimtime = 0; // the last time the output pin was toggled
long debounce = 200;   // the debounce time, increase if the output flickers

void setup()
{
  Serial.begin(9600);
  pinMode(inPinmod, INPUT);
  pinMode(inPindim, INPUT);
  pinMode(redoffPin, OUTPUT);
  pinMode(redonPin, OUTPUT);
  pinMode(blueonPin, OUTPUT);
}

void loop()
{
  readingmod = digitalRead(inPinmod);
  readingdim = digitalRead(inPindim);

  // if the input just went from LOW and HIGH and we've waited long enough
  // to ignore any noise on the circuit, toggle the output pin and remember
  // the time
  if (readingmod == HIGH && previousmod == LOW && millis() - modtime > debounce) {
    if (state < 5)
      state = state + 1;
    else
      state = 0;
    modtime = millis();    
    Serial.println(state);
  }
  if (readingdim == HIGH && previousdim == LOW && millis() - dimtime > debounce) {
    if (intensity < 255) {
      intensity = intensity + 64;
      if (intensity == 64 ) {
       intensity = 63;
      }
    }
    else {
      intensity = 0;
    }
    dimtime = millis();    
    Serial.println(intensity);
  }


  switch (state) {
    case 0:
      analogWrite(redoffPin,  0);
      analogWrite(redonPin, 0);  
      analogWrite(blueonPin, 0);
      break;    
    case 1:
      analogWrite(redoffPin, intensity);
      analogWrite(redonPin, 0);  
      analogWrite(blueonPin, 0);
      break;
    case 2:
      analogWrite(redoffPin, 0);
      analogWrite(redonPin, intensity);  
      analogWrite(blueonPin, 0);
      break;
    case 3:
      analogWrite(redoffPin, 0);
      analogWrite(redonPin, 0);  
      analogWrite(blueonPin, intensity);
      break;
    case 4:
      analogWrite(redoffPin, 0);
      analogWrite(redonPin, intensity);  
      analogWrite(blueonPin, intensity);
      break;
    case 5:
      analogWrite(redoffPin, intensity);
      analogWrite(redonPin, 0);  
      analogWrite(blueonPin, intensity);
      break;
    default: 
      analogWrite(redoffPin, 0);
      analogWrite(redonPin, 0);  
      analogWrite(blueonPin, 0);
      break;
  }

  previousmod = readingmod;
  previousdim = readingdim;
}