Skip to main content


Programming of DIY microscopes: MicroManager vs LabVIEW

In the flourishing field of DIY light microscopy, a decision of choosing the programming language to control the microscope is critically important. Modern microscopes are becoming increasingly intelligent. They orchestrate multiple devices (lasers, cameras, shutters, pockel cells) with ever increasing temporal precision, collect data semi-automatically following user-defined scenarios, adjust focus and illumination to follow the motion (or development) of a living organism.
So, the programming language must seamlessly communicate with hardware, allow devices be easily added or removed, have rich libraries for device drivers and image processing, and allow coding of good-looking and smooth GUIs for end users. This is a long list of requirements! So, what are the  options for DIY microscope programming?

There are currently two large schools of microscope programming - Labviewers and Micromanagers. (update: Matlab for microscope control also has a strong community, comparable to labview…
Recent posts

3D modeling in a lab

About once a week I am asked by my colleagues which 3D modeling software I am using - usually when I am staring at the new part being 3D printed.

I am using Autodesk Inventor for a few reasons:
it is a professional software for engineers and has huge community around itit provides freeacademic licensethere are thousands of youtube videos with detailed tutorials by enthusiastseasy to learn at a basic level, but there is always a lot of room for growth In a lab, there are two main workflows where Inventor is necessary: 3D modeling of complex assemblies (like custom-built microscope) and 3D printing. There are many youtube tutorials for beginners, so I here only review some things that Inventor can do, without any specific instructions.  3D modeling of parts and assemblies Before building a new microscope, you can create its virtual model and check dimensions, required adapters, and whether things will fit together. Luckily, Thorlabs has 3D model of nearly all its parts available for fre…

How to connect a rotary encoder to Arduino, make your own PCB board, and be happy

After I discovered the OpenStage project for cheap DIY microscopy stage automation, I decided to add a twist to it - control the stage positions manually with a rotary encoder, in addition to already-implemented serial port (USB).

I found a nice RGB illuminated rotary encoder from Sparkfun  - it's shaft works as a button, and it is internally illuminated by built-in 3-color LEDs - a perfect device to switch speeds and manually control the stages.

Hooking it up to Arduino seemed easy, and there is a very nice Encoder library to do just that. But when I started to test it, I fell into a deep rabbit hole called 'debouncing'. In short, real-world switches are never perfect and the 'moment' of switching has many messy things happening between the two leads, creating noise in the logic of reading device (Arduino). So, the voltage readout from a real rotary encoder looks like this:

Note the high-frequency chirp in yellow line when it falls from high to low. The yellow and…

Machine shopping for a microscopy lab

Disclaimer: I believe that everyone who can hang a picture on the wall can work in a machine shop. However, if you are sloppy, forgetful, or messy, don't do it. Or at least read the manuals and learn safety instructions before you go.

If you are still reading this, you are not easily scared! Welcome to the world of DIY fun and creativity which a machine shop provides. Let's start with the most common myths.

Myth 1. Machine shop is for old-school dudes who like to fix their motorcycles - today one can buy online everything needed for science.
If you can buy everything - you follow mainstream, because your tools are old and popular enough that a company makes money making and selling them. If you hit an unbeaten path, or even make adjustments, you need to invent and make new tools. Of course, you can hire engineers - but research labs are rarely that rich.

Myth 2. Machine shop is a big and expensive enterprise, only big institutes can afford it. 
MS can be as big or small as you m…

The first smart microscope, Howard C. Berg, and bacterial chemotaxis

Chemotaxis of bacteria is a molecular mechanism by which they sense chemicals and swim through  a biased random walk toward preferred concentrations. It has been studied extensively since late 60-s and became a triumph of quantitative system biology, thanks to giants like Julius Adler, Howard C. Berg, Daniel Koshland, to name a few.

Perhaps the most instrumental in this scientific revolution was Howard Berg’s tracking microscope (Berg 1971; PDF), which could follow a freely swimming E.coli cell in 3D in real time. Yes, in 1971. It allowed precise quantification of cell swimming trajectories in spatial and temporal gradients of chemicals, which led to discovery that E.coli performs a biased random walk, with longer runs toward increasing concentrations of attractive chemicals (Berg and Brown, 1972; PDF). This work laid the foundation of quantitative approach to bacterial chemotaxis, which led to multiple breakthroughs on it’s biochemical and physical mechanisms.

Even today in 2017, bui…

Shack-Hartmann wavefront sensor: Thorlabs WFS-150 review

wavefront sensor is a brainchild of Cold War, born in late 1960-s by the need of US Air Force "to improve the images of satellites taken from earth"  -guess who's satellites caused such intense interest of Uncle Sam.
The working principle is simple and elegant - the wavefront sampled by an array of micro-lenses, and its local slope is converted into displacements of focal spots:
To make an SH sensor today, one needs an array of microlenses and a digital camera. The main difficulty is accurate calibration and the software which will convert camera images into wavefront reading.

Thorlabs sells reasonably priced SH sensors and I purchased the WFS-150-7AR for my project.
The good It is well built, comes with plate adapter and a C-mount ring adapter. The software runs smoothly and produces expected results (flat wavefront) when tested on spatially filtered and collimated HeNe laser.
The manual is very detailed, and API comes in C, C#, and LabView libraries, with…

Gaussian beams and paraxial approximation

Gaussian beams
is a beautiful phenomenon in optics. As they propagate through space they retain their Gaussian shape, and only get broader or narrower. They are symmetric along the optical axis. No matter how many lenses you use to focus and defocus your laser beam, it will remain Gaussian. And it's shape is described by a few simple formulas, which define their thinnest section (w0, 'waist'), radius of wavefront (R), and divergence angle (Theta). Some immediate applications include fiber coupling, confocal microscopy, and light-sheet microscopy.

The formulas describing Gaussian beams were derived in the 1960-s, soon after the invention of lasers, by solving the wave equation for electromagnetic waves, and were analysed exhaustively in paraxial approximation (Kogelnik and Li, 1966).

Paraxial approximation means that angle of beam divergence angle is small (theta ~ tan(theta)). However, modern microscopy pushes limits to high-NA objectives and laser beams for higher resoluti…