Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify System Control - Dissemination Variant #999

Open
AdvancedImagingUTSW opened this issue Sep 25, 2024 · 4 comments
Open

Simplify System Control - Dissemination Variant #999

AdvancedImagingUTSW opened this issue Sep 25, 2024 · 4 comments
Assignees

Comments

@AdvancedImagingUTSW
Copy link
Collaborator

AdvancedImagingUTSW commented Sep 25, 2024

Overview
As part of the UTD Capstone project, our goal is to simplify the optoelectronics of the microscope. Currently, we often have stage controllers, filter wheel controllers, an NI DAQ card, piezo controllers, etc. Each one of these things has to be independently wired up. This serves as an impediment for non-experts, slows adoption, and increases the likelihood that mistakes will require significant debugging.

Number of Devices

  • Minimum number of lasers to support is 4, which I operate in a mixed modulation mode – 4 digital + 4 analog outputs.
  • Camera external trigger – 1 digital output.
  • Galvos – 2 analog outputs
  • Remote focusing voice coil – 1 analog output
  • If the lasers blank poorly, 2 digital outputs for shutters would be advantageous.

Grand Total:

  • 7 digital outputs, 0 to 5V.
  • 7 analog outputs, -10 to 10V.
  • 2 Filter Wheels, each with sub-70 ms switching times for adjacent filter wheel positions.
  • Stages for X, Y, Z, Theta, and F all with sub-100 micron repeatability.

Requirements
The microscope requires synchronous delivery of a number of analog and digital waveforms, serial commands, DLL calls, etc. Currently we operate at 100 kHz sampling. Our sampling rate is overkill, and I am confident we could reduce it 10x. Reducing it 50x to 4 kHz could be possible.

Regarding the analog/digital control, we require:

  • Waveform type: triangle/sawtooth/sine/DC. Should enable control of amplitude, offset, phase.
  • Waveform duration: Camera exposure + readout time + any user added delays.

I’m not totally sure I need 100% arbitrary waveforms at this point. The remote focusing waveform is our most sensitive parameter. It is a sawtooth with a dedicated duty cycle, a settling duration to allow to recover from overshooting the target, and a phase for synchronizing with the rolling shutter, and occasionally a smoothing parameter. If we drive it less aggressively, we could probably get rid of the settling and smoothing.

A standard operational workflow is to:

  • Queue waveforms on galvos 1…N
  • Queue waveforms on remote focusing device.
  • Queue dc waveform for analog output of laser. Can be a vector of voltages, or a single voltage value.
  • Queue digital output of laser.
  • Queue external trigger of camera. Camera is edge triggered.
  • Software triggers all queued waveforms, causing them to roll off the device synchronously.

In a per-stack acquisition mode, where an entire channel is acquired for CH0, then CH1…, we would want to repeat this output for every image slice. In a per-z acquisition mode, where image slices are acquired in a channel interleaved fashion (CH0, CH1, step in z…), I would want to adjust the waveforms according to the user-specified settings (amplitude, offset, etc.) on a per-slice basis.

I’m not sure what the rate-limiting steps of such a process would be. For NI cards, writing the waveforms to the card are our slowest step. Thus, the per-z acquisition mode is frustratingly slow since we write data to tasks for every image. I have ideas on how to fix this, but I will see wha you come up with.

Your job is to figure out how we can consolidate it, while ensuring that setting it up remains easy and obvious. One apparent solution is to use ASI's Tiger Controller, but other options are welcome too. Should you choose to proceed with this manufacturer/system, some information is below.


Tiger Controller
The Tiger controller has 16 certain number of physical slots -- some cards occupy 2 slots -- and the "easy" addresses 0-9. If you need more physical slots then you can daisy-chain controllers. If you need more than 10 cards then there is an "extended address" space that is slightly more cumbersome to access but very doable, supported in Micro-Manager, etc. One limitation is that each axis gets a letter and we only have A-Z (each motor is an axis, the PLC is one axis, etc.)

ASI Cards


TGDAC4 has 4 analog outputs. It does support some form or arbitrary waveforms with 250 points (and maybe extendable slightly more). It also supports repeating patterns like sawtooth/sine. It is 16 bit and has a 4kHz update rate.

The internal waveform generation is supposed to be quite accurate. For Sine, Ramp and Triangle waves, the pattern is calculated on the fly based on the frequency requested, therefore the resolution is only limited by the requested waveform frequency and the maximum analog resolution of 16bit. At frequencies at or below 16.384Hz (65536points / 4000points/sec), the data tables will have 65536 data points, though for faster cycle-rates, there will be less data points. Here are some helpful links for this function, describing the various command usages and capabilities:


