Assignment 8, Part 2: lock-in amplifier and temperature control

From Course Wiki
Jump to: navigation, search
20.309: Biological Instrumentation and Measurement

ImageBar 774.jpg

This is Part 2 of Assignment 8.


In this second phase of the DNA Melting Lab you will make changes to your DNA melter that will improve the quality of the melting curves you generate. Two of the most important improvements are adding lock-in detection to reduce the effects of optical noise and a temperature controller to enable control of the sample heating and cooling rates. You will also use a computer model to compensate for the difference in temperature between the heating block and sample, photobleaching, and thermal quenching of the fluorescent dye.

Use the fluorescein and "beater" DNA samples available in the lab to test and debug your system. Continue refining your instrument until you are satisfied with the results. Please use DNA samples judiciously (even the "beater" DNA). Keep DNA sample samples out of the light when you are not taking data to reduce photobleaching.

Electronic circuit changes for lock-in detection

Block diagram of lock-in amplifier for DNA melting

There are two important changes needed to implement lock-in detection on your DNA melter — making the LED intensity vary sinusoidally, and modifying the photodiode amplifier to operate over a different range of frequencies. Initially in the lab, the optical signal consisted of very low frequencies. Multiplying the signal by a cosine moves the frequency range of interest much higher. You will have to change your amplifier circuit to handle the higher frequencies.

You will use an op-amp circuit to enable modulation of the LED. Modulating the LED will allow you to place the optical signal generated by the fluorescent dye in a low-noise area of the frequency spectrum. Recovering the original signal requires multiplying by a cosine of the same frequency and low-pass filtering. The multiplication and filtering is done in software.

Build an LED driver

LED driver circuit

In order to take advantage of the lock-in technique to reduce noise from other photonic sources, the illumination from the blue LED has to be modulated with a cosine waveform. You will use an op amp to implement a circuit that will vary the current through the LED in proportion to the applied voltage. Software controlling the DAQ system will generate a cosine voltage waveform that you can use to drive the LED circuit. Since LED current must be positive, the software will also allow you to add a DC offset to the cosine waveform and keep the total voltage greater than zero.

A schematic diagram of the LED driver circuit is shown on the right. Note that it uses a different model of op amp than the ones in your transimpedance amplifier: an LM741. A good value for Rsense is 10 Ω.


  • LM741 op-amp from the Electronics Drawer
  • Current feedback resistor

Part 2 photodiode amplifier

Part 2 photodiode amplifier.

In part 1 of the lab, you used a capacitor in the first gain stage of the photodiode amplifier to implement a low-pass filter. Modulating the LED will move the signal to a much higher frequency. So rip that sucker off — now your amplifier needs to work on a signal that is changing much more quickly.

Photonic noise at low frequencies is very large — frequently much larger than the signal from the fluorescent dye. For this reason, the part 2 amplifier includes a high-pass filter that removes much of the low-frequency junk before it gets amplified by the second stage. Pick values for C2 and R7 so that the cutoff frequency gets rid of as much of the low-frequency noise as possible while still allowing the ~10kHz modulated DNA signal to pass.

For a real op-amp the golden rules are only approximately true, and small amounts of current can flow into the input terminals. The effects of this current are minimized when the input impedance of the + and - terminals are balanced. Assuming R2 < R1 and R3, choosing R6 ≈ R3 should give you the desired results.

After you make these changes, double check that everything is still working well. You may need to update the gains of one or both of your amplifier stages to work best with the lower signal level and increased frequency.

Minimizing electronic noise

You probably noticed a good amount of noise in the signals from your original DNA melter. Fundamental noise sources such as shot noise and dark current noise certainly had an effect, but it is likely that technical sources of electronic and optical noise were a much larger problem. This section explains some of the steps you can take to reduce the susceptibility of your instrument to technical noise sources.

Figure 1: Sources of electronic noise include common mode noise, electromagnetic coupling, noise conducted through power lines, and Johnson noise.

Electronic noise

