BioBoard/Documentation/Optical loss: Difference between revisions

From Noisebridge
Jump to navigation Jump to search
Line 73: Line 73:


'''Step 7: Building the BubbleShakerTM (optional)'''
'''Step 7: Building the BubbleShakerTM (optional)'''
Some biological processes form gas (usually C02), which may cause bubbles to form on the surface of the LED and phototransistor and throw off your measurements. To solve this problem, we've created the amazing BubbleShakerTM - a small off-set motor ('buzzer') extracted from an old cell phone, encased in a short piece of acrylic tube plugged with aquarium / hot glue on both ends.
To build one yourself, the first thing you'll have to do is find an old cell phone somewhere, crack it open, and extract the motor - get as much of the wires as you can, it make life easier for you when you have to solder extensions on.


==Things to keep in mind==
==Things to keep in mind==

Revision as of 18:17, 29 April 2011

Introduction to optical loss

When light travels through a substance, whether it's solid, liquid or gaseous, the intensity of the light is reduced; this is called optical loss. Measuring how much the light intensity is reduced at different wavelengths is called spectrophotometry, and can be used to determine many different properties of the substance, such as concentration of a solution or opacity of a glass pane. To do this, you need a photometer, which is essentially a combination of a light source of known intensity and wavelength, and a light sensor which measures how much light was absorbed and/or scattered by the sample over a fixed gap.

Spectrophotometry may also be applied to gain information about biological processes. Especially in microbiology, where most work is done with organisms that are too small and too numerous to easily count individually, optical loss is often used as a proxy for cell density or biomass. For instance, measuring the light absorption of chlorophyll in an algae vat may be used as a direct proxy for the algal density.

In industrial production systems, such as large-scale alcohol fermentation, insulin production, etc., biological growth is often monitored using in-line ('live') sensors, which measure optical loss, usually at wavelengths in the near-infrared (NIR) or IR-A spectrum (700-1400nm). The inspiration for the home-built NIR probe described in the rest of this wiki is a single-channel NIR sensor from Optek, which emits and detects at 850nm, and is designed for in-line monitoring of yeast fermentations.


Building a NIR probe

When building a near-infrared sensor, the first important choice is that of light source (photoemitter) and sensor (photosensor). Important considerations include:

  • what's the appropriate wavelength(s) for your purposes?
  • how much circuitry do you want to build?
  • how much can you afford to invest?

Discussion of pros/cons of different source/sensor pairs

This design uses an 850nm plastic LED (Everlight HIR204 - $0.43) as the photoemitter, and a matching phototransistor (Optek OP506B - $0.80) as the photosensor; the required circuitry is limited to a couple of resistors.


What you need

  • 1x IR LED
  • 1x Phototransistor
  • 1x 1kΩ resistor
  • 1x 100Ω resistor
  • 1x Soldering iron + solder
  • 1x 3/4" / 20mm acrylic tube
  • 4x 3/4" / 20mm acrylic discs
  • 1x 1" / 25mm PVC pipe
  • Acrylic cement (thick)
  • Wire
  • Aquarium glue/hot glue

Optional: cell-phone motor (BubbleShaker Technology)

How to build it

Step 1: probe parts
Step 3: assembling
Step 4: waterproofing
Step 5: spacing


Step 1: Cutting acrylic

Start by cutting the 3/4" acrylic tube into 2 x 1" / 25mm pieces (A1 and A2) and 1 x 3/4" / 20mm piece (A3). Make a slit in A3 approx. 1/3" / 8mm wide by making two cuts that run the entire length of the tube. Acrylic is very easy to cut with a small rotor tool (e.g. a Dreml), but you can also use a small hacksaw. Files or fine sandpaper are good for smoothing rough edges and planing not-quite-perpendicular cuts.


Step 2: Soldering wires

Cut the leads on both the LED and the phototransistor about 30% shorter. Solder wires onto the leads, and make sure to note down what colour wire you use for the different leads! These are polar devices and won't work if you wire them up backwards. We suggest you use red for both power / emitter leads, black for the ground lead on the LED, and white for the collector lead on the phototransistor.


Step 3: Assembling

Drill a 3mm (or as close as you can get with Imperial units) hole in the center of each acrylic disc. Take two of the discs, carefully lay down a narrow line of acrylic cement around the holes, then insert the LED and phototransistor in the holes, and set them aside to cure. When the acrylic discs with the LED and phototransistor have properly cured, thread A1 and A2 on one set of wires each, lay a fat line of acrylic cement along the edge of both discs and press A1 and A2 firmly into place, creating a lidded, cylindrical chamber for the leads. Leave to cure. Reinforce the seal by laying down another line of acrylic cement along the joint between the tubes and the discs.


Step 4: Waterproofing

Waterproof each chamber completely by filling it out with aquarium / hot glue, then immediately string the last two acrylic discs onto the wires and glue them to the tubes with acrylic cement. Leave to cure, then reinforce the seal from the outside with another line of acrylic cement.


Step 5: Spacing

Once the aquarium / hot glue has cured properly, take A3, place it between the two acrylic discs holding the LED and photoresistor, and glue the three parts together with acrylic cement, then leave to dry.


Step 6: Blocking sunlight with PVC (optional)

