[micro-manager-general] Running Hamamatsu Camera on External Trigger Mode

0 views
Skip to first unread message

ranibar

unread,
Feb 24, 2020, 3:05:03 PM2/24/20
to micro-mana...@lists.sourceforge.net
Hi

I am using the microm-manager python wrapper to control the Hamamatsu ORCA
4.
I am able to do everything through code. however, I might be missing
something:
I set the camera properties to external trigger mode yet I get no images
although the trigger is active and the camera seems to be set right.
What I need to achieve eventually, is whenever a trigger comes in the camera
will take images.
Can anyone advise on this?

Thank you,
Rani



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
micro-mana...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/micro-manager-general

nanthony

unread,
Feb 24, 2020, 4:22:38 PM2/24/20
to micro-mana...@lists.sourceforge.net
Hi Ranibar,

Configuring the Hamamatsu camera can sometimes be complicated. It would be
helpful to see a simple code example where you attempt to get externally
triggered images.

--Nick

ranibar

unread,
Feb 25, 2020, 12:08:05 PM2/25/20
to micro-mana...@lists.sourceforge.net
Hi Nick

Thank you for your reply.

here is the code that I am using to control the camera and its
configuration:
import sys
import numpy as np
sys.path.append('C:\\Program Files\\Micro-Manager-2.0beta')
import MMCorePy

mmc = MMCorePy.CMMCore()
mmc.loadDevice('Camera', 'HamamatsuHam','HamamatsuHam_DCAM')
mmc.initializeAllDevices()
mmc.setProperty('Camera','TRIGGER ACTIVE','SYNCREADOUT')

The camera is fed with a square wave 20 ms which are 5 ms apart, the trigger
is fed through the EXT TRIG (1) at the back of the camera.

I am stuck at this point I don't know how to set up and which command to use
to start acquisition following the trigger.

When I use StartContinuousSequenceAcquisition I get images regardless of the
trigger. and when I use startSequenceAcquisition or snapImage I get
"Circular buffer is empty"

Thank you,
Rani

Nicholas Michael Anthony

unread,
Feb 25, 2020, 12:58:25 PM2/25/20
to Micro-Manager General, ranibar
Hi Rani,

I would second Nico's advice. There are many different properties related to triggering so you may need to set a few of them to get the behavior you expect. I'm not sure but I think the "TRIGGER ACTIVE" property that you are setting is actually configuring the camera to send TTL pulses of its own at the end of each exposure.

Once the triggering is configured you should be able to use `Snap`, `startSequenceAcquisition`, or `startContinuousAcquisition`. One confusing thing that I will warn you about is that Hamamatsu doesn't properly support the `intervalMs` argument for sequence acquisition so you need to set the `intervalMs` argument to 0.

--Nick

-----Original Message-----
From: Stuurman, Nico <Nico.S...@ucsf.edu>
Sent: Tuesday, February 25, 2020 11:20 AM
To: Micro-Manager General <micro-mana...@lists.sourceforge.net>; ranibar <rani.b...@weizmann.ac.il>
Subject: Re: [micro-manager-general] Running Hamamatsu Camera on External Trigger Mode

Hi Rani,
> here is the code that I am using to control the camera and its
> configuration:
> import sys
> import numpy as np
> sys.path.append('C:\\Program Files\\Micro-Manager-2.0beta') import
> MMCorePy
>
> mmc = MMCorePy.CMMCore()
> mmc.loadDevice('Camera', 'HamamatsuHam','HamamatsuHam_DCAM')
> mmc.initializeAllDevices()
> mmc.setProperty('Camera','TRIGGER ACTIVE','SYNCREADOUT')
>
> The camera is fed with a square wave 20 ms which are 5 ms apart, the
> trigger is fed through the EXT TRIG (1) at the back of the camera.

You will need to set a property called something like 'TRIGGER_SOURCE'
to something like 'TRIGGER_SOURCE_EXTERNAL'. Hopefully the Property Browser will show such a property and the values you can set it to.