TGPLC has 8 digital I/O ports. It does not currently support arbitrary waveforms but there is the possibility that it could be implemented. Due to hardware it would probably be able to get something like 1k or maybe up to 4k arbitrary points but not nearly what the NIDAQ cards achieve. 4kHz max update rate. For standard operation, this device pretty much supports ON/OFF gating, which can be used to execute pretty sophisticated triggering routines. Some examples of this can be found as a plugin to MicroManager (see the latest build). The PLC can also be setup using pymmcore_plus based off scripts at the bottom of the docs page.

Documentation here.


TGDAC. Used to control a piezo for fast z-scanning.


TGFW. Used to control filter wheels.


TGDCM2. Used to control two stage axes.


TGPOW. Could be used to power the galvo.
ASI uses two TE Connectivity 4-pin "M8" series female connectors on the faceplate of their TGPOW power card.
The exact connectors are the T4033014041-000.

ASI typically uses the right-angle male connectors T4013019041-000 for their cables.

Both 4-pin connectors are normally wired to each have +15v, two grounds and -15v, so that two galvo amplifiers can be powered from one TGPOW card. They could provide something similar with perhaps +-12v or +12v and +5v.

@AdvancedImagingUTSW
Copy link
Collaborator Author

AdvancedImagingUTSW commented Sep 25, 2024

Here is an example of a per channel z-stack acquisition.

image

Shadow Reduction Galvo
Resonant Galvo - Provide a DC amplitude. 0-5 Volts. Increasingly, can't buy these because there was one company the world that made them.

Normal Galvo - Use these to replace the resonant galvo. Sine wave, 200 Hz, amplitude 0-5 V.

Performed with the DAQ typically...

Voice coil
Sawtooth, -5 to 5 v amplitude, typically. Offset, phase.

Performed with the DAQ typically...

Laser
Digital - on/off modulation of the laser.

Analog - scales the intensity. 0 V is 0% power, 2.5V is 50% power...
Performed with the DAQ typically...

Camera
Edge triggered, grayscale camera. Performed with the DAQ typically...
Send out a 5V signal every X milliseconds. Camera requires an exposure time, a readout time, and then we have some additional delays that are added to the beginning and end of the exposure which are controlled in the software. The readout time is automatically calculated by the camera class. It depends upon the model and the shape of the image sensor. CMOS cameras have one free dimension where things are read out in parallel, and another where they are not (read out serially).


Easiest first targets would be the external trigger for the camera and the digital laser. Both are simply 5 V outputs. The camera is a 1 millisecond TTL because it is an edge trigger. The digital laser control is 5 V TTL for the duration of the camera exposure, readout time, etc. First easiest target, send out synchronous signals to the camera and digital output for the laser. How do control the logic card with synchronous outputs?

@jondaniels
Copy link

I doubt ASI will be faster than NI at loading waveforms unless NI's design is really crappy, but maybe different acquisitions could be preloaded and played through later so that you batch the loading process. The Tiger's baud rate sets at upper limit of ~11k bytes per second but I doubt that's achievable in practice because that the controller needs to acknowledge receipt of messages and there is other overhead. . I think a few thousand bytes per second transfer is realistic. Let's optimistically guess that Tiger can accommodate transferring 4000 bytes per second and run some calculations based on that: if you were loading 250 points of analog in 4 channels that would take 0.5 second. Or 1000 points of 8-bit digital output that would be 0.25 second.

ASI's analog outputs have an adjustable output filter that will help smoothing. (There are 2 frequencies that can be set, each applies to one pair of outputs which I don't think is very clear in our documentation.)

@AdvancedImagingUTSW, How many points do you think it would take to re-create the most complicated analog waveforms required? Related, what is that waveform's period? (hopefully 4kHz output rate is enough).

@AdvancedImagingUTSW
Copy link
Collaborator Author

Hello @jondaniels,

Thanks for the response. I think we could greatly accelerate writing waveforms to the NI cards if we were to decrease the size of the waveform. I'll benchmark it to see how fast we can write to NI tasks for different waveform sizes... I would be that a 250 point waveform is going to be pretty fast...

The very fastest waveform that we have to drive is the shadow reduction galvo. Ideally, this would be a resonant galvo, and we could just send it a constant voltage offset, but these galvos are harder to come by now... For our highest resolution ASLM, with linear galvos, this would ideally be close to ~200 Hz but with a small amplitude sine wave.

@jondaniels
Copy link

For the resonant galvo you may not need to write a waveform at all. The analog card supports outputing a sine wave by specifying the period, amplitude, and offset (also square, triangle, and sawtooth patterns with the same controls) There is a way to trigger this output with an input TTL signal if free-running doesn't work. This should work fine at 200Hz (with 4kHz update that gives 20 points per cycle). See https://asiimaging.com/docs/singleaxis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants