---
title: "How To: Two Cameras, One on Software and One on Hardware Trigger"
description: "Complete settings of LumiScan Cam Driver for two cameras - one captured by software trigger, one by a hardware trigger line - with feature files and a storage folder."
product: "LumiScan Cam Driver"
component: "lumiscan-cam-driver"
version: "2.3.0"
display_version: "2.3.0.4"
latest_version: true
language: "en"
url: "https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/how-tos/two-cameras-software-and-hardware-trigger.html"
---

# How To: Two Cameras, One on Software and One on Hardware Trigger – LumiScan Cam Driver

This guide sets up one installation of LumiScan Cam Driver with two cameras:

- `camera1` is triggered by software: each capture fires the camera and takes its image.
- `camera2` is triggered by a hardware signal on one of its input lines: a capture takes the next image the camera delivers after a pulse.

Both store their images in the same storage folder, each in a sub-folder of its own. All five files are complete: copy them, then change the serial numbers.

## Files {#files}

All five files of this guide, to download:

- [lumiscan-cam-driver.json](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/lumiscan-cam-driver.json) - the application settings
- [camera1.json](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/camera1.json) - the module file of the software-triggered camera
- [camera2.json](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/camera2.json) - the module file of the hardware-triggered camera
- [camera1-features.txt](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/camera1-features.txt) - the feature file of camera1
- [camera2-features.txt](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/camera2-features.txt) - the feature file of camera2

## Before you start {#prerequisites}

- LumiScan Cam Driver installed, with one licence per camera, see [Requirements](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/lumiscan-camdriver/requirements.html)
- Two GigE Vision cameras in the camera network, with their serial numbers
- The trigger signal wired to an input line of `camera2`; the name of that line (`Line0`, `Line1`, …) is in the camera’s documentation

> [!NOTE]
> The files below use the settings format from v2.3.0: the cameras, with their serial numbers and feature files, are listed in `lumiscan-cam-driver.json`, and each module names its camera by `cameraId`. Before, each module file carried `serial`, `driverId` and `initialFeatureFile` itself. The Cam Driver converts files of the older format at start, keeping a copy of each file it changes.

## How it fits together {#overview}

| File | What it holds |
| --- | --- |
| `lumiscan-cam-driver.json` | The application settings: both module files, both cameras with their feature files, the storage |
| `camera1.json` | The module of the software-triggered camera |
| `camera2.json` | The module of the hardware-triggered camera |
| `camera1-features.txt` | The trigger settings of `camera1`: software trigger |
| `camera2-features.txt` | The trigger settings of `camera2`: hardware trigger on `Line0`, rising edge |

When it connects a camera, the Cam Driver first sets it up for its own use - software trigger, packet size, pixel format - and then applies the camera’s feature files in order. A feature file can therefore change what the Cam Driver has set, as `camera2-features.txt` does with the trigger source. A feature the camera does not take is logged and skipped; the connection goes on.

Put all five files into the folder the Cam Driver reads its settings from, see [Creating New Camera Settings Files](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/lumiscan-camdriver/creating-new-camera-settings-files.html). A relative path in `featureFiles` is resolved against this folder.

## Step 1 - Application settings {#step-1-application}

**lumiscan-cam-driver.json**

```json
{
    "$schema": "schemas/lumiscan-cam-driver.schema.json",
    "meta": {
        "inputFileType": "LumiScan-CtrlX-Cam-Driver",
        "inputFileVersion": "1.0.0",
        "targetMachine": "CtrlX7",
        "programName": "lumiscan-cam-driver",
        "programVersion": "2.3.0"
    },
    "modules": [
        "camera1.json",
        "camera2.json"
    ],
    "cameras": [
        {
            "cameraId": "camera1",
            "serial": "LX123456",
            "driverId": "default",
            "featureFiles": [
                "camera1-features.txt"
            ]
        },
        {
            "cameraId": "camera2",
            "serial": "LX654321",
            "driverId": "default",
            "featureFiles": [
                "camera2-features.txt"
            ]
        }
    ],
    "system": {
        "debug": false,
        "logLevel": "INFO",
        "unifiedStorage": false,
        "storage": {
            "type": "Internal",
            "parameters": {
                "rootPath": "images"
            }
        }
    }
}
```

[Download lumiscan-cam-driver.json](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/lumiscan-cam-driver.json)

Change:

- `serial` of both cameras: the serial numbers of your cameras.

