LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cabling and synchronization of camera and measurement with NI device

Hello,

 

in our project we do intracellular recordings, controlled with the USB-6363-NI device. We want to synchronise these recordings with camera images (Prime 95B). So far, the camera is only connected directly to the computer and sends its images to the computer.

 

My question now is about the wiring of the camera to the NI device and the commands in matlab. We connected 3 BCN cables to the camera ('Trigger in', 'Read Out', 'Expose Out 1'). We want to trigger the start of the camera with the 'Trigger In' cable. The cable descriptions can be find here at page 20.

 

What we already tried:

  • we connected the 'Read Out' and 'Expose Out 1' to the analog input plugs of the NI device, but the data we received through matlab seems to be just noise.
  • we connected 'Trigger In' to the analog output plug of the NI device and sent into that channel via matlab a vector 1 followed by 000.... This did not make the camera start recording

 

My questions:

  • where does the 'Trigger In' cable need to plugged in on the NI device? 
  • where does the 'Read Out' and 'Expose Out 1' need to be plugged in?
  • how do I trigger the start of the camera via the NI device in matlab?
  • so far the NI device and the camera are only connected via these 3 cables but what comes through the cables seems not to be proper - do I somehow need to connect camera and NI device in my computer or is wiring sufficient?

 

I'd appreciate any comment or helpful link 😉

 

 

 

0 Kudos
Message 1 of 8
(696 Views)

I believe you realize that you need to connect the data lines to their special PCIe card to read the captured image.

 

How are you synchronizing the three signals Read Out, Trigger In and Expose Out 1 for generation or acquisition?

  • These three signals are tightly timed, hence have to be generated & captured simultaneously so that you don't miss an event
  • Better use DO and DI instead of AO and AI for these signals, these are digital signals and not analog

What is your overall requirement in terms of triggering?

-Santhosh
Semiconductor Validation & Production Test
Soliton Technologies
NI CLD, CTD
LabVIEW + TestStand + TestStand Semiconductor Module (2013 - 2020)
NI STS for Mixed signal and RF
0 Kudos
Message 2 of 8
(631 Views)

Thank you for your answer and the hint to use DO and DI!

 

Regarding your first comment - the camera is connected to a PCIe card and the computer receives the images properly. I also have access to the time points each frame was taken. 

 

My overall goal is to start the intracellular recordings and the camera at the same time. Thus, the camera needs a start trigger which initiates frame acquisition. I believe I need a hardware trigger from the I/O connector. The trigger just initiates the start of a sequence of acquisitions. Then each frame is controlled by the internal timing generators of the camera.

 

I assume the 'Trigger In' cable should initiate frame acquisition. 'Read Out' and 'Expose Out 1' should just be an output.

 

 

0 Kudos
Message 3 of 8
(606 Views)

If you would need to synchronize only this camera or any additional triggers to some other equipment?

 

If it were only this camera, then the easy way would be to export the start trigger of the DO task to a PFI line. Connect the PFI line to 'Trigger In' terminal of the camera.

 

Camera is looking for only a rising edge, so the typical trigger exported by the instrument will work.

 

santo_13_0-1627227209619.png

 

I am not a MATLAB guy, I can provide examples in LabVIEW and you would have to write equivalent in MATLAB.

Use the Digital - Finite Input example, add the code to export the Start Trigger to the required PFI line.

santo_13_2-1627227399085.png

 

 

santo_13_1-1627227383689.png

 

In this implementation, when it starts to acquire samples on the 'Read Out' and 'Expose Out 1' a Start Trigger is sent on the PFI line configured. This way you can still see the time correlation between the moment the trigger was sent and you see signals on the Read Out and Expose Out. Choose an appropriate sampling rate and a number of samples to get finer resolution and longer duration.

 

 

 

-Santhosh
Semiconductor Validation & Production Test
Soliton Technologies
NI CLD, CTD
LabVIEW + TestStand + TestStand Semiconductor Module (2013 - 2020)
NI STS for Mixed signal and RF
0 Kudos
Message 4 of 8
(600 Views)

To your first question if we only need to synchronize this camera - yes, only intracellular recordings (controlled by the NI board) and the Camera.

 

 

 

As you suggested we connected the start trigger to a PFI line (PFI2/P1.1). Since you suggested that 'Expose Out' and 'Read Out' are digital signals, we put them into PFI0/P1.0 and PFI1/P1.1. You can see the pinout in the picture below:

 

danschw_0-1627306536260.png

 

In Matlab we tried to initialize these channels by

  • for 'Expose Out' and 'Read Out':
    addDigitalChannel(adconverter,'dev2','Port1/Line0','InputOnly');
    addDigitalChannel(adconverter,'dev2','Port1/Line1','InputOnly');
  • for 'Trigger in':
    addDigitalChannel(adconverter,'dev2','Port1/Line2','OutputOnly');

The problem we faced then was that the function to start the intracellular recordings ('startForeground(adconverter)') did not work anymore when both analog and digital channel were activated in one single daq session. Thus, we created another session for the adconverter to initiate only the 'trigger in' digital channel.

We then tried in several ways this:

