Williams: Optical Trapping Lab 1

From Course Wiki
Revision as of 03:57, 12 March 2012 by Ajoke Williams (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
20.345: Bioinstrumentation Project Lab

Diagram of Electronic Control System

Electronic Controls DAQ and Piezo-Controller

Electronic Controls DAQ and QPD


Matlab : programming language using 'daqtoolbox'
DAQ – National Instruments DAQ Card
Piezoelectric Driver and Controller - TPZ001
Bead size: 0.97 um beads used
Laser wavelength: 976um

Goals: What we set out to accomplish

We set out to add functionality to the trap control software, specifically we wanted to automate centering of the DNA-tethered bead using a centering algorithm which we would write in MATLAB. To center the DNA-tethered bead we would need to learn how to talk to different electronics using DAQ and the daqtoolbox in MATLAB, how to test a code which is supposed to provide specific functionality, and a bit about the gui in MATLAB. After writing the code, our goals expanded to include writing code to simulate a typical optical trap experiment which would be used to measure the persistence length and the contour length of DNA.

Motivating the project goal

We wanted to center the bead so when we fit the x displacement vs. Force applied curve to the worm chain model that the force we calculated(by relating the voltage received from the QPD to the "spring constant" of the laser beam) was being fully applied to the the DNA-tethered bead. By centering the tether, we hoped to improve estimates on the persistence lengths and contour length for the DNA. Furthermore, centering the bead also helped ensured that, to estimate the persistence length and the contour length of the DNA , the only "displacement' of the tether in one direction is being measured. This is necessary because in the worm chain model [See Appleyard] there is a relationship between force and displacement of a linear unit of distance ( x ) of the DNA:

$ F = \frac{k_{B}}{l_{p}}[(\frac{1}{4}(1 - \frac{x}{l_{c}})^{-2} - \frac{1}{4} +\frac{x}{l_{c}}] $

where k_{B} is the Boltzmann constant, l_{c} is the contour length and l_{p} is the persistence length.

Project Steps

1. Understanding the OTKB code and figuring out how to use the variables that were already defined in OTKB.m to write our code, for ease of integration.
2. Writing a skeleton for the data acquisition and then the subsequent update of piezoelectric stage position. <br\> 3. Determining the relationship between the output piezoelectric voltage and the feedback voltage fed into the piezoelectric motor so that the stage can be centered accordingly.
4. Designing a centering algorithm

Project Steps 1-3

We first started out by creating a function called dnaTetherCentering which fed a sine waveform (only along one axis at a time) into the appropriate PiezoDriver channel. The sine wave was set to complete one full cycle every time the peizoelectric controller was triggered(line 40 of dnaTetherCentering.m ). The next step was figuring out the logical progression of steps for the code. We knew that we wanted to center the DNA-tethered bead in one axis at a time. We eventually settled on first centering the DNA tether in the x axis,centering the DNA tether in the y axis and then going back to the x axis to collect the data that will be used to fit the worm-chain model. These sequence of steps is followed with the use of the variables xcenter and ycenter, as seen in the code. The next step was to design a findCenter. The two main features we used to extract the location of the center of the DNA-tethered bead were the peak and trough of the curve.The peak and troughs of the voltage vs position reading curve correspond to regions where the DNA-tethered bead is "falling" out of the trap. Initially we tried to center the DNA-tether by resetting the "center" position of the piezoelectric stage to the same value that corresponded to the DNA-tether-bead's center. This approach had its advantages because it would allow other scanning patterns to be used on the tethered DNA set up. However, we we discouraged against using this technique due to the 'uncertainties' associated with manipulating the piezodrivers. The next approach we tried involved shifting our input voltage signal so that when a input voltage of '0' was feed into one of the axis for the piezodriver, the DNA-tether was centered. This approach mandated that we related the voltage input of our signal to the actual voltage that the piezodriver saw. We assumed this relationship was linear. Using the "getdata" method we were able to obtain the piezodriver voltage reading for a given input voltage signal.

Psuedo Code
1.Set parameters(number of samples to collection,duration of time for collecting samples, trigger to start driving piezoelectric stage, for feeding a waveform input DaqInput and retrieving data from DaqOutput.We only wanted to set these parameters once so that they stay the same for the entirety of the centering run
2. First center the x axis - store the value acquired for the x-axis center
3. Center the y axis - store the position acquired for the y axis center
4. Scan the x-axis and store data for fitting of worm chain model

GUI considerations:
1. Create button that initiates the protocol for centering the DNA-tethered-bead called "Center Sample"
2. Ensure that when the position for the centered value is returned that all the other waveforms are aware of the centered position. In order to do this, when we returned the centerPositionX, and centerPositionY properties of handles, we also called guiobjet() so that we could update all of the handles in the function in which the case "Center Sample" was true. Furthermore, we added the terms handles.CenterPositionX and handles.CenterPositionY to all of the waveforms ( with the appropriate axis properly matched).

Centering curve x axis.jpg

Another algorithm implemented but not fully debugged tried to discern the dna-tether center by calculating the discrete derivative of the voltage signal from the QPD to the uniaxial position movement of the optical trap's stage. The function, essentially looks for a region with discrete derivative (which would correspond to a region were the derivative is zero) <<< 1 and and then find the voltage reading of that "plateau". Then the function checks to see if other features of a good calibration curve are present such as the large (positive and negative) slope leading to the peak on the position/voltage readout curve.

Results of Project Steps

Matlab Code

Full OTKB code
DNATetherCentering Function
code.html Code for GUI graphics

Architecture of Code (i.e. some comments about things we did)
: 1. We retrieve more data samples than the number of samples in our signal so that we are sure that QPD output values from or signal are being recorded in the data returned by get data.
2. To center the bead we ended up adjusting sine wave amplitude by the voltage values corresponding to centered positions of the tether.

After some advice from Steve we added the following
New Additions to Code :
1. Graphs on the 3rd and 4th axis of guide so that someone could visually see the results of the centering process

GUI code in DNATetherCentering

Displays graphs of QPD reading and stage position as you center you tether. The data collected while moving the stage in the x axis displays on the lower left graph of the gui and the data collected while moving the stage in the y axis displays on the lower right corner of the gui.
OTKB gui finding a center.png OTKB gui after Dna Tether Centering.png

Simulation of Code with Stokes Method

Leanna Morinishi simulated the results of using the centering function to fit a F vs. x curve passed on parameters calculated using the PSD rolloff calibration method. Below I report on the results one would get if they used our centering function but parameters calculated using the Stokes Method. Using the Stokes Method a spring constant of 161 pN/nm was calculated( the data was retrieved from past years experiments). Using this constant, and other constants ( such as the piezoelectric stage's response to voltage ), I was able to plot a relationship between force and displacement for the data collected for the DNA-tether and fit a curve using the Worm-Chain Model.

I tried to fit the data to the Worm-Chain Model using two sets of starting parameters. For the first set of starting parameters I choose, lp = 45nm and lc = 900nm (lp is the persistence length and lc is the contour length). Using this set of initial conditions, the nlinfit function determined that the DNA-tether data was best fit by a DNA with a lp of 64.9nm and a lc of 1527.nm . Using another set of initial conditions ( lp = 65nm and lc = 1100nm) the nlinfit function determined that the DNA-tether data was best fit by a DNA with a lp of 96.8nm and a lc of 974.2nm.

WormChainModelFit1.jpg] WormChainModelFit2.jpg
For the first fit a mse value of 121.6158 was calculated and for the second fit an mse value of 458 was calculated. This shows that, the setting appropriate initial conditions is vital find obtaining reasonable parameters for a nonlinear fit. I think the second fit was much worst than the first fit because I chose a parameter ( lp=65nm) that isn't in the range of acceptable lp values. As you can see small changes in the initial conditions have drastic effects on the fit of the model.

Unexpected Bugs Problems Encountered

One unexpected challenge or mental block was realizing that the voltage signal we feed into the piezoelectric stage was not the magnitude of the signal that the piezo-stage was seeing because the strain gauge was "adding" a voltage to piezoelectric controllers. This is the reason that the OTKB function had to "set" the initial position to 0, by adding the inverted voltage of the strain gauges output into the piezo-controllers (which drive the stage). When we finally understood this connection, we were able to adjust our code so that the magnitude of the voltage signal we feed the piezo-controllers was such that when the strain gauge's voltage was added to it our desired voltage would be the final voltage that the piezo-controller sees.

Accuracy of DNATetherCentering

Unfortunately, we were not able to do test on accuracy, but in the future, i.e., if other projects finish ahead of schedule it would be nice to come back and run performance test on our code.

Looking Forward

If I had more time I would like to look into other possible ways to center the tether. Steve talked about fitting the curves to a model and I would have liked to explore that option more if given more time. A set back I can foresee to writing code that fits the raw data to a model with the intention of retrieving the center, is the trouble of choosing appropriate initial conditions so that your 'fit' can converge on reasonable fit parameters.