Skip to content
STAGING SERVER
DEVELOPMENT SERVER

Reading a Barcode#

This topic shows one complete use of the Basler Vision Connector: read one barcode in a camera image and deliver the decoded text to your application.

The Web UI shows the camera image. The decoded text is not shown there. Your application receives the text on the recipe data topic.

What You Need#

  • A Basler Vision Connector setup with a visible camera image. See From the Marketplace to the First Image.
  • pylon version 26.10 or lower. The Basler Vision Connector doesn't support vTool recipes that you create or edit in a pylon version higher than 26.10.
  • A Barcode Reader vTool recipe saved as a .precipe file.
  • A pylon vTools license for the Barcode Reader. You need this license in the pylon Viewer to create the recipe.
  • A Basler Vision Connector vTools license for the Barcode Reader, to run the recipe in the Basler Vision Connector. See vTools Licenses.

Create the Recipe#

Create the recipe in the Workbench of the pylon Viewer. For the general recipe steps, see Working with Recipes.

  1. Add a Barcode Reader vTool.
  2. Add a pin on the input terminal and connect it to the Image input pin of the Barcode Reader. The Basler Vision Connector passes the camera image into the recipe through this input terminal pin.
  3. Connect the Texts output pin of the Barcode Reader to the output terminal and name that output terminal pin. The recipe payload publishes the decoded string under this pin name. To publish the barcode type as well, connect the Types output pin to the output terminal and name that output terminal pin.
  4. Name the input terminal pin that receives the camera image Image0_{UserDefinedPinID}, for example Image0_BarcodeCamera. Pin names are case-sensitive. See Naming of Input Pins.
  5. If the recipe contains a Camera vTool or an Image Loading vTool, deactivate that vTool before you upload the recipe. See Restrictions.
  6. To limit the area in which the Barcode Reader searches, add an ROI Creator vTool and connect it to the Roi input pin of the Barcode Reader.
  7. Save the recipe in pylon version 26.10 or lower.

Don't add AI vTools to this recipe. The Basler Vision Connector can't run recipes that contain AI vTools.

Use the Recipe in the Web UI#

Follow Using vTools in the Basler Vision Connector Web UI:

  1. Upload the .precipe file.
  2. Create a recipe instance.
  3. Open the camera in the Cameras list.
  4. Assign the open camera to the image pin of the recipe instance.
  5. Start image acquisition.
  6. Check the image in the image display area and the Message Log. The image display area shows the camera image, not the barcode result.
  7. Copy the recipe data topic shown in the Web UI after the pins are assigned, and subscribe to it from your application. See the Messaging Concept.

Use the Recipe via Messaging#

You can upload and run the same recipe with JSON messages:

  1. Upload the recipe.
  2. Create a recipe instance.
  3. Open the camera connection.
  4. Assign the camera to the recipe pin.
  5. Start image streaming.
  6. Subscribe to the recipe data topic. On ZeroMQ, the topic is cstm_recipe/{RecipeID}/data. On MQTT, the topic is {mqttRoot}/cstm_recipe/{RecipeID}/data. The payload format is described in Recipe Payload Format.

The full message list is in Recipe Support for vTools.

How You Know It Works#

  • The image display area shows a stable camera image.
  • The Message Log shows no recipe error.
  • Your application receives the decoded string on the recipe data topic, under the name of the output terminal pin connected to the Texts pin of the Barcode Reader.

JSON Test Files#

To try the messaging path in Flow Creator, start with Using the JSON Test Files with Industrial Edge Flow Creator. The test files are:

For a recipe, use the MQTT JSON test file with vTools.