Since sunlight includes lots of infrared radiation, it may be necessary to shield your probe. A very simple way of doing this is to take a dark plastic cup that's deep enough to fit the whole assembly, drill a small hole in the bottom of the cup, then turn it upside down, pull the wires through the hole, and use the cup for an inverse lampshade.


Step 7: Building the BubbleShakerTM (optional)

Some biological processes form gas (usually C02), which may cause bubbles to form on the surface of the LED and phototransistor and throw off your measurements. To solve this problem, we've created the amazing BubbleShakerTM - a small off-set motor ('buzzer') extracted from an old cell phone, encased in a short piece of acrylic tube plugged with aquarium / hot glue on both ends.

To build one yourself, the first thing you'll have to do is find an old cell phone somewhere, crack it open, and extract the motor - get as much of the wires as you can, it make life easier for you when you have to solder extensions on.

Things to keep in mind

Biologically inert materials

Food safety

Aquarium glue vs hot glue


Interfacing and measuring

After assembling the probe, you'll need to wire it up to some kind of microcontroller; we've used an Arduino clone called BoArduino, and will use that as example, but you can use any type you like. In order to program the the BoArduino, you have to download and install the Arduino software first. Once this is done, you're ready to connect your board - in some cases, this requires a special cable, so make sure you've got the right one! Now open the Arduino program, copy the code in the box below into the blank sketch, and hit upload. Open the serial monitor to see the print-out of the data being transmitted from the probe, which ought to look more or less like this: @NIR:0:0.99$.

//
// This Arduino sketch reads our custom NIR absorption sensor.
//
// This code is part of the BioBridge Project.
//
//
//  author: rolf van widenfelt (c) 2011
//
// revision history:
//
//  apr 25, 2011 - rolf
//    identify this probe.  (needed for BioBoard protocol)
//
//  apr 17, 2011 - rolf
//    created.
//    ADC code seems to work.. still need to connect actual sensor and document connections!
//
//
// code modification:
//  you will need to set some calibration points... (FILL THIS IN!!)
//
// description:
//  this sketch will periodically output a short string that contains the NIR transmittance
//  along with some other fields that indicate which probe (0) is being read.
//  the string should look like this for a transmittance of 99% :
//
//    @NIR:0:0.99$
//
//  this is output periodically.  (in this case, every 5 sec)
//
//  In the case of an error, an "E" message is output instead of the temperature, like this:
//
//    @TC:0:EBADVALUE$
//
//  note that these data packets are output to the serial console window at 19200 baud.
//  also, when the sketch first starts, it identifies the software and version, like this:
//
//    @ID:BIOBOARD:TESTBATCH1:1.1$
//
//  that's it!
//
static const char ProjectName[] = "TESTBATCH1";
const int analogNIRPin = A0;  // analog input pin that the NIR phototransistor circuit is connected to
// CALIBRATION SETTINGS
#define IMAX 4.9    /* max phototransistor current with IR LED on (no obstructions, just 1inch air) */
#define IMIN 0.02    /* dark current (NOTUSED) */
#define VMAX 5.0    /* arduino voltage = 5.0v */
#define ADCMAX 1023    /* highest ADC value */
#define IMAXI (ADCMAX*IMAX/VMAX)   /* highest ADC value we expect from our sensor */
#define IMAXI_INV (1.0/(ADCMAX*IMAX/VMAX))   /* inverse (this avoids a divide during runtime) */
void setup(void)
{
 // start serial port
 //Serial.begin(9600);
 Serial.begin(19200);
 Serial.print("\n\r@ID:BIOBOARD:");
 Serial.print(ProjectName);
 Serial.print(":0.1$\n\r");
 // configure ADC to use external 5v reference (default)
 analogReference(DEFAULT);
 // just in case, throw away 1st ADC read
 (void) analogRead(analogNIRPin);
 // identify this probe
 Serial.print("@PR:NIR:0$\n\r");
}
void printNIR()
{
 int sensor = analogRead(analogNIRPin);
 float sample = IMAXI_INV * sensor;
 if (sensor > IMAXI + 10) {
   Serial.print("EBADVALUE");    // oops, value is clearly wrong, so output an "E" message.
 } else {
   Serial.print(sample);
 }
 // XXX debug - we output raw ADC value as well
 Serial.print(":");
 Serial.print(sensor);
}
void loop(void)
{ 
 delay(2500);
 
 Serial.print("@NIR:0:");
 printNIR();
 Serial.print("$\n\r");
}


Calibrating

How to find out whether your measurements are accurate (do you need to know?)

How to adjust (distance, resistance)

Making it cooler

Tuning to different substances

Multi-channel measurements

Geeking out

In chemistry and biology, many different methods are employed to analyze the properties of a given substance. One method that is extremely useful in both disciplines is spectrophotometry, the analysis of reflection or transmission properties of a material as a function of wavelength.

techniques can be split into in-line ('live')

  • counting cells in a special microscope chamber,
  • marking cells with radioactive isotopes and counting scintillation events

and off-line

  • incubating on solid substrates overnight and counting the resulting colonies
  • desiccating samples to measure total dry organic matter

None of these techniques are very useful for monitoring biological growth over time, however, so photometry is often used instead.


Reduction of light passing through a mass

Absorbance vs. scattering

Links

  • Optek
  • Wikipedia
  • TruCell .pdf