Grasshopper 3 USB3 Single Frame External Trigger
AnsweredHi,
I have an Arduino setup to generate a PWM function to trigger the camera frames at a given PWM frequency. My setup works perfectly fine with the Basler camera, however, I cannot get it working with the Grasshopper 3 USB3 camera.
I want to trigger each frame from the Arduino in a continuous fashion, not free running. Based on the tutorial here I have the following connections where Primary camera is replaced with Arduino's digital output and GND pins:
And my SpinView configuration looks like this:
However, the camera only captures one frame and stops. It doesn't acquire other frames as if it's not being triggered any more.
If I change the Acquisition Mode to "Continuous". The camera starts with the initial hardware trigger and runs in a free running mode without waiting for other triggers.
How can setup the camera so that for each hardware trigger I get a frame?
I also tried with PySpin but the result is the same:
nodemap=self.camera.GetNodeMap()
trigger_mode=PySpin.CEnumerationPtr(nodemap.GetNode("TriggerMode"))
trigger_mode.SetIntValue(trigger_mode.GetEntryByName("On").GetValue())
trigger_source=PySpin.CEnumerationPtr(nodemap.GetNode("TriggerSource"))
trigger_source.SetIntValue(trigger_source.GetEntryByName("Line3").GetValue())
trigger_overlap=PySpin.CEnumerationPtr(nodemap.GetNode("TriggerOverlap"))
trigger_overlap.SetIntValue(trigger_overlap.GetEntryByName("ReadOut").GetValue())
acquisition_mode=PySpin.CEnumerationPtr(nodemap.GetNode("AcquisitionMode"))
acquisition_mode.SetIntValue(acquisition_mode.GetEntryByName("SingleFrame").GetValue())
trigger_activation=PySpin.CEnumerationPtr(nodemap.GetNode("TriggerActivation"))
trigger_activation.SetIntValue(trigger_activation.GetEntryByName("RisingEdge").GetValue())
-
Hello Emre,
You should set AcquisitionMode to Continuous. Otherwise you have to start the camera for every frame.
If the camera starts with the first trigger pulse and then keeps running, it sounds like you enabled TriggerMode for TriggerSelector AcquisitionStart. Could you please make sure you used TriggerSelector FrameStart for that test?Best regards,
Manuel
0 -
Got it, thank you so much. I got it working on SpinView with the following settings:
Now, I want to do it in PySpin. I am trying the following but the camera doesn't wait for the hardware trigger for some reason. Do you know what might be going wrong here?
```nodemap = self.camera.GetNodeMap()
# set trigger selectortrigger_selector=PySpin.CEnumerationPtr(nodemap.GetNode("TriggerSelector"))trigger_selector.SetIntValue(trigger_selector.GetEntryByName("FrameStart").GetValue())
# Set trigger mode to Ontrigger_mode=PySpin.CEnumerationPtr(nodemap.GetNode("TriggerMode"))trigger_mode.SetIntValue(trigger_mode.GetEntryByName("On").GetValue())
trigger_source=PySpin.CEnumerationPtr(nodemap.GetNode("TriggerSource"))trigger_source.SetIntValue(trigger_source.GetEntryByName("Line3").GetValue())
trigger_activation=PySpin.CEnumerationPtr(nodemap.GetNode("TriggerActivation"))trigger_activation.SetIntValue(trigger_activation.GetEntryByName("RisingEdge").GetValue())
# Set trigger overlap to ReadOut (optional)trigger_overlap=PySpin.CEnumerationPtr(nodemap.GetNode("TriggerOverlap"))trigger_overlap.SetIntValue(trigger_overlap.GetEntryByName("ReadOut").GetValue())
# Ensure frame rate control is disabledframe_rate_enable=PySpin.CBooleanPtr(nodemap.GetNode("AcquisitionFrameRateEnable"))ifPySpin.IsAvailable(frame_rate_enable) andPySpin.IsWritable(frame_rate_enable):frame_rate_enable.SetValue(False)pg.set_value(nodemap, 'ExposureMode', self.cam['options']['ExposureMode'])pg.set_value(nodemap, 'ExposureAuto', self.cam['options']['ExposureAuto'])pg.set_value(nodemap, 'ExposureTime', self.cam['options']['ExposureTime'])acquisition_mode=PySpin.CEnumerationPtr(nodemap.GetNode("AcquisitionMode"))acquisition_mode.SetIntValue(acquisition_mode.GetEntryByName("Continuous").GetValue())
# set trigger selectoracq_status_selector=PySpin.CEnumerationPtr(nodemap.GetNode("AcquisitionStatusSelector"))acq_status_selector.SetIntValue(acq_status_selector.GetEntryByName("FrameTriggerWait").GetValue())```Thank you!Best,Emre0 -
Do you mean the camera starts to capture images when you call BeginAcquisition before it has been triggered? I can not spot anything obvious. Have you tried running your code to configure the camera and then starting the camera in SpinView? Do you see any missing setting there?
Are you sure there is no trigger signal? What if you run your code with the GPIO cable disconnected?
Best regards,
Manuel
0 -
Hi Manuel,
I want to trigger each frame with the pwm. The camera starts capturing with the hardware trigger, and if I disconnect the trigger cable, it doesn't start as expected. However, after the initial trigger, the camera acquires frames in a free running mode with the highest fps possible instead of waiting pwm for each frame. For instance I'd expect 600 frames at 60 fps to be acquired in 10 sec. However, with my current code, it finishes in 4.22 sec.
I am sure that my hardware setup is correct because it works as expected on SpinView. If I set my pwm to be 60 fps, the camera acquires at 60 hz, and if I change it to 120, it acquires at 120 hz.
After running the configuration code and opening the SpinView, the camera works as expected with a given fps.
The complete code I use to configure the camera can be found here. And in the main script, I first create the FLIR() device object, and start acquisition via device.get_n_frames() method.
Thank you for your help!
Best,
Emre
0 -
Hi Emre, in your code you don't seem to call configure_trigger, which is where the code resided that you posted, but some other function. Is that a mistake?
Best regards,
Manuel
0 -
Hi Manuel,
Since I couldn't make that function work properly, I tried a different version of it (configure_camera_for_trigger()) to configure, but no luck. The camera still disregards the hardware trigger and runs with an automated frame rate. Thank you for your help!
Best,
Emre
0 -
I was able to resolve my issue by starting the pwm after the camera is configured. For some reason if I start my pwm for the hardware trigger before configuring the camera, it falls into auto frame rate.
0
Please sign in to leave a comment.
Comments
7 comments