Monday, March 7, 2016

Simulating a quadrupole

Before actually constructing a DIY-MS, extensive simulations should be done. This is to assure that at least the mathematical side of the project is correctly worked out and no(more) time and money is wasted on something that could not work in the first place. A first step would therefor be the simulation of the quadrupole mass filter.

Luckily, the ion-movement in the quad follows basic physical principles and (like all the good stuff in engineering) can be described by a differential equation, namely Mathieus linear ordinary second order differential equation. Solutions of this ODE describe ion movements in the quad, which can be seen to perform either stable oscillations or quickly "shoot" to infinity.
With calculus programs like Matlab or GNU Octave, these ion movements (for an ideal quadrupole) can be numerically calculated and plotted. I set up a quick Octave script to plot some trajectories for stable and unstable ions, like this stable ion trajectory for a stable ion of m/z 28:

and this unstable ion of m/z 29 under otherwise same conditions:
Interestingly but not surprisingly, even for an unstable ion, either the X-Z or Y-Z plane is still stable. Explanation can be found when looking at the aq stability diagram, provided for example by this publication by Ma & Taylor. Basically, for small a and q either x or y are stable and the stability diagram is the overlapping region of these stable zones.

Playing around with this small simulation additionally showed me how fragile these stable trajectories actually are. Even a RF-frequency offset of as little as 1% caused the otherwise stable ion of m/z 28 in this simulation to collide. This raises some concern about the electronics-side and overall tolerances of this project, wich have to be designed and manufactured to absolute precision as it seems. At least if a useful resolution of any kind ist to be achieved.

Anyway, this simulation is the first step to simulating an ESI-Quad mass spectrometer and a nice first step towards the ultimate goal.

For further reading I suggest the linked article by Ma & Taylor. The Skript for the simulation can be found below. Octave is free to use software and in many cases very similar to Matlab.

Cheers
Marco

# This skript for GNU Octave simulates ion trajectorys through ideal electric quadrupoles
# using an numeric approach to Mathieus ODE. All calculations are performed using SI-units.
# The quadrupole and initial values can be set up through the val-variable. 
# The skript is an early proof-of-concept an may contain major errors. 
# Initial values are taken from S. Taylor "Simulation of ion trajectories through the mass filter
# of a quadrupole mass spectrometer"
 
 clear
 graphics_toolkit ('gnuplot');
 lsode_options("integration method", "stiff"); 
 
 global val e ukg vz tmax phasepi ax qx
 
 val = [ 0028    # 1 m/z  Ion-specific m/z
   0020    # 2 U  Offset voltage
   0123.5    # 3 V  RF voltage
   2*pi*2.02e+6       # 4 omega RF frequenzy f ... omega=2*pi*f
   0.00275   # 5 r0  Quad formfactor: inner radius
   1   # 6 U beschl. Accelerationvoltage for the ion
   10e-9   # 7 dt  Timeinterval for simulation
   0.15   # 8 zmax Quad formfactor: length in z
   0.0003   # 9 x0   Entry offset in x for ion when entering the quad
   0.0000   #10 vx0  Initial velocity in x  
   0.0003   #11 y0   Entry offset in y for ion when entering the quad
   0.0000   #12 vy0  Initial velocity in y 
   pi/4];   #13 phase Ion entry phase
 
 e=1.602176462e-19;     #Electroncharge
 ukg=1.66054e-27;     #1u=1*ukg kg
 
 vz=sqrt(1/val(1)*2*val(6)*e/ukg);   #Velocity in z
 tmax=val(8)/vz;      #Time for flight through
  
 phasepi=val(13);
 
 ax=1/val(1)*e/ukg*4*val(2)/val(5)^2/val(4)^2#ax-Value in stability diagram
 qx=1/val(1)*e/ukg*2*val(3)/val(5)^2/val(4)^2#qx-Value in stability diagram
 ax/qx       #show a/q 

 function xdot=pendx(x,t)    #Function describing movement in x
  global ax qx phasepi
  xdot(1)=x(2);
  xdot(2)=-(ax+2*qx*cos(2*t+phasepi))*x(1);
 endfunction
 
 function xdot=pendy(x,t)    #Function describing movement in y
  global ax qx phasepi
  xdot(1)=x(2);
  xdot(2)=-(-ax-2*qx*cos(2*t+phasepi))*x(1);
 endfunction
 
 solx=lsode("pendx",[val(9) val(10)],t=[0:val(4)*val(7)/2:val(4)*tmax/2]); #Solve x movement
 soly=lsode("pendy",[val(11) val(12)],t=[0:val(4)*val(7)/2:val(4)*tmax/2]); #Solve y movement

 Z=[0:val(8)/(tmax/val(7)):val(8)];   #Calculate a z for every tau
 Points=tmax/val(7)      
 Zres=size(Z)
 Tres=size(t) 
 
 plot(Z,solx(:,1));     #Plot the Graph
 ylim([-val(5) val(5)]);
 xlim([0 val(8)]);
 title ('Ion Trajectory in X-Z-Axis');






Sunday, February 28, 2016

A little something on the Quadrupole

This post will cover the working principle of a quadrupole mass analyzer (or mass filter), wich will eventually be the "heart" of my DIY mass spectrometer.

