Using GPIO on LUCID Cameras

Introduction

Many high precision applications using machine vision cameras require the camera to capture a frame at a precision instant (ie. When the target object moves into camera’s field of view) or multiple cameras to capture frames synchronously. This application note outlines the method available to trigger the camera to capture a single frame, a series of frames or synchronize multiple LUCID cameras to capture image or sequence of images together precisely for these applications.

The camera has three operation modes – Free-run or Stream Mode, single frame or Snapshot Mode and Trigger Mode.

The setup is simple for all 3 modes. The following section describes how to set LUCID camera(s) in Free-run Mode, Snapshot Mode and Trigger Mode.

Prerequisites
  • 1x LUCID Phoenix or 1x Triton Camera
  • One GPIO cable for Phoenix or Triton
  • Arena Software
Free-Run Mode

In Free-run mode, the camera with the build in sensor produces a stream of images at a predefined acquisition frame rate continuously. The sensor captures one frame of image into the pixel array and transfers the pixel data over the sensor interface into the camera electronics. During this transfer, the sensor may capture the next frame of image. Under this mode, the exposure of the current frame may overlap with the readout of the previous frame.

Enable Free run mode on lucid camera

To put camera in Free-run mode, simply:

  1. Connect the camera
  2. Launch Arena
  3. Click Stream button.

In the above example, the camera free-runs at a fixed 20 frame per second without any external control over when exactly each frame is captured.

Snapshot Mode

Compared to Free-run mode, Snapshot mode takes only one image. The software grabs one frame out of the Free-run stream and pass it to the application level. This mode is useful when the user only wants to capture one image at any time.

Snapshot Mode

To capture a single frame from the camera in Snapshot mode, simply:

  1. Connect the camera
  2. Launch Arena
  3. Click Snap button

The software puts the camera in SingleFrame Acquisition Mode, snaps an image (AcquisitionStart cmd) and then pass that frame to the application for display. The framerate is undefined (shown as 0.0) as only one image was captured.

Trigger Mode

In an industrial environment, many applications need to capture an image at a given point in time. The use case could be object inspection, when the target object moves to the front of the camera, the application would need to take an image of the object at that precise moment. The host machine is often equipped with ability to output an electrical signal exactly when the object is passing in front of the lens of the camera.

This electrical signal generated by a device such as a photodetector is the key driver for the camera to start capture. When the camera is operating under this mode, it is said to be in trigger mode.

Cable and Connector Information

Power
We recommend to power LUCID cameras either via the camera’s Ethernet connector (PoE) or via the camera’s I/O connector.

  • When using PoE, the power supply must comply with the IEEE 802.3af standard. You can find recommended parts to power the camera in LUCID web store.
  • When powering via the GPIO, please use pin VAUX(12-24V DC Power Input)
  • Electric Shock Hazard. Unapproved power supplies may cause electric shock, injuries, death or fires and burns. Please ensure the power supply is compliant with safety requirement.
  • Voltage outside of the specified range can cause damage to LUCID cameras.

GPIO Connector
LUCID recommends using LUCID’s standard GPIO-8P20 and GPIO-M8 for Phoenix and Triton cameras’ I/O control.

The following considerations should be used when choosing I/O cables:

  • Recommend shielded cables
  • AWG26 or AWG28 preferred
  • Long cables may result in voltage drop across cable ends and should be avoided (<10m)
  • Proximity to strong electromagnetic field should be avoided
Phoenix GPIO Connector Information
ManufacturerJST
Part Number Receptacle (camera)JST BM08B-NSHSS-TBT(LF)(SN)
Part Number (cable plug)JST NSHR-08V-S
LUCID Part NumberGPIO-8P20
Number of pins / wires8
Wire GaugeAWG 28
Length of the Wires20 cm
Mechanical ConnectionLatch lock

The pin out of the Phoenix GPIO receptacle and color mapping of the wires is as the following:

Phoenix camera GPIO
Triton & Atlas GPIO Connector Information
ManufacturerPhoenix Contact
Part Number Receptacle (camera)SACC-CI-M8FS-8P SMD R32 – 1412247
LUCID Part NumberGPIO-M8
Number of pins / wires8
Wire GaugeAWG 26
Length of the Wires1m
Mechanical ConnectionM8 Screw-locking

The pin out of the Triton and Altas GPIO receptacle and color mapping of the wires is as the following:

Triton M8 GPIO Pin Layout

