Team:Brown/Modeling/Light device

From 2010.igem.org

(Difference between revisions)
Line 23: Line 23:
/*<br>
/*<br>
  Light Induction Device<br>
  Light Induction Device<br>
-
  Turns on an LED on for a specific amount of time, then off, and repeats
+
  Turns on an LED on for a specific amount of time, then off, and repeats<br>
-
  The circuit:
+
  The circuit:<br>
-
  * LED connected from digital pin 13 to ground.
+
  * LED connected from digital pin 13 to ground.<br>
-
* Note: On most Arduino boards, there is already an LED on the board
+
  */<br>
-
connected to pin 13, so you don't need any extra components for this example.
+
<br>
-
  */
+
int ledPin =  13;    // LED connected to digital pin 13<br>
-
 
+
int ledPin2 = 12;    // LED connected to digital pin 12<br>
-
int ledPin =  13;    // LED connected to digital pin 13
+
// The setup() method runs once, when the sketch starts<br>
-
int ledPin2 = 12;    // LED connected to digital pin 12
+
void setup()  {       <br>       
-
// The setup() method runs once, when the sketch starts
+
   // initialize the digital pin as an output:<br>
-
void setup()  {              
+
   pinMode(ledPin, OUTPUT); <br>
-
   // initialize the digital pin as an output:
+
   pinMode(ledPin2, OUTPUT);  <br>
-
   pinMode(ledPin, OUTPUT);  
+
}<br>
-
   pinMode(ledPin2, OUTPUT);   
+
// the loop() method runs over and over again<br>
-
}
+
void loop()       <br>           
-
// the loop() method runs over and over again
+
{<br>
-
void loop()                    
+
   digitalWrite(ledPin, HIGH);  // set the LED1 on<br>
-
{
+
   digitalWrite(ledPin2, HIGH);  // set the LED2 on<br>
-
   digitalWrite(ledPin, HIGH);  // set the LED1 on
+
   delay(14400000);                  // wait for 4 hours<br>
-
   digitalWrite(ledPin2, HIGH);  // set the LED2 on
+
   digitalWrite(ledPin, LOW);    // set the LED1 off<br>
-
   delay(14400000);                  // wait for 4 hours
+
   digitalWrite(ledPin2, LOW);  // set the LED2 off<br>
-
   digitalWrite(ledPin, LOW);    // set the LED1 off
+
   delay(14400000);                  // wait for 4 hours<br>
-
   digitalWrite(ledPin2, LOW);  // set the LED2 off
+
}<br>
-
   delay(14400000);                  // wait for 4 hours
+
-
}
+
</html>
</html>

Revision as of 05:59, 25 October 2010

Illumination device design

Prototype light device.jpg

This prototype device uses two super-bright blue LEDs (470nm, 2400mcd) to illuminate cells. It will be used to drive the LOVtap promoter, which is responsive to blue light. The device is controlled by an open-source Arduino Duemilanove microcontroller and can be custom-programmed to cycle through various light states for various amounts of time.

The Arduino Duemilanove

The Arduino Duemilanove ("2009") is a microcontroller board based on the ATmega328 (datasheet)The Duemilanove has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button.

  • Operating Voltage - 5V
  • DC Current per I/O Pin - 40 mA

Calculating the proper resistor

The LED we used has a forward voltage of typically 3.5V with a max of 4V. The Arduino Duemilanove outputs at 5V. Thus, we used the resistor calculator located [http://metku.net/index.html?sect=view&n=1&path=mods/ledcalc/index_eng here] to calculate the proper resistors to use:

Ledcalculation.jpg

We only had a limited number of resistor types in stock, so we used a 56 Ohm resistor. The light output was not as bright as we wanted, so we switched to a 37 Ohm resistor. This may stress the LED more than usual, but should be enough resistance that it will not easily burn out.

Source code

/*
Light Induction Device
Turns on an LED on for a specific amount of time, then off, and repeats
The circuit:
* LED connected from digital pin 13 to ground.
*/

int ledPin = 13; // LED connected to digital pin 13
int ledPin2 = 12; // LED connected to digital pin 12
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
// the loop() method runs over and over again
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED1 on
digitalWrite(ledPin2, HIGH); // set the LED2 on
delay(14400000); // wait for 4 hours
digitalWrite(ledPin, LOW); // set the LED1 off
digitalWrite(ledPin2, LOW); // set the LED2 off
delay(14400000); // wait for 4 hours
}