Generic Device
Review the following information for setting up and configuring the Generic Device driver. The Generic Device driver is a user-configured client driver which connects to TCP, UDP, or serial servers such as sensors, scales, or barcode scanners. Use this driver to build requests or commands to send to servers, or receive and parse streaming data from servers.
Manufacturing Connect Edge Compatible Series
Compatibility parameter | Compatible items |
|---|---|
Driver type | Ethernet (TCP, UDP), Serial |
Validated devices/series | Generic TCP servers, Keyence SR-750, Parker SensoNODE Receiver |
Replaces Gen 1 driver(s) | N/A |
To set up and configure this device in Manufacturing Connect Edge, you will need to do the following:
- Step 1: Set up and Configure the Device
- Step 2: Set up the Device in Manufacturing Connect Edge DeviceHub
- Step 3: Configure the List of Registers
Step 1: Set up and Configure the Device
Ensure the device is configured for TCP/UDP/Serial access and find its communication parameters, including:
- IP Address and Port number
- Serial communication parameters
- Any required connection payload to establish connection with the device
Step 2: Set up the Device in Manufacturing Connect Edge DeviceHub
Configure the following parameters when you Connect a DeviceConnect a Device with this driver. Update default values to the specific setup of your device.
Parameter | Value |
|---|---|
Type | Generic |
Driver | Generic Device |
Transport | TCP UDP Serial |
IP Address If TCP or UDP is selected | The device IP address you recorded in Step 1. |
Port If TCP or UDP is selected | The device port number you recorded in Step 1. |
Device File If Serial is selected | The file of the serial port you are using. |
Baud Rate If Serial is selected | 1200 2400 4800 9600 19200 38400 57600 115200 230400 460800 921600 |
Data Bits If Serial is selected | 5 6 7 8 |
Stop Bits If Serial is selected | 1 1.5 2 |
Parity If Serial is selected | Even Mark None Odd Space |
Connection Request | Enable/disable Connection Request. If enabled, this field is used to enter the command that is required by the device to initiate the connection |
Protocol Byte Order | BigEndian (bytes-little): BADC BigEndian: ABCD LittleEndian (bytes-big): CDAB LittleEndian: DCBA |
Data Byte Order | BigEndian (bytes-little): BADC BigEndian: ABCD LittleEndian (bytes-big): CDAB LittleEndian: DCBA |
Multiple Connections If TCP or UDP is selected | Enable/disable for multiple streams |
Enable TLS If TCP is selected | Enable/disable TLS encryption |
Step 3: Configure the List of Registers
When you Add TagsAdd Tags to the connected device, refer to the following register table and tag parameters. Refer to the following additional resources:
- Organize Device and Tag Data by Using MetadataOrganize Device and Tag Data by Using Metadata
- Tag Formula VariablesTag Formula Variables
Register Table
Name | Value Types | Access Type | Description |
|---|---|---|---|
Poll - Poll Request | uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, []byte | R/O | Poll Request - Sends a request and reads the response from the device at regular polling intervals or when triggered |
Write - Write Request | uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, []byte | R/W | Write Request - Sends a write command to the device when triggered |
Stream - Stream Request | uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, []byte | R/O | Stream Request - Listens for unsolicited data from the device |
Response - Linked Response Value | uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, []byte | R/O | Linked Response Value - Parses additional value from existing Poll/Stream requests. This tag is useful when a single poll/stream response contains multiple values and you want to parse each one separately |
Tag Parameters
- Name: Select a register name from the drop-down list. The available options depend on the names in the register table.
- Value Type: Select a data type from the drop-down list. The available options depend on the register name selected. Supported types include: uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, string, []byte.
- Polling Interval: Enter a value in seconds. This determines how often the tag should poll the register for data.
- Tag Name: Enter a name for the tag.
- Description (Optional): Enter a description for the tag.
- Payload: Enter the command/request that needs to be send to the device in hex string or ASCII format. Refer to the following examples:
- If you want to send a command TEST with command terminator \r to the device, in the payload, enter "TEST\r", or "TEST" 0D, or 544553540D. Make sure that the value type is string.
- Request Params: Enter the request params formatted as JSON. This field is used to enter address or area code that can be used in request. This field should be kept empty if no request params are needed and user just needs to send command.
- Example: {"addr": "0007"}
- Response Index: Enter the start index of values within response.
- Value length: Enter the length of single value in bytes (0 for entire response).
- Response terminator: Specifies the characters or byte sequence (for example \r\n) that indicate the end of the device response.
- Include Terminator: Enable to include the response terminator in the value.
- Response Max Length: Input the largest full response frame size driver is allowed to read from socket before parsing stops (0 for unlimited).
- Override Transport: Enable to define alternate endpoint for single request. Note connection of override transport is not persistent.
- Tag Formula: Enter a formula for the tag to process the generated data. Two variables are permitted: value (current tag value) and timestamp (current tag UNIX time in milliseconds). The following math functions are available:
- sin
- cos
- sqrt
- tan
- power: power (x) performs the operation 10^x
- log: log(x) is the natural logarithm (the logarithm is in base e)
- exp: exp (x) performs the operation e^x
- Only Publish on Change of Value: Select the checkbox to customize NATS messages to be published only when the value parameter changes to a new one. Change of Value only applies to boolean, numeric (such as int or float), and simple string data types. It does not apply to complex types, such as JSON or array. Poll-once topics will not be affected by Change of Value settings. These topics will still only see a single message.
- Meta Data: Metadata summarizes basic information about data. This feature allows you to define key-value pair data for the device output payload later on. It can then be used to find, use, and reuse particular instances of data.
- Note: If you use special characters in meta data key names, the special characters are replaced with underscore characters in the payload. This can cause two key names to be combined into one. For example, configuring the key names a**b and a&&b will cause only one key name to be created (a__b).
Example: Send a Print Command to a Barcode Printer
The following example shows how to configure the Generic Device driver to send print commands to a TCP-enabled barcode printer.
Step 1: Set up and Configure the Device
Ensure the printer is connected to your network. Collect the following:
- The printer's IP address and port number
- The print command and syntax required by the printer's language (for example, ZPL, IPL, or DPL). Refer to your printer's documentation.
- The response terminator used by the printer (for example, \r\n)
Step 2: Set up the Device in Manufacturing Connect Edge DeviceHub
Configure the following parameters when connecting the device:
Parameter | Value |
|---|---|
Type | Generic |
Driver | Generic Device |
Transport | TCP |
IP Address | Your printer's IP address |
Port | Your printer's port number recorded in Step 1 |
Step 3: Configure the Tag
Add a tag to the device with the following parameters:
Parameter | Value |
|---|---|
Name | Write - Write Request |
Value Type | string |
Payload | The print command for your printer enclosed in quotation marks "". For example, if the printer uses PRINT as its print command, enter "PRINT". |
Response Index | 0 |
Value Length | 0 (0 for entire response) |
Response Terminator | The terminator used by your printer (for example, \r\n) |
To trigger a print, publish to the write topic of the configured tag.