basler / pypylon

The official python wrapper for the pylon Camera Software Suite
http://www.baslerweb.com
BSD 3-Clause "New" or "Revised" License
577 stars 208 forks source link

Hardware triggering #548

Open ghost opened 2 years ago

ghost commented 2 years ago

Hi All

I am trying to hardware trigger a Basler camera. I have located the GIPO lines and the ground on the camera . I seem to have setup everything correctly but still can't get to start image acquisition when I send the signal from an Arduino. I have attached screen shots of Pylon set up. I have been working on it for almost two months now.

Aquisition control1 Aquisation control 2 wiring color code wiring code
thiesmoeller commented 2 years ago

Oh.. two months of trying.

Hope this comment in the issues helps ( also check discussion ) https://github.com/basler/pypylon/issues/470#issuecomment-1178811364

And also my other sample code here: https://github.com/basler/pypylon-samples/blob/main/notebooks/USB_hardware_trigger_and_chunks.ipynb

And the hw trigger will always only trigger a frame start. You have to start the acquisition before ( StartGrabbing )

ghost commented 2 years ago

Hi

Thank you so much for the quick response, I am using an Arduino uno as a hardware trigger source and would like to send the signal using Matlab. My hardware setup seems correct when I compared it to the discussion on the link you mentioned. I have a follow-up question so in addition to setting up all the instructions in the pylon software I have to use the code that you mention in your email so that Arduino can send a signal to the camera? I am trying to sync three devices and the camera is one of them. Thank you so much! Sajida


From: Thies Möller @.> Sent: Wednesday, November 9, 2022 4:53 PM To: basler/pypylon @.> Cc: Khan, Sajida @.>; Author @.> Subject: Re: [basler/pypylon] Hardware triggering (Issue #548)

Oh.. two months of trying.

Hope this comment in the issues helps ( also check discussion )

470 (comment)https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbasler%2Fpypylon%2Fissues%2F470%23issuecomment-1178811364&data=05%7C01%7Csak92%40yale.edu%7Cc5e05bb3bcc7492ef15d08dac29ccde1%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C638036275976486243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sZAKRC0375MKuLMvAUebTGFOd%2FQnxBHL5x%2BasidFfTI%3D&reserved=0

And also my other sample code here: https://github.com/basler/pypylon-samples/blob/main/notebooks/USB_hardware_trigger_and_chunks.ipynbhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbasler%2Fpypylon-samples%2Fblob%2Fmain%2Fnotebooks%2FUSB_hardware_trigger_and_chunks.ipynb&data=05%7C01%7Csak92%40yale.edu%7Cc5e05bb3bcc7492ef15d08dac29ccde1%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C638036275976486243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=E0zdkkp9lkjdfyMoaHZYrcmi8rKv%2BcCjIthnoTn8Bus%3D&reserved=0

And the hw trigger will always only trigger a frame start. You have to start the acquisition before ( StartGrabbing )

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbasler%2Fpypylon%2Fissues%2F548%23issuecomment-1309424711&data=05%7C01%7Csak92%40yale.edu%7Cc5e05bb3bcc7492ef15d08dac29ccde1%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C638036275976486243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=U9o264gH2G%2BLzUeqkj%2BVQ4wuVP7jbZGLVzukImm3Rrk%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA32WAYGOPKBLQMUQ5JKEFF3WHQMMVANCNFSM6AAAAAAR3S5VSM&data=05%7C01%7Csak92%40yale.edu%7Cc5e05bb3bcc7492ef15d08dac29ccde1%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C638036275976486243%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=c3kZG01ZzF8PkUBA7iMpsR0S1ZhE%2B3ksLAvSTNdfjFI%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

thiesmoeller commented 2 years ago

What to do on Arduino is not our domain... But there are plenty of docs at the math works : https://www.mathworks.com/help/supportpkg/arduinoio/ref/arduino.html

All the code I mentioned is to configure a Basler camera to be triggered by hardware.

You have to generate digital pulses on your Arduino and configure the camera to properly react on signal changes detected on one of its GPIO lines

ghost commented 2 years ago

Hi

I have already generated the digital signals and confirmed with an oscilloscope, in addition to a two-photon microscope. The only problem is the camera, I just can't trigger it. Best, Sajida


From: Thies Möller @.> Sent: Friday, November 11, 2022 2:01 AM To: basler/pypylon @.> Cc: Khan, Sajida @.>; Author @.> Subject: Re: [basler/pypylon] Hardware triggering (Issue #548)

What to do on Arduino is not our domain... But there are plenty of docs at the math works : https://www.mathworks.com/help/supportpkg/arduinoio/ref/arduino.htmlhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mathworks.com%2Fhelp%2Fsupportpkg%2Farduinoio%2Fref%2Farduino.html&data=05%7C01%7Csak92%40yale.edu%7C394c27ac69de480611dd08dac3b281f6%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C638037468720501927%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1%2B8XkuzzPFS25%2FlF3QLvQPmVCOZj8fn2qnwDYSsnQEA%3D&reserved=0

All the code I mentioned is to configure a Basler camera to be triggered by hardware.

You have to generate digital pulses on your Arduino and configure the camera to properly react on signal changes detected on one of its GPIO lines

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbasler%2Fpypylon%2Fissues%2F548%23issuecomment-1311303071&data=05%7C01%7Csak92%40yale.edu%7C394c27ac69de480611dd08dac3b281f6%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C638037468720658162%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pfQoNOOGgoEIqqM2w9egdDpl2MmLj%2BVTtZJ68eDuEdo%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA32WAYESSP54SESND7RKWBLWHXVLHANCNFSM6AAAAAAR3S5VSM&data=05%7C01%7Csak92%40yale.edu%7C394c27ac69de480611dd08dac3b281f6%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C638037468720658162%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=BSPsluNA7xyBqZaN1y%2Bx%2BgmGZAWKd%2BEnteiHkA8Z9NM%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

thiesmoeller commented 1 year ago

Have you applied https://github.com/basler/pypylon-samples/blob/main/notebooks/USB_hardware_trigger_and_chunks.ipynb to your setup.

This is like a Logic-Analyzer to show signals on the input of the camera and "debug" the trigger system

chiyu1203 commented 1 year ago

470 (comment)

Hi Sajida, Have you managed to trigger the camera with Arduino? I also want to trigger a basler camera with Arduino UNO. Therefore I would appreciate if you can share with me your experience. Best Chi-Yu

rambo commented 1 year ago

The opto-isolated trigger input needs about 20mA of current so if triggering multiple cameras from Arduino (or similar) you should have a buffer (I usually use 74hc04 with inputs and outputs connected in parallel). MCUs with 3.3V IO can fail to trigger even one camera.

Or alternative (especially if using something else than arduino with "open collector" style opto-isolated outputs) like so https://www.digikey.fi/schemeit/project/arduino-open-collector-style-drive-540e839d77044ba6b9c2c58871b6352c

In this case you will want to invert the line in camera config (or drive the arduino pin LOW for trigger and HIGH when idle).