Also, once you get this working, would be great if you could write up how you accomplished it.

Best,

Nico



_______________________________________________
micro-manager-general mailing list
micro-mana...@lists.sourceforge.net
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_micro-2Dmanager-2Dgeneral&d=DwICAg&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=VOzx3RPoFiAnEjWZNVKllozJBWVHbhKhbit0V1WrFG2kkO7riI9lwQ0usSmhFkzq&m=K1ACIJIZhb_vaDSW0MxAUsTT9HReXftoPoiDEVSqBAs&s=mFvC_apdYiYAFJbcsGC7B3a6b4B-OgYB3LQwk8ekh54&e=

ranibar

unread,
Feb 26, 2020, 12:26:29 PM2/26/20
to micro-mana...@lists.sourceforge.net
Hi all,

Thank you for your suggestions.

I am trying to find where the problem comes from and this is what I learned
thus far:

the command the list almost all properties available is
mmc.getDevicePropertyNames('Camera') which can be found in the MMCorePy.py.
also helpful are the commands mmc.getProperty, and
mmc.getAllowedPropertyValues
I tried changing various triggering properties
'TRIGGER ACTIVE' from 'EDGE' to 'SYNCREADOUT' or 'LEVEL'.
'TRIGGER EXPOSURE'
'ScanMode'