addTriggerConnection(s,source,destination,type)

but faced an error was telling us that no clocked operations are possible. 

 

Our question:

  • What is a PFI line for? We know that a digital PFI is for "Static digital input, static digital output, timing input, timing output", but how does a timing output signal look like? Who gives this signal? 
  • What are the principles we need to know for triggering? How do we tell the NI board to send a trigger signal to the camera?
  • What is a clock connection? Do we need this for our goal?

 

What we tried apart from that is to connect the 'trigger in' cable again into the analog output plug as you can see in the picture below:

danschw_1-1627306885485.png

We tried to send a TTL pulse to the camera by sending a vector into this channel with 5 Volt for a certain amount of time (we tried max. 10ms) followed by a zerovector. This did not make the camera start recording. 

 

Our question:

  • Do you know if this approach could be correct?
  • How long should a TTL pulse be applied to trigger the start? Is 10ms enough?
0 Kudos
Message 5 of 8
(555 Views)

The first part you did was correct except that you should not define 'Trigger In' as a DO.

santo_13_0-1627331774995.png

Do the following,

addDigitalChannel(adconverter,'dev2','Port1/Line0','InputOnly');
addDigitalChannel(adconverter,'dev2','Port1/Line1','InputOnly');
addtrigger(adconverter,"Digital","StartTrigger","dev2/PFI2","External")

what do you use the AOs for in terms of intracellular recording?

Where do those intracellular recordings highlight connections wire to?

How do those intracellular recording signals look against the timing of the three signals highlighted in red?

 


@danschw wrote:

Our question:

  • What is a PFI line for? We know that a digital PFI is for "Static digital input, static digital output, timing input, timing output", but how does a timing output signal look like? Who gives this signal? 
  • What are the principles we need to know for triggering? How do we tell the NI board to send a trigger signal to the camera?
  • What is a clock connection? Do we need this for our goal?

@danschw wrote:

Our question:

  • Do you know if this approach could be correct?
  • How long should a TTL pulse be applied to trigger the start? Is 10ms enough?

You would have to refer to the camera datasheet to know the minimum pulse width required for the rising edge to be detected properly. BTW, are you sure you configured the camera into trigger mode?

-Santhosh
Semiconductor Validation & Production Test
Soliton Technologies
NI CLD, CTD
LabVIEW + TestStand + TestStand Semiconductor Module (2013 - 2020)
NI STS for Mixed signal and RF
0 Kudos
Message 6 of 8
(544 Views)

Similar to what you suggested we did:

addDigitalChannel(adconverter,'dev2','Port1/Line0','InputOnly');
addDigitalChannel(adconverter,'dev2','Port1/Line1','InputOnly');
addTriggerConnection(adconverter,"Dev/PFI2","External","StartTrigger"

 

However, then we faced a problem when we queued the stimulus for the intracellular recordings with

queueOutputData(adconverter,stimulus)

The error message was "Unable to accept data because not all channels support clocked operations".

The adconverter object looked like this:

adconverter.png

When we don't initialize these digital i/o channels, we don't have that problem of not being able to use startForeground or startBackground.

 

 

 

Thus, we tried to only add the trigger, but the camera still did not start recording. We connected a scope and saw a trigger signal which looked like a sinusoidal curve and did not have the 5Volt amplitude which we assume that we need to trigger the camera. 

We had a similar problem before when we plugged the 'trigger in' cable into analog output. When we sent a 5Volt signal for 0.01 ms, we did not see a 5Volt pulse on the scope. However, when we increased the duration of the 5Volt to 1ms, we could see a proper 5Volt signal. Nevertheless the camera did not start recording.

 

 

 

To your question regarding the intracellular recordings:

  • What do you use the AOs for in terms of intracellular recording?
    • ao1 and ao3 are used for stimulation of the cell 
    • ao2 is used to turn on a LED lamp
    • and this works all properly, the cells are stimulated and the LED turns on
  • Where do those intracellular recordings highlight connections wire to?
    • the ao1 and ao3 wire to an amplifier from npi (SEC-05X)
    • the ao2 wires to a LED lamp
    • ai1-4 wires to the amplifier as well (two channels for the cell responses and two channels for the measured stimulation)
  • How do those intracellular recording signals look against the timing of the three signals highlighted in red?
    • we did not get any signals from the 'Read Out' and 'Exposure Out' cables yet
    • the intracellular recordings go into matlab as a matrix with 4 columns (each columns one ai channel) and are as long as the stimulation
  • Are you sure you configured the camera into trigger mode?
    • we are sure that the camera is in trigger mode, we also wrote in another forum regarding this and it must be correct

 

My Question:

  • How can we increase the size of the trigger?
  • How can we initialize the digital i/o for 'Expose Out' and 'Read Out' in Matlab properly so that we get information from the camera when the pictures were taken? (Btw these are not the cables where the images are transferred. These are just the cables that should tell when the images were taken).
0 Kudos
Message 7 of 8
(534 Views)

You can use the RTSI bus to route an incoming trigger to an NI measurement device to synchronize data acquisition.

0 Kudos
Message 8 of 8
(492 Views)