The images go to the folder `images` of the application’s settings folder. To store them elsewhere, change `storage/parameters/rootPath`, see [Saving Image Files](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/lumiscan-camdriver/initializing-the-camera.html#saving-image-files).

With `unifiedStorage` set to `false`, `camera1` saves into `<rootPath>/camera1` and `camera2` into `<rootPath>/camera2`. One storage serves all modules: the storage cannot be set per module.

## Step 2 - Module files {#step-2-modules}

**camera1.json**

```json
{
    "$schema": "schemas/lumiscan-cam-driver-module.schema.json",
    "meta": {
        "inputFileType": "LumiScan-Ctrlx-Camera-Configuration",
        "inputFileVersion": "0.0.1",
        "targetMachine": "CtrlX7",
        "programName": "lumiscan-cam-driver",
        "programVersion": "2.3.0"
    },
    "id": "camera1",
    "cameraId": "camera1",
    "exposureTimeUS": 10000,
    "pixelFormat": "Mono8",
    "exportPixelFormat": "Mono8",
    "packetSize": 1500,
    "packetDelay_us": 0,
    "timeout_ms": 2000,
    "timestampSource": "Camera",
    "clearBufferBeforeCapture": false,
    "triggerBeforeAcquire": true
}
```

[Download camera1.json](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/camera1.json)

`triggerBeforeAcquire` is `true`: each capture fires the software trigger and then takes the image. The client calls only `control/capture/execute`, or runs the capture handshake.

**camera2.json**

```json
{
    "$schema": "schemas/lumiscan-cam-driver-module.schema.json",
    "meta": {
        "inputFileType": "LumiScan-Ctrlx-Camera-Configuration",
        "inputFileVersion": "0.0.1",
        "targetMachine": "CtrlX7",
        "programName": "lumiscan-cam-driver",
        "programVersion": "2.3.0"
    },
    "id": "camera2",
    "cameraId": "camera2",
    "exposureTimeUS": 10000,
    "pixelFormat": "Mono8",
    "exportPixelFormat": "Mono8",
    "packetSize": 1500,
    "packetDelay_us": 0,
    "timeout_ms": 10000,
    "timestampSource": "Camera",
    "clearBufferBeforeCapture": false,
    "triggerBeforeAcquire": false
}
```

[Download camera2.json](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/camera2.json)

`triggerBeforeAcquire` is `false`: a capture fires no trigger, it takes the next image the camera delivers. One pulse, one capture: images not yet captured wait in the camera’s queue (`device-info/number-of-images-in-queue`). `timeout_ms` is how long a capture waits for the pulse; when none comes, the capture fails with `-10004` and the fault is latched until `reset` and `connect-camera`, see [Recovering from a Failed Capture](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/lumiscan-camdriver/general-concept-of-handshake.html#recovering-from-a-failed-capture). Choose a timeout longer than the longest time between two pulses in your process.

## Step 3 - Feature files {#step-3-feature-files}

One feature per line, its name and its value. The names are GenICam (SFNC) names; a camera that names its trigger features differently needs a feature mapping, see [Custom GenICam Feature Names](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/lumiscan-camdriver/genicam-feature-names.html).

**camera1-features.txt**

```text
TriggerSelector FrameStart
TriggerMode On
TriggerSource Software
```

[Download camera1-features.txt](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/camera1-features.txt)

**camera2-features.txt**

```text
TriggerSelector FrameStart
TriggerMode On
TriggerSource Line0
TriggerActivation RisingEdge
```

[Download camera2-features.txt](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/_attachments/two-cameras/camera2-features.txt)

Change `Line0` to the input line the trigger signal is wired to, and `RisingEdge` to the edge of your signal. Use an edge, not a level (`LevelHigh`, `LevelLow`).

## Step 4 - Restart and check {#step-4-restart}

1. Restart LumiScan Cam Driver. It reads its settings files only at start.
2. Connect both cameras with the handshake on `<camera>/control/connect-camera`.
3. Check under `hdvisionsystems/lumiscan-cam-driver/camera2/features` that `TriggerMode` is `On` and `TriggerSource` is `Line0`. If not, the log names the feature the camera did not take.
4. Capture with `camera1/control/capture/execute`: `camera1/control/status/code` is `0`.
5. Send a trigger pulse to `camera2`, then capture with `camera2/control/capture/execute` - or start the capture first and send the pulse within `timeout_ms`: `camera2/control/status/code` is `0`.
6. Save both images with `<camera>/control/save/execute` and check the two sub-folders of the storage folder.

## Keep the cameras from transmitting at once {#bandwidth}

`camera2` transmits as soon as its pulse comes, whatever `camera1` is doing. If a pulse falls into a capture of `camera1`, both cameras send at the same time and images arrive incomplete (`-10004`). Either let the PLC keep the pulse of `camera2` and the captures of `camera1` apart, or interleave the packets of both cameras with `GevSCPD` and `GevSCFTD`, see [Using Multiple Cameras](https://docs.hdvisionsystems.com/en/lumiscan-cam-driver/lumiscan-camdriver/using-multiple-cameras.html#hardware-trigger). The packet delay of a camera is `packetDelay_us` in its module file; `GevSCFTD` can be added to its feature file.

## Result {#result}

- `camera1` takes an image with every capture.
- `camera2` takes the image of each hardware pulse.
- Both save into their own sub-folder of the same storage folder.

## JSON Schemas {#json-schemas}

The application keeps the JSON Schemas of its settings files in its `schemas` folder; those copies always match the installed version. The schemas of LumiScan Cam Driver 2.3.0 can also be downloaded: [JSON Schemas of LumiScan Cam Driver 2.3.0](https://docs.hdvisionsystems.com/schemas/lumiscan-cam-driver/2.3.0/index.html).

To have an editor such as Visual Studio Code check a copy of a settings file that you edit on your PC, point its `$schema` entry at the published schema:

```json
{
  "$schema": "https://docs.hdvisionsystems.com/schemas/lumiscan-cam-driver/2.3.0/lumiscan-cam-driver.schema.json",
  ...
}
```

Leave the `$schema` entry of the files on the device as the application wrote it.