When I switch the TRIGGER SOURCE to EXTERNAL, the snapImage() is stuck until
timout (probably 10s of seconds and I get the error : Error in device
"Camera": Unknown error in the device (1). While when I switch the TRIGGER
to INTERNAL, the snapImage() works perfectly. Under EXTERNAL mode, when I
run the snapImage() command I see the status light of the camera turning
Orange (indicating data transfer is underway) and the status light keeps
orange even when the device returns an error, only when I switch trigger
source back to internal, the status light returns to green. However, note
that when the status light is 'stuck' on orange, the query deviceBusy
returns False.
so it seems to me that the snapImage function is waiting for the trigger and
it is not getting it?! So I tried to change the trigger timing, width,
voltage, etc. but nothing.
Might be there be any properties set that are conflicting and makes this
behavior? or is the camera somehow not getting the trigger signal right? or
is there another command that tells the camera to 'start' getting the
trigger?


Thank you,
I will keep trying and update and awaiting your advise.

Nicholas Michael Anthony

unread,
Feb 26, 2020, 12:41:37 PM2/26/20
to Micro-Manager General
Hi Rani,

The freezing behavior you describe when using external triggering sounds consistent with the camera not receiving the trigger pulse, but it's hard to know with certainty. I would double check your wiring.

--Nick

-----Original Message-----
From: ranibar <rani.b...@weizmann.ac.il>
Sent: Wednesday, February 26, 2020 3:29 AM
To: micro-mana...@lists.sourceforge.net
Subject: Re: [micro-manager-general] Running Hamamatsu Camera on External Trigger Mode

Hi all,

Thank you for your suggestions.

I am trying to find where the problem comes from and this is what I learned thus far:

the command the list almost all properties available is
mmc.getDevicePropertyNames('Camera') which can be found in the MMCorePy.py.
also helpful are the commands mmc.getProperty, and mmc.getAllowedPropertyValues I tried changing various triggering properties 'TRIGGER ACTIVE' from 'EDGE' to 'SYNCREADOUT' or 'LEVEL'.
'TRIGGER EXPOSURE'
'ScanMode'

When I switch the TRIGGER SOURCE to EXTERNAL, the snapImage() is stuck until timout (probably 10s of seconds and I get the error : Error in device
"Camera": Unknown error in the device (1). While when I switch the TRIGGER to INTERNAL, the snapImage() works perfectly. Under EXTERNAL mode, when I run the snapImage() command I see the status light of the camera turning Orange (indicating data transfer is underway) and the status light keeps orange even when the device returns an error, only when I switch trigger source back to internal, the status light returns to green. However, note that when the status light is 'stuck' on orange, the query deviceBusy returns False.
so it seems to me that the snapImage function is waiting for the trigger and it is not getting it?! So I tried to change the trigger timing, width, voltage, etc. but nothing.
Might be there be any properties set that are conflicting and makes this behavior? or is the camera somehow not getting the trigger signal right? or is there another command that tells the camera to 'start' getting the trigger?


Thank you,
I will keep trying and update and awaiting your advise.

Rani




--
Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__micro-2Dmanager.3463995.n2.nabble.com_&d=DwICAg&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=VOzx3RPoFiAnEjWZNVKllozJBWVHbhKhbit0V1WrFG2kkO7riI9lwQ0usSmhFkzq&m=UovoitJ7kTkdDcnVS-IEsklzCzdUMD4W7IwK8bTxLhQ&s=4xtWa86H42jIO29gRmchQ3eL5vNe2xHzbcQMceJeZHk&e=


_______________________________________________
micro-manager-general mailing list
micro-mana...@lists.sourceforge.net
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_micro-2Dmanager-2Dgeneral&d=DwICAg&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=VOzx3RPoFiAnEjWZNVKllozJBWVHbhKhbit0V1WrFG2kkO7riI9lwQ0usSmhFkzq&m=UovoitJ7kTkdDcnVS-IEsklzCzdUMD4W7IwK8bTxLhQ&s=6XukRn-Vmq8ax3lLB6-TnoAWH8PvIGiAlALm9a4V-H4&e=

ranibar

unread,
Feb 27, 2020, 5:01:30 AM2/27/20
to micro-mana...@lists.sourceforge.net
Hi,

Thank you Almada and Nick for your replies.

I am still unable to make this work. I changed the rate and duty cycle of
the trigger signal (analog 3.3V square wave). I am working with a usb
connection of the camera so the rate is about 23Hz, and I am for sure giving
a trigger that is less than that.

I tried your suggestions checked cables and configurations.

Bu the way, also when using the micromanager software the same behavior. I
change the configurations to external trigger and when snapping the software
freezes.

Was anybody able to make this work with an ORCA flash 4.0?

moreover, where can I find what is the mapping between ScanMode property
values being 1,2, or 3 and what these actually mean. the ScanMode is
meanwhile at 2. and how do I change the mode of the camera between fast and
slow ? is this the ScanMode proeprty?

Thank you,
Rani



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


ranibar

unread,
Mar 3, 2020, 2:58:34 AM3/3/20
to micro-mana...@lists.sourceforge.net
Hi Everybody,

I am still stuck with this.

It might be also indicative (maybe) of the nature of the problem is that I
am also unable to get a trigger from the camera. I hooked up the timing 1 to
an oscilloscope, opened the micromanager 2, started acquisition/snapped, but
I see nothing on the oscilloscope! tried changing configs. nothing.
Cable I guess is ok, I tried two already.

maybe there is some command to start triggering (whether from the camera or
into the camera) that is not fired? or maybe its a driver issue?

Best,

Nicholas Michael Anthony

unread,
Mar 3, 2020, 11:17:19 AM3/3/20
to Micro-Manager General
Hi Rani,

It might be helpful to attach a screenshot or text readout of your device properties in micromanager. There are a few properties that affect the triggering behavior.

--Nick

> On Mar 3, 2020, at 1:58 AM, ranibar <rani.b...@weizmann.ac.il> wrote:
>
> Hi Everybody,
>
> I am still stuck with this.
>
> It might be also indicative (maybe) of the nature of the problem is that I
> am also unable to get a trigger from the camera. I hooked up the timing 1 to
> an oscilloscope, opened the micromanager 2, started acquisition/snapped, but
> I see nothing on the oscilloscope! tried changing configs. nothing.
> Cable I guess is ok, I tried two already.
>
> maybe there is some command to start triggering (whether from the camera or
> into the camera) that is not fired? or maybe its a driver issue?
>
> Best,
> Rani
>
>
>
> --
> Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__micro-2Dmanager.3463995.n2.nabble.com_&d=DwICAg&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=VOzx3RPoFiAnEjWZNVKllozJBWVHbhKhbit0V1WrFG2kkO7riI9lwQ0usSmhFkzq&m=i6wlI2mBK9Wq1NXO2MxKisQF7M6IDGIPk-yvG0AAZdc&s=YVIiVGQoMbTSCGPvY1e0vwdbh9Aftf66a-wVDnUcrnc&e=
>
>
> _______________________________________________
> micro-manager-general mailing list
> micro-mana...@lists.sourceforge.net
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_micro-2Dmanager-2Dgeneral&d=DwICAg&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=VOzx3RPoFiAnEjWZNVKllozJBWVHbhKhbit0V1WrFG2kkO7riI9lwQ0usSmhFkzq&m=i6wlI2mBK9Wq1NXO2MxKisQF7M6IDGIPk-yvG0AAZdc&s=WyjEbKBGeccG7GPc-1AC0Be14P1cz8rbvgUzCn44bfw&e=

ranibar

unread,
Mar 3, 2020, 12:07:26 PM3/3/20
to micro-mana...@lists.sourceforge.net
Hi Nick,

here is a screenshot:
I tried all sort of things but maybe the combination of settings?


<http://micro-manager.3463995.n2.nabble.com/file/t397530/config.jpg>

Nicholas Michael Anthony

unread,
Mar 3, 2020, 1:04:29 PM3/3/20
to Micro-Manager General
Hi Rani,

In order for "OUTPUT_TRIGGER_SOURCE" to have any effect you'll need to set "OUTPUT_TRIGGER_KIND" to "Programmable". Having it set as "Low" will mean that it is always at 0 volts.

--Nick

-----Original Message-----
From: ranibar <rani.b...@weizmann.ac.il>
Sent: Tuesday, March 3, 2020 11:06 AM
To: micro-mana...@lists.sourceforge.net
Subject: Re: [micro-manager-general] Running Hamamatsu Camera on External Trigger Mode

Hi Nick,

here is a screenshot:
I tried all sort of things but maybe the combination of settings?


<https://urldefense.proofpoint.com/v2/url?u=http-3A__micro-2Dmanager.3463995.n2.nabble.com_file_t397530_config.jpg&d=DwICAg&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=VOzx3RPoFiAnEjWZNVKllozJBWVHbhKhbit0V1WrFG2kkO7riI9lwQ0usSmhFkzq&m=7VPPeE_uS1ASnoaEpUVx_-nSQNaa_HrczyCMCTPiPow&s=CvgD9QsGGOz9fOEovPqfJCp0N3xi6be7RcTe8bCe25M&e= >



--
Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__micro-2Dmanager.3463995.n2.nabble.com_&d=DwICAg&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=VOzx3RPoFiAnEjWZNVKllozJBWVHbhKhbit0V1WrFG2kkO7riI9lwQ0usSmhFkzq&m=7VPPeE_uS1ASnoaEpUVx_-nSQNaa_HrczyCMCTPiPow&s=T_RZbxt59BWB8uwmwZr3mABarCfZarCw2ynOWs52WbE&e=


_______________________________________________
micro-manager-general mailing list
micro-mana...@lists.sourceforge.net
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_micro-2Dmanager-2Dgeneral&d=DwICAg&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=VOzx3RPoFiAnEjWZNVKllozJBWVHbhKhbit0V1WrFG2kkO7riI9lwQ0usSmhFkzq&m=7VPPeE_uS1ASnoaEpUVx_-nSQNaa_HrczyCMCTPiPow&s=1E3pUNO3aD0PhKz2M89NS8hy3CAVJW90GMnDqqMq9OA&e=

ranibar

unread,
Mar 4, 2020, 2:07:31 AM3/4/20
to micro-mana...@lists.sourceforge.net
Hi Nick,

Thank you very much for this one. So now we established that the trigger
from the camera works. however I am still unable to get the camera work from
an external trigger! anything you see there that is not right?
or maybe the trigger needs to be in a very specific shape/duty
cycle/frequency?

Best,
Rani
Reply all
Reply to author
Forward
0 new messages