Light Control Feature Set

The Light Control feature set allows you to control up to 4 light devices via the pylon software.

The Light Control feature set is based on the SLP protocol that enables cameras and light devices to communicate directly with each other. A light device can be a third-party light or a light from the Basler Camera Light portfolio (available from September 2019). If you want to use a third-party light, you need the Basler SLP Strobe Controller to enable the communication between the camera and the light. If you choose a Basler light, a separate controller is not required as the controller features are already included. Both options are plug-and-play.

In this topic Hide

Using the Feature

Configuring the Basler Light / Light Controller

  1. If you haven't done so yet, connect the controller and the light.
  2. Enable the Polling option in the pylon Viewer.
  3. Set the BslLightControlMode parameter to On.
    The BslLightControlSource parameter will show which GPIO line of the camera is used to control the light features.
    If you're connecting a new controller, it will automatically be assigned the next available light device ID.
  4. Execute the BslLightControlEnumerateDevices command.
  5. If you have several Basler lights or light controllers in your environment, set the BslLightDeviceSelector parameter to the device that you want to configure.
    Make sure that there are no light device ID conflicts.
  6. Set the BslLightDeviceMaxCurrent parameter to the maximum current rating of your light.
    This ensures that your light will not get damaged and that you can safely use the whole current range of your light using the BslLightDeviceBrightness parameter.
    You can only change the BslLightDeviceMaxCurrent parameter value, when the BslLightDeviceOperationMode parameter is set to Off.
  7. Set the BslLightDeviceBrightness parameter to the desired brightness.
    This parameter can be set in a range from 0 to 100 %. 100 % corresponds to the current that you have specified with the BslLightDeviceMaxCurrent parameter. 50 % will reduce the current by a factor of 2. The controller doesn't use pulse width modulataion (PWM).
  8. Set the BslLightDeviceOperationMode parameter to the desired mode:

Configuring the Strobe Mode

One of the advantages of the strobe mode is that it can help to increase the life expectancy of your light. By not operating it continuously but like a flash when needed, less heat is generated in the LEDs. This slows down the aging process of the lights.
The other advantage is that while in strobe mode you can overdrive the lights, i.e., increase the current supplied to a maximum of 10 A, which increases the brightness of your light. Before you do so, read the instructions in the Overdrive Mode section.

If you have set the BslLightDeviceOperationMode parameter to Strobe, the light is triggered by the ExposureActive signal. To control the duration of the individual strobe pulses, you have to specify whether you want automatic or manual strobe operation using the BslLightDeviceStrobeMode parameter.

If you're using the Trigger Width exposure mode or the Sequencer feature, you have to use the Manual strobe mode.

The camera uses the same line for sending the ExposureActive signal to the controller and for sending any changes of light control parameter settings. As parameter changes take precedence, the line will not be available for the ExposureActive signal and strobe operation will be disrupted. To avoid this, only change parameter settings while the strobe mode is disabled.

Overdrive Mode

Overdriving your light means that you can increase the current, resulting in a higher light intensity, while the light is in strobe mode.

Notice

Incorrect operation may damage your lights.

Carefully read the instructions in this section to avoid damaging the connected lights and to ensure that the lights don't age prematurely.

When using the overdrive mode, you have to consider the following aspects to avoid damaging your light:

Changing the Light Device ID

To change the ID of a light:

  1. Set the BslLightControlMode parameter to On.
  2. Set the BslLightDeviceOperationMode parameter to Off.
  3. Set the BslLightDeviceSelector parameter to the Basler light / controller whose ID you want to change.
  4. Set the BslLightDeviceChangeID parameter to the desired value.
    The ID will be changed immediately.

Using More Than One Light Controller
When using more than one light controller, you have to make sure that their IDs are all different. Using controllers with identical IDs will cause communication errors.
Duplicate IDs can occur, if you're connecting new controllers for the first time because all controllers are shipped with the light device ID set to 7. It can also occur when connecting existing controllers from another system as light device IDs are remembered by the controller once they have been set.
The best way to prevent conflicts, is to connect controllers one after the other and always assign a new and unique ID after having connected a controller.

Troubleshooting

The light / light controller can detect errors that you can correct yourself. Check the BslLightDeviceLastError parameter to find out which error has occurred. After you have corrected the error, you can clear it from the list.

Up to 25 errors can be stored. If a 26th error occurs, the oldest error will be overwritten and so on.

If you have several lights / light controllers connected, the BslLightControlErrorStatus tells you which device is experiencing problems.

Checking and Clearing Errors

Checking and clearing errors is an iterative process, depending on how many errors have occurred.

  1. To check the last error that has occurred, get the value of the BslLightDeviceLastError parameter.
  2. Correct the corresponding error.
  3. To delete the last error from the list of errors, execute the BslLightDeviceClearLastError command.
  4. Continue getting and deleting the last error until the BslLightDeviceLastError parameter shows NoError.

Available Error Codes

Value Meaning
No Error The light / light controller hasn't detected any errors since the last time the error memory was cleared.
Communication Error