An incorrect plug can damage the GPIO connector. Contact LUCID support for the appropriate plug and cables.

GPIO Pin Mapping and Function

The camera uses the following functionality on each pin:

Pin NumberPhoenix ColorTriton/Atlas ColorPin DescriptionLine Selector
1RedRedVAUX (12-24V DC Power Input)
2BrownBrownNon-isolated bi-directional GPIO channelLine 2
3OrangeOrangeVDD GPIO (2.5V Power Output)Line 4
4BrownPurpleNon-isolated bi-directional GPIO channelLine 3
5BlackBlackGND (Camera GND)
6BlueBlueOPTO GND (Opto-isolated Reference)
7WhiteYellowOPTO OUT (Opto-isolated Output)Line 1
8GreenGreenOPTO IN (Opto-isolated Input)Line 0
Trigger Configuration

To set up the camera in trigger mode:

  1. Connect camera to the host PC
  2. Launch Arena
Step 3

3. Select the camera and navigate to the “Digital IO Control” section.

Step 4

4. Select the Line you wish to configure to take as trigger input. In the example below, Line2 (brown) is configured as trigger.

Step 5

5. To configure line2 as trigger input, set Line mode to Input.

Step 6

6. Now the camera’s GPIO is set up to take trigger input; however, the camera is not yet in Trigger Mode. To do so, navigate to “Acquisition Control”.

Step 7

7. For the trigger signal to prompt for a signal frame acquisition, set Trigger Selector to FrameStart.

Step 8

8. Set Trigger Source to Line2 – the line we configured in step 5.

Step 9

9. Turn Trigger Mode on.

10. Click stream button and you should now see one image per trigger signal going into the GPIO brown pin.

Over Trigger

If the input trigger frequency is greater than the sensor framerate, the trigger is discarded, not delayed.

Over trigger signal

All shorter signals like spikes are ignored:

Short signals like spikes are ignored
Multi-frame Trigger

To capture multiple images per trigger pulse, please stop the camera from acquisition and put it in the Burst mode:

Set Acquisition Burst Frame Count
  1. Set Trigger Selector to FrameBurstStart.
  2. Configure Acquisition Burst Frame Count to the number of frames you wish to capture per trigger pulse (in this example is it set to 5).

Now you will see 5 strobe pulses indicating 5 frames captured for each corresponding trigger input.

Multi-frame trigger signal
Setting Up Strobe Output

In certain applications, other devices need to be synchronized with camera capture regardless of the camera’s operation mode (Freerun or Trigger). In this case, the user can take advantage of the strobe output function on the camera to know when exactly a frame capture is taking place. In the following section, strobe configuration is discussed.

Strobe output step 1

1. Select a line to output strobe signal in the Line Selector row, in this example Line 3 is used.

Strobe output step 2

2. Set Line Mode to Output.

Strobe output step 3

3. To output strobe signal matching the camera exposure. Set Line Source to ExposureActive.

4. Click Stream button in Arena, if the camera is in free-run mode you will see continuous signal corresponding to each exposure.  If the camera is in trigger mode and Stream is clicked, the following patter can be observed on the scope. The yellow signal is the trigger in to the camera, the green one is the strobe output. The Image capture is synchronous to the rising edge of the trigger pulse.

Strobe output signal
Opto-isolated Strobe Output

LUCID cameras are equipped with opto-isolated output pins. The following diagram shows a typical circuit you can use to monitor the output line with a voltage signal on Phoenix cameras.

gpio circuit monitor diagram

For a list of resistor values and pull-up voltage values, please refer to the following table.

Sample values measured at room temperature. Results may vary over temperature and setup.

Voltage (V)External Resistor (Ω)Max Rise Delay (us)Max Fall Delay (us)Max Rise Time (us)Max Fall Time (us)Current (mA)Low Level (V)
2.51505054055.70.9
2.53305054052.90.8
2.55605054051.90.5
2.51k5054051.20.3
53305055056.60.9
556050550540.7
51k5055052.40.5
51.8k5055051.40.4
121k50560560.9
121.8k5056053.40.9
122.7k5056052.40.7
124.7k5056051.50.5
241.8k6056057.10.9
242.7k6056054.70.9
244.7k6056052.80.7
246.8k6056052.10.6
VCC Voltage Output

The camera is capable of output 2.5V voltage output for use of pulling up the optocoupled signal or powering small external device with the limitation of 100mA output.