Figure 1 shows four ways that electronic noise can enter circuits.

  • Electromagnetic fields induce currents in the wires that make up your circuit. There are many sources of electromagnetic fields that can interfere with your circuit: power lines, other pieces of electronic equipment, electrostatic discharges, and radio signals.
  • Noise from other pieces of equipment can be conducted through power lines.
  • Real wires and connectors have nonzero resistance. Current flowing through a common ground wire causes the ground potential to shift.
  • Random currents arise in conductors maintained at nonzero temperatures due to the thermal energy of the electrons. This phenomenon is called Johnson noise. The magnitude of random voltages gets larger as the resistance of the conductor increases.

Here are some suggestions for things you can do to reduce electronic noise in your DNA circuit:

Temperature control

A software control loop implements a Proportional-Integral-Derivative (PID) controller in order to maintain the sample block at a desired temperature. Digital signals control high-current switches (called an H-bridge) to make the TECs heat, cool, or remain inactive. Temperature control is effected by setting the duty cycle of these three functions. A fan carries away excess heat.

Add a temperature controller board

The temperature controller includes of a printed circuit board (PCB) that can apply current to the TEC in either direction, which in turn causes heat flow in or out of the sample block. The board is controlled by digital signals from the DAQ that are generated in the part-2 version of the DNA melter software.

Three status LEDs are provided on the PCB. A lighted green LED will confirms power applied. A red LED will indicates sample heating mode; blue means cooling.

Important: if you see a blue or red light when you are not running an experiment, immediately turn off the Diablotek power supply. Leaving the system stuck in heating or cooling mode for a long time will result in runaway temperatures that will likely destroy a TEC. Don't do that — fixing the problem requires a lengthy and mess removal and replacement process.


Gather the following components:


Points of connection are labeled on the PCB and described in the table and figure below. Refer to both in the instructions that follow.

  1. Place the PCB in the pre-drilled holes on the sheet metal support bracket.
    • If the nylon "feet" are missing, add them now. They are in the DNA Melting drawer at the right of the Wet Bench.
  2. Disconnect the yellow/white cable between the power supply and the TEC stack.
  3. Connect the red/black connector cable to the TEC stack.
    • Join the red wire to the red lead of the top TEC and the black wire to the black lead on the bottom TEC using wire nuts.
    • Plug the white Molex connector at the other end of the red/black cable to its mate on the PCB.
  4. Turn off the Diablotek power supply.
  5. Connect the Diablotek and check power
    Connect the fan to the PCB
    • Connect the Diablotek 4-pin/3-color power supply connector to the PCB. (NOTE: this is different from the connector that you used in Part 1. The connector is white instead of black.)
    • Quickly cycle the Diablotek power to confirm a green power status light in the upper right corner of the PCB.
    • Confirm that the Diablotek is off.
  6. Connect the fan itself to the Fan +/- connections at the bottom of the PCB (red to +, black to -, innermost row. See figure).

Update your PC data acquisition system

You will need to route several additional signals from the DAQ to your DNA melter to control the LED modulation and temperature control board.

The DAQ connections and cable wire colors are summarized in the table below, and the document.

Signal Name Signal Location Ground Location Pin wire color
DAQ Inputs
RTD AI0+ AI0- +Orange / -Black (lone pair)
Photodiode AI1+ AI1- +Green / -White
DAQ Outputs
Fan P1.1 N/A Orange
Heat/Cool P1.0 N/A Red
Digital GND DGND N/A Black (bundled with Red/Orange)
Heater/Cooler On/Off CTR0 DGND/AOGND +Green / -Blue or -Black
LED Modulation Carrier AO0 AOGND +Yellow or +White / -Blue

Connect the DAQ cable to the control board

DAQ Connection Cable
Connect the DAQ to the PCB
  1. Connect the orange Fan signal pin to the Fan signal header socket at the top of the PCB (innermost row).
  2. Connect the black digital GND signal pin to the marked DGND header socket at the top of the PCB (innermost row).
  3. Connect the red Heat/cool signal pin to the marked Heat/cool header socket at the top of the PCB (innermost row).
  4. Connect the green/blue or green/black Heater/cooler On/off signal pins to the marked header sockets at the top of the PCB (innermost row).
  5. If you have not already done so, connect the appropriate DAQ cables to the RTD and LED circuits on your breadboard.

Test the system

