Setting up an Arduino based TIRF autofocus system

Hello,

I would like to extend an existing project with Arduino Uno and line sensor TSL1401 (Arduino Spectroscope With TSL1401 and Display : 4 Steps - Instructables) to be able to send Arduino output to micromanager and use it to control the position of a piezoelectric table, i.e. the project aim would be to set up an autofocus system for a TIRF microscopy setup. So far, the result of that preexisting project is a constantly refreshing string of pixel values, coming into Arduino IDE monitor.
My current abstract idea is to acquire linear sensor pixel values as an array, find the position of the maximum values (the auxillary focusing laser reflection on the sensor) and to use it to send signals to the piezotable to adjust its position. However, as far as I understood, micromanager’s Arduino adapter is suited more towards controlling external devices rather than to gather data from those. Could I use FreeSerialPort or SerialManager adapters instead? Also, how could I use the data going through any of these to control the piezotable through the micromanager and where I could find resources containing instructions for implementation of this idea?

Thanks for your help in advance.

Hi SA96,

As mentioned before, most of this has already been done with pgFocus, although it sounds like you want micromanager to act as the go between between your autofocus controller and your piezoelectric table. pgFocus handles everything in hardware because it is faster, with Micromanager used to store data, initiate calibration and to adjust settings. Micromanager could be used to do the calculations, but it isn’t needed.

pgFocus hardware is modified arduino running its own custom arduino firmware that does calculate center of mass of a reflected laser beam on the TSL1401 sensor, and outputs a voltage to a piezo controller to maintain that center of mass reflected beam in the same location on the TSL1401 sensor. It can also do it in 3D, readjusting that focus position based on incoming piezoelectric voltage command signals.

Micromanager’s pgFocus Device Adapter records that information and allows changing of settings and commands to be sent to the pgFocus hardware from Micromanager. It has its own thread, which means it can run code independently of micromanager to control or send information to another device.

Micromanager’s pgFocus Plugin takes the information from the pgFocus Device Adapter and goes further, and history, and calibration, etc. It also has its own thread, which means it can run code independently of micromanager to control or send information to another device.

There is a pgFocus application that runs independently of micromanager, which I won’t go into here, but it could also be used as a road map for what you want.

Either the pgFocus Device Adapter or the pgFocus Plugin could be extended to drive another Z Stage device, or just use a road map for you. Throw out the code you don’t need, like the D/A and A/D of pgFocus, and extend either the plugin, or the device adapter to drive a Z stage via Micromanager. It is all there.

You don’t need the pgFocus hardware, just the TSL1401 connected to the same pins as pgFocus, or just change the code to reflect where you have connected the TSL1401 to your arduino. Add the Z stage stuff, and you are done.

BTW, TSL1401 is EOL.

1 Like