VCC voltage output diagram

To enable VCC for the camera, select Line4 from the Line Selector row under Digital IO Control and set Voltage External Enable to true.

Enable VCC in Arena View
Synchronous Capture - Master and Slave

Instead of using an external trigger signal, the user can use a master camera’s strobe output to trigger one or many slave cameras to achieve synchronous capture.

The following is an example setup with one master and one slave Phoenix:

In ArenaView, configure the following.

  1. Turn on VCC output on the master camera. Refer to VCC section in this application note.
  2. Turn on strobe output on the master camera. Refer to Setting Up Strobe Output section in the application note.
  3. Turn on trigger input on the slave camera. Refer to Trigger Configuration section in the application note.
Master and slave synchronous capture GPIO setup
Jitter and Delay

In many high precision tasks, jitter and delay are two common characteristics system designers care about in order to guarantee a certain precision in their inspection task. Knowing the jitter and delay values helps the system designer to understand the accuracy in device operational sychronization.

To measure the jitter and delay of LUCID cameras, you can use an oscilloscope and two probes. Follow the steps below.

  1. Set Exposure Auto to Off and Exposure Time to a fixed exposure time, such as 500µs .
  2. Put the camera in trigger mode. Refer to Trigger Configuration section in the application note.
  3. Configure strobe output on the camera. Refer to Setting Up Strobe Output section in the application note.
  4. Attach a probe to your trigger signal pins and another probe to the camera’s strobe output pins.
  5. On the scope, the trigger signal and strobe signal can be shown at the same time. Measure the difference between trigger activation edge and strobe output edge.

How fast the camera responds to the trigger signal could depend on the following parameters:

  • Camera interface
  • Sensor resolution
  • Sensor trigger mode
  • Type of I/O signal
  • Voltage of the trigger signal
  • Active flange for the trigger
  • Signal quality (noise, slew rate)

The following jitter and delay values were measured on specific camera models with specific firmware. These values may change depending on firmware version and mode of camera operation. Please refer to the value below for comparison with your actual setup.

CameraFirmware VersionInput Signal (V)Offset (V)Trigger Freq (Hz)Exposure Time (μs)Min Latency (μs)Max Latency (μs)Jitter (μs)
PHX004S1.5.0.05.002.501.00500.0013.4018.605.20
PHX016S1.5.0 .05.002.501.00500.0024.6036.2011.60
PHX032S1.5.0.05.002.501.00500.0035.0050.6015.60
PHX050S1.5.0.05.002.501.00500.0041.4060.6019.20
PHX050S-P1.6.0.05.002.501.00500.0041.0060.6019.60
PHX089S1.5.0.05.002.501.00500.0067.80100.2032.40
PHX120S1.5.0.05.002.501.00500.0067.4099.4032.00
Trigger Latency Feature

LUCID has implemented a featured named Trigger Latency to allow more deterministic trigger behavior. When this feature is enabled, the trigger latency will be fixed and the jitter will be significantly smaller.

To turn on the feature, set Trigger Latency = One Line

Trigger Latency Feature

With Trigger Latency set to One Line, the following measurements were captured on a PHX050S-PC (IMX250MZR): Trigger Latency is ~61 microseconds and Jitter is typically <100 nanoseconds.

Summary

There is no single solution of using GPIO that fits every application. The most suitable solution (ie. Using Optocoupled pin or not) depends on the application need. The following table shows a quick summary of optocoupled versus non-optocoupled input/output pins.

 GPIOOpto-coupled
Speed+++
Over-voltage protection+++
Flexible direction+
Functionality+++
Robust+++
Electrical isolation+
Shortcut protection+
Slew rate / short pulses++
Glossary
StrobeOutput signal generated by the camera’s exposure, can be used to trigger flash or general illumination.
TriggerSignal used to start the image capture.
Opto-couplerDevice to split circuits electrically.
GPIOGeneral purpose input or output pin, direction is configurable by software. Functionality is also independent.
VCCVoltage at the common collector.
GNDGround. GND is the reference point from which voltages are measured for the non-optocoupled pins.
TTLTrue Transistor Logic. Digital communication with 5 Volt level.
Free-run modeThe camera sends a continuous stream of images.
Also called live, streaming or video mode
Snapshot ModeTaking a single image under “single acquisition” mode after application command. One frame is captured.
Trigger modeMode for captuinge a single image, also called snapshot or capture mode