Quadrupole (short Quad) is a quadratic arrangement of four linear rod-shaped electrodes, wich - under high vacuum - can filter ions for their m/z ratio, when certain voltages are applied. Ions enter the quad on one side, through the symmetry center of the arrangement (green dot in the center of the drawing), and resonant ions roughly move along the symmetry-axis, parallel to the rods (normally indicated as the z-axis). Opposite electrodes are always equally charged, whereas juxtaposed electrodes are of opposite charge (red formula in the drawing).  Furthermore, electrode (rod) voltages are a composition of a constant offset voltage U and a radio-frequency RF-voltage V.
Owing to the charge of the rods, ions entering will be either attracted or repelled by their nearest rod, resulting in oscillating flight curves through the mass analyzer. If no constant voltage is applied to the rods (U=0), all ion flight curves are stable (for a broad range of RF-voltages), meaning that all ions entering the quad will leave it on the other side, even though they might perform oscillations when flying through. This however is not a mass filter, because all ions are passed through, regardless of their m/z. But if now a constant offset voltage is also applied, suddenly not all ion-oscillations are stable anymore. Depending on their m/z, ions on unstable flight-curves will eventually hit one of the electrodes. Ideally, the quad can be configured in a way, that only one ion m/z is stable by adjusting U and V. You now have a mass filter, allowing for selectively passing through ions of defined m/z!
It turns out that an ideal Quad can achieve unlimited resolution when 2U/V equals 0,336 (green dotted lines above). In reality however, U is lowered so that a broader m/z area is passed. Note that every mass has its own stability-region on the diagram. With a quad it is therefore possible to scan for all expected m/z by lowering U and V respectively while keeping the ratio 2U/V constant.

There is a lot of practical experience for the construction of these mass filters available and it turns out that quads show their best performance when ions of 10eV energy perform about 100 oscillations when passing through. This performance is - by default - reached with quads of 15 to 25 cm length and rod diameters of 10 to 20 mm. The ideal inner radius of the quad (r0) turns out to be a function of its rod-diameter (r) with r0=r/1,1468. DC and RF voltages range between 100 and 2000 volts and RF-frequency lays between 1-4 MHz.

For further reading I suggest Mass Spectrometry: A Textbook by Jürgen H Gross. All information contained in this post is taken out of that book.

Friday, February 26, 2016

Very first thoughts

For almost two years now, I have been carrying this project idea with me, but it always seemed too sophisticated to actually approach. The idea was to home build a DIY mass spectrometer!

By the time I first came up with that idea, no Youtuber had build one and there were no plans available on Google either. Even today - two years later - I could still only find one video on a DIY system, containing only few information. Back at that time, this was rather demotivating to me, because I could not imagine that no one ever tried before and I reasoned that there must be something else preventing hobbyists from tackling mass spectrometry (perhaps the costly complexity and the limited use of a MS to a private person...). So I quickly put down all plans until recently, when I stumbled across Ben Krasnows videos on his DIY scanning electron microscope (SEM)!
Ben managed to build a functioning SEM in his garage and that was a huge inspiration to me. I thought if a SEM is possible, a working MS should be too! This gave me the motivation to start this project (and this blog). For me it will mainly act as a way to organize my thoughts and possibly to reach out to other enthusiasts. So if you are reading this and later posts and also plan on something similar or have other input for me, please contact me through email or comment below!

The aim of this very first post is to give an introduction into the topic, so if you don't know what a MS is, here is a brief summary:
With a MS you can essentially find out the mass of a given (and ionized!) sample molecule, called the analyte. The spectrometer (btw NOT spectroskope!!) does this by "sorting" sample molecules by their mass to charge ratio m/z. And when you have the m/z ratio of the analyte you can in most cases calculate the real mass of the molecule since a molecules charge is always a multiple of the electron charge e. What the MS gives you then is a mass-spectrum of your sample (m/z vs. signal intensity) and that allows for crucial statements about your sample composition. MS is now very widely used, from basic chemical research to medical applications in hospitals and even to bioanalytics like protein sequencing.
The very basic block-diagram of a MS apparatus always looks the same: You will find an ion source, where the sample ions are generated, a mass analyzer that separates ions of different m/z in a controllable way, and last an ion detector that gives out a readable signal when ions of any kind hit it. It is important to note that at least the last two steps happen under ultra high vacuum. There are different designs for all three blocks of the diagram available and not every design fits every possible application. Every design has specific advantages and disadvantages for a defined task.
So if a company or research facility plans on buying a MS, the first step is always the clear definition of the task that the MS is needed for! The apparatus is then carefully selected for that task and since these devices are so extremely expensive (rarely less than 100.000 €/$) there are beefy books available on that topic.

For me however, the problem is a bit different. I do not have a specific task for a MS, but i don't want to build a MS that is just a proof of concept either, and has no possible application. So the goal for me was to find the simplest MS possible with a real-life application. After reading through literature and thinking about it for quite a wile now, a came up with the idea of building a so called ESI-Quad, capable of analyzing biomolecules like proteins and fatty acids.

I opted for the ESI-Quad, because it is a widely used combination in bioanalytics with a lot of available literature. It also has several construction advantages for DIY. Namely that it works completely without a magnetic field, has no moving parts and an overall simple layout, and only needs a small effective ion-path-lengths under ultra high vacuum. This allows for a relatively poor vacuum in the main chamber, wich will cut on costs and makes a success more likely... (but I am still talking about ultra high vacuum of course). The compactness of the design also cuts on material costs.

In my next post, I will characterize the ESI-Quad system and hopefully come up with a specification sheet for its construction.

Thanks for reading and please feel free to share any ideas on this project with me in the comments or through email (marcotobias at gmx dot net).

Marco