Data acquisition and control is done by the "Lockin DNA Melter GUI", provided for you on the lab computer. Follow the instructions in the LockIn DNAMelter GUI wiki page to become familiar with the software. You may find it useful to review the block diagram again on the Understanding the lock-in amplifier wiki page.

Before you run any experiments, verify that you have connected the PCB board to the DAQ and TEC power supply appropriately.

Early in melting cycle
Late in melting cycle
  1. In MATLAB, run the LockinGUI function.
  2. Turn on your +/- 15V power supply.
  3. Toggle the LED button in the GUI to verify that your LED circuit works. If not, check your connections.
  4. Use a fluorescent sample (DNA or fluorescein) to test your optical path
    • With the fluorescent sample loaded, turn on the LED.
    • Remove the sample (or replace it with a vial filled with water) and you should see a change in the fluorescence signal. If not, debug.
  5. Turn on the Diablotek TEC power supply.
    • Your fan should start at the same time. Any time the TEC power supply is on, the fan will turn on automatically when you first start-up this GUI, it will turn off when you start to heat, and it will turn back on when either the temperature profile enters the cool-down phase or when you click on the cool-down override button in the GUI. The fan is necessary to help your heat sink dissipate the waste heat that is pumped from the top side of the TEC stack during cooling operations.
  6. Finally, click "START" to start a heating cycle.
    • The fan should turn off, the red heating status LED should light up, and the temperature of your heating block should start to respond. Be sure that your TEC power supply is on for this test. You may want to adjust the heating profile for debugging purposes.

Test, debug and improve your instrument until you are satisfied with the results. Fluorescein and "beater" DNA samples are available for debugging and bringup, but please use judiciously. To preserve your fresh DNA sample, quickly remove from the instrument and protect from light when not gathering data. It is wise to run several beater-DNA samples and process the data to ensure that your instrument is operating properly and reliably before moving on to your real samples.


Once you are happy with your design, document the changes you made to your instrument.

  • Include component values, gain values, cutoff frequencies, lens focal lengths, and relevant distances.
  • It is not necessary to document construction details, unless you built an instrument that was significantly different than the lab manual suggested.
  • Refer to schematics and diagrams in the lab manual instead of copying them into your report. Use reference designators (such as R7, C2) to refer to call out particular components in schematic diagrams.

Measure SNR

Using a fluorescein sample, and choosing the same operating conditions that you will use to collect your melting curve data, carry out a test of the signal to noise ratio (SNR). Run the SNRLockin function in MATLAB, collect data until the strip chart at the bottom of the screen is full of good data, then click "Open file..." to record this data to disk. Next, at the Matlab command line, load your SNR output file into an array and run its transpose through the SToNCalculator.m function provided, using no semicolon after the function name:

snr = load ('snrFile.txt')';

StoNCalculator( snr, 'sampleName')

This function will output graphical representations of your data along with your calculated SNR numbers. Your instrument will be rated based on its "Adjusted SNR."


Turn in the resulting plots used to make your SNR measurement and record your adjusted SNR. How does this SNR compare to the one you took in Assignment 7?

Take some preliminary data

Record at least one DNA melting curve using the beater DNA sample and your newly upgraded instrument.


  1. Report instrument settings you used for each trial, including control software parameters.
  2. Plot fluorescence vs. block temperature.
    • The plot should have temperature in °C on the horizontal axis and fraction of double stranded DNA on the vertical axis.
    • Normalize the data so that the fluorescence decreases from 1 at room temperature to 0 at 95C.
    • On the same axes, plot your the fraction of double-stranded DNA predicted by DINAmelt (or any other software of your choice).
  3. Estimate the DNA melting temperature from your plot. Compare with the theoretical Tm.
  4. How does your data compare to the curve you measured in Assignment 7?


  • Overview
  • Part 1: convolution Let's check that you're comfortable with convolution and the lock-in amplifier design;
  • Part 2: lock-in amplifier

Back to 20.309 Main Page


Background reading

Code examples and simulations

Subset of datasheets

(Many more can be found online or on the course share)

  1. National Instruments USB-6212 user manual
  2. National Instruments USB-6341 user manual
  3. LF411 Op-amp datasheet
  4. LM741 Op-amp datasheet