BioBoard/Documentation/Optical loss

From Noisebridge
Jump to: navigation, search

Introduction to optical loss[edit]

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[edit]

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?

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, both of which are available at a variety of on-line electronics stores, at least in the U.S. - any equivalent pair should work as well, but resistance on the circuitry and parts of the Arduino code may need tweaking. For the HIR204/OP506B couple, the required circuitry is limited to a couple of resistors.

Things to keep in mind[edit]

When designing a probe for measuring biological processes, it's important to use biologically inert materials; this means that the materials you use should be non-toxic, but also non-biodegrabable. Acrylic, polycarbonate and stainless steel all fit the bill, but vary considerably in price, availability and workability. PVC is opposed by some, on the grounds that species of bacteria have been discovered that can degrade it rapidly - whether these are likely to be present in your specific culture is an open question.

Food safety is another consideration. We've used hot glue for our initial prototypes, because although hot glue is probably not food safe (can't find any sources to verify / falsify this), in this design it is encased in acrylic. We will switch to aquarium glue in the final edition, though, on the assumption that as fish are extremely sensitive to water quality and don't suffer ill effects from it, it's likely to be safe for humans, too.

Last, but not least: this should go without saying, but make sure you don't get a glue with anti-fungal / bacterial / microbial properties - you want those critters to live so you can study them, right?

What you need[edit]

  • 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)

Here's a quick hand-drawn sketch of our NIR probe to give you an overview of the construction described below.

How to build it[edit]

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 phototransistor, 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 length of PVC tube with a tight-fitting cap, make a hole in the cap for wires, and simply pull the tube + cap over your NIR probe like a lampshade. Making sure the phototransistor is pointing downwards also helps.

Bonus level: 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'll make life easier for you when you have to solder extensions on. Solder about 2 ft / 60cm of additional wire (remember the colours) to both leads. Then take a piece of acrylic tube big enough to fit the motor and about 1/2" / 13mm wire and plug one end with glue. Insert the motor in the tube - make sure fits tightly by wrapping the fixed part in electrical / gaffer tape, taking care not to block the rotor. Plug the other end of the tube carefully with glue, covering the soldered joint for extra strength.

Attach the BubbleShakerTM to your NIR probe by grinding one side of the tube flat, doing the same to the LED end of the probe, and glueing the two together with acrylic cement. There's a picture of a fully assembled unit here.

Interfacing and measuring[edit]

Connecting to Arduino

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. Start out by connecting the 5V and GND pins on the Arduino to the power (+ / red) and ground (- / blue / black) strips on the breadboard. Then wire the LED to 5V and GND across a 150Ω resistor. Now connect the collector lead on the phototransistor to 5V, and the emitter lead to an empty strip on the breadboard, then wire that strip to the A1 pin on the Arduino with a connector, and to ground with a 100Ω resistor. If you've built the bonus version, you'll also need to wire your BubbleShaker to 5V and GND. Then you're ready to hook the Arduino board up to your computer, program it and start recording.

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 this Arduino 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$.


Calibrating measuring equipment is an important part of any scientific pursuit, because the accuracy of your calibration determines the reliability of your data. However, when it comes to biomass and cell density, determining absolute values may be somewhat difficult, so you might want consider whether you actually need to know; in a lot of cases, you are likely to be less interested in the absolute biomass than in the relative change in biomass over time.

To get an absolute measure of biomass in a live microbial culture, you can use several different techniques:

  • counting cells in a special microscope chamber
  • marking cells with radioactive isotopes and counting scintillation events
  • incubating on solid substrates overnight and counting the resulting colonies
  • desiccating samples to measure total dry organic matter by weight

All of these techniques will require special equipment, though, and multiple measurements over time to create enough data to draw reliable calibration curves and compare your NIR probe values to those curves. We're not going to go into detail with any of that here - Google will help you learn more if you want - but merely describe the ways in which you can adjust your probe if you need to.

The easiest way to calibrate this NIR probe is by tweaking the Arduino sketch. Use a voltmeter to measure the voltage coming off the leads from the phototransistor directly when the probe is just sitting in air (should be close to 5V), and simply enter that value instead of the default IMAX value in the 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) */

An initial test of your probe in the most and least dense cultures you plan to monitor should then tell you whether you can actually measure across the relevant range.

If you have problems covering the whole spectrum, the other two things you can adjust relatively easily are the distance between the LED and the phototransistor, and the resistance on the circuit. A low resistance potentiometer instead of the 100Ω resistor on the emitter lead would allow you to adjust the sensitivity of the phototransistor directly, and provide a way of tuning it without having to disassemble and rebuild it. You can also decrease the light intensity of the LED by increasing the value of the resistor; 470Ω seems to be a good mid-level.

Geeking out[edit]

The reduction in intensity of light passing through a mass is due to a combination of reflection, absorption and scattering - the relative importance of these depends on the specific properties of the mass or substance, and for any given substance will vary with the wavelength of the light. When measuring directly in liquids, surface reflection usually does not contribute significantly to optical loss, thus the reduction in light intensity is almost entirely due to absorption and/or scattering.

Most chemical substances absorb light in the visible spectrum, but don't absorb or scatter much in the infrared spectrum. Conversely, with the exception of chlorophyll-containing algae and bacteria, microbiological cells generally block / scatter IR light, but don't absorb or scatter much in the visible spectrum, which is also why they appear colourless or even translucent under a microscope. Thus, a sensor measuring optical loss in the near-infrared part of the radiation spectrum (850nm in our case) will generally be much more responsive to biomass / cell density than to any (inorganic) chemical compounds present in the medium.

Making it cooler[edit]

Streamlining and verifying our current design is going to be a high priority, but we are also considering possible future develoments. One potential future improvement on the current design could be inspired by another commercial NIR probe called [Media:TruCell.TN.AUvsOD.pdf|TruCell], which uses a laser diode as lightemitter, enabling measurements at much higher cell densities. Another developement could be the construction of either a full-spectrum spectrophotometer - likely very problematic to scale down far enough to fit in a piece of 1" PVC tube - or a probe with several emitter/sensor pairs that would allow us to measure at several wavelengths at once.


External links from the text above and additional resources

  • [1] Wikipedia article on spectrophotometry
  • [2] Wikipedia article on photometers
  • [3] Wikipedia article on infrared radiation
  • [4] Single-channel NIR sensor from Optek
  • [5] The Arduino IDE