A communication error occurs if the data transmission between the light / light controller and the camera is faulty. This can be caused by using cables that are too long or by too much noise on the line.

Connection Error

A connection error occurs if the connection between the light / light controller and the camera is broken or if a communication error has already occurred. Other reasons may be loose connections or the controller being disconnected completely.

Hardware Error

The light / light controller is experiencing a technical fault. Disconnecting and reconnecting the power supply may solve the issue.

Insufficient Current

The light controller is unable to supply the requested current. Try lowering the BslLightDeviceMaxCurrent parameter value.

Short Circuit

There is a short circuit at the Lighting connector of the light controller. This can be caused by a faulty light unit.

Power-Cycling the Controller

After power-cycling the controller, it can take up to five minutes for the controller to become available again. This is normal behavior.

Sample Code

// Enable the light control mode
camera.BslLightControlMode.SetValue(BslLightControlMode_On);
//Enumerate the light devices
camera.BslLightControlEnumerateDevices.Execute();
//Select light device 1
camera.BslLightDeviceSelector.SetValue(BslLightDeviceSelector_Device1);
//Set the maximum current of device 1 to 100 mA
camera.BslLightDeviceMaxCurrent.SetValue(100.0);
//Set the brightness to 100 %
camera.BslLightDeviceBrightness.SetValue(100.0);
//Set the operation mode to continuous
camera.BslLightDeviceOperationMode.SetValue(BslLightDeviceOperationMode_On);
INodeMap& nodemap = camera.GetNodeMap();
// Enable the light control mode
CEnumerationPtr(nodemap.GetNode("BslLightControlMode"))->FromString("On");
// Enumerate the light devices
CCommandPtr(nodemap.GetNode("BslLightControlEnumerateDevices"))->Execute();
// Select light device 1
CEnumerationPtr(nodemap.GetNode("BslLightDeviceSelector"))->FromString("Device1");
// Set the maximum current of device 1 to 100 mA
CFloatPtr(nodemap.GetNode("BslLightDeviceMaxCurrent"))->SetValue(100.0);
// Set the brightness to 100 %
CFloatPtr(nodemap.GetNode("BslLightDeviceBrightness"))->SetValue(100.0);
// Set the operation mode to continuous
CEnumerationPtr(nodemap.GetNode("BslLightDeviceOperationMode"))->FromString("On");
// Enable the light control mode
camera.Parameters[PLCamera.BslLightControlMode].SetValue(PLCamera.BslLightControlMode.On);
// Enumerate the light devices
camera.Parameters[PLCamera.BslLightControlEnumerateDevices].Execute();
// Select light device 1
camera.Parameters[PLCamera.BslLightDeviceSelector].SetValue(PLCamera.BslLightDeviceSelector.Device1);
// Set the maximum current of device 1 to 100 mA
camera.Parameters[PLCamera.BslLightDeviceMaxCurrent].SetValue(100.0);
// Set the brightness to 100 %
camera.Parameters[PLCamera.BslLightDeviceBrightness].SetValue(100.0);
// Set the operation mode to continuous
camera.Parameters[PLCamera.BslLightDeviceOperationMode].SetValue(PLCamera.BslLightDeviceOperationMode.On);
// Enable the light control mode
Pylon.DeviceFeatureFromString(hdev, "BslLightControlMode", "On");
// Enumerate the light devices
Pylon.DeviceExecuteCommandFeature(hdev, "BslLightControlEnumerateDevices");
// Select light device 1
Pylon.DeviceFeatureFromString(hdev, "BslLightDeviceSelector", "Device1");
// Set the maximum current of device 1 to 100 mA
Pylon.DeviceSetFloatFeature(hdev, "BslLightDeviceMaxCurrent", 100.0);
// Set the brightness to 100 %
Pylon.DeviceSetFloatFeature(hdev, "BslLightDeviceBrightness", 100.0);
// Set the operation mode to continuous
Pylon.DeviceFeatureFromString(hdev, "BslLightDeviceOperationMode", "On");
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK;  /* Return value of pylon methods */
/* Enable the light control mode */
errRes = PylonDeviceFeatureFromString(hdev, "BslLightControlMode", "On");
CHECK(errRes);
/* Enumerate the light devices */
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslLightControlEnumerateDevices");
CHECK(errRes);
/* Select light device 1 */
errRes = PylonDeviceFeatureFromString(hdev, "BslLightDeviceSelector", "Device1");
CHECK(errRes);
/* Set the maximum current of device 1 to 100 mA */
errRes = PylonDeviceSetFloatFeature(hdev, "BslLightDeviceMaxCurrent", 100.0);
CHECK(errRes);
/* Set the brightness to 100 % */
errRes = PylonDeviceSetFloatFeature(hdev, "BslLightDeviceBrightness", 100.0);
CHECK(errRes);
/* Set the operation mode to continuous */
errRes = PylonDeviceFeatureFromString(hdev, "BslLightDeviceOperationMode", "On");
CHECK(errRes);

You can also use the pylon Viewer to easily set the parameters.