Skip to main content
All CollectionsIntegrations
LabVIEW Integration
LabVIEW Integration

How to configure the LabVIEW Integration.

Updated over 5 months ago

Epsilon3 can integrate with LabVIEW via our Realtime Client for both reading data from LabVIEW as well as sending data and performing actions in LabVIEW.

There are several ways LabVIEW can interact with external software such as TCP/IP, Shared Variables, OPC, DLL/SO, and Web Services. This guide will go through how to set up Web Services.

To Read Data From LabVIEW

  1. Create a VI in LabVIEW

    • Open LabVIEW and create the VI that performs the desired functionality. Name it something relevant (e.g. ReadSensorData.vi).

    • Add the necessary code to interface with your sensor and obtain the current reading. This typically involves using the appropriate hardware drivers and LabVIEW functions to communicate with the sensor.

  2. Configure the VI to Output the Sensor Data

    • Set the VI to output the sensor data. For simplicity, let’s assume the sensor data is a single numeric value.

    • Create an indicator on the front panel for the sensor reading and wire it to the output terminal of the VI.

  3. Configure LabVIEW Web Service

    • Right-click on your LabVIEW project in the Project Explorer and select New > Web Service.

    • Name your web service appropriately (e.g., SensorWebService).

  4. Add the VI to the Web Service

    • In the Project Explorer, right-click your web service and select Add > VI.

    • Add ReadSensorData.vi as a method (operation) of the web service.

  5. Configure the VI as a Web Method

    • Right-click the newly added ReadSensorData.vi under your web service and select Define as Web Method.

    • Configure the HTTP method (typically GET for retrieving data), input/output parameters. and set the URL mapping (e.g., /ReadSensorData).

  6. Deploy the Web Service

    • Right-click the web service and select Deploy.

  7. Accessing the sensor data from the Realtime Client

    • Now that everything is set up in LabVIEW, you can use the python code below to access the sensor data from the Realtime Client. For quick testing you can also paste the URL into a web browser (Assuming the HTTP method was set to GET). Make sure to replace the <LabVIEW_server_IP>, <port>, SensorWebService and ReadSensorData with the values relevant to your project.

import requests

url = "http://<LabVIEW_server_IP>:<port>/SensorWebService/ReadSensorData"
response = requests.get(url)

if response.status_code == 200:
print("Response from LabVIEW:", response.text)
else:
print("Error:", response.status_code)

To Perform Actions in LabVIEW

  1. Create a VI in LabVIEW

    • Open LabVIEW and create the VI that performs the desired functionality. Name it something relevant (e.g. ControlValve.vi).

    • Add the necessary code to perform the action, such as opening or closing a valve. This typically involves sending a command to the hardware controlling the valve.

  2. Set the VI to Accept Input Parameters

    • Create a control on the front panel for the input parameter (e.g., a Boolean control to represent opening or closing the valve).

    • Wire this control to the part of the code that sends the command to the valve hardware.

  3. Configure LabVIEW Web Service

    • Right-click on your LabVIEW project in the Project Explorer and select New > Web Service.

    • Name your web service appropriately (e.g., ValveControlService).

  4. Add the VI to the Web Service

    • In the Project Explorer, right-click your web service and select Add > VI.

    • Add ControlValve.vi as a method (operation) of the web service.

  5. Configure the VI as a Web Method

    • Right-click the newly added ControlValve.vi under your web service and select Define as Web Method.

    • Configure the HTTP method to POST (typically used for sending commands or data to the server) and set the URL mapping (e.g., /ControlValve).

  6. Configure the Input Parameters:

    • In the Web Method Properties, specify the input parameter (e.g., a Boolean valveState for the valve state).

    • Ensure the parameter is mapped correctly to the front panel control of ControlValve.vi.

  7. Deploy the Web Service

    • Right-click the web service and select Deploy.

  8. Accessing the sensor data from the Realtime Client

    • Now that everything is set up in LabVIEW, you can use the python code below to control the valve from the Realtime Client. Make sure to replace the <LabVIEW_server_IP>, <port>, ValveControlService and ControlValve with the values relevant to your project.

import requests

url = "http://<LabVIEW_server_IP>:<port>/ValveControlService/ControlValve"
# Set to True/False to open/close the valve
data = {'valveState': True}

response = requests.post(url, json=data)
if response.status_code == 200:
print("Command sent successfully")
else:
print("Error:", response.status_code)

Additional Notes

  • Single Web Service: You can group multiple VIs under one web service for better organization and manageability.

  • Multiple Endpoints: Each VI is exposed through its own endpoint within the web service.

  • HTTP Methods: Configure each VI with the appropriate HTTP method and URL mapping.

  • Deployment: Deploy the web service to make it accessible for external clients.

Relevant links

Did this answer your question?