KB0059: Sending UDP Commands to BioLab from E-Prime

First introduced in BioLab 3.3.0, UDP Commands are a mechanism by which you can start acquisition, stop acquisition, and log events via a network interface. These UDP commands can be sent from any source capable of opening a UDP port and sending data. This article will focus on how to send these commands from the E-Prime stimulus presentation software by Psychology Software Tools, Inc. (PST).

Note: UDP commands to BioLab are subject to network and processing delays and are not a substitute for external trigger and event lines when precise timing is required.


 

UDP Commands Overview

There are 4 UDP commands available, which need to be sent to the computer running BioLab on port 1776:

START – Starts BioLab acquisition

STOP – Stops BioLab acquisition

E:Event Source,Event Value,0 – Logs an event. It consists of 3 fields:

Event Source is used to group similar events.

Event Value is a unique value describing an instance of an event.

0 denotes the end of an event command.

PING – Checks if BioLab is listening for UDP commands. BioLab will respond with PONG

Note: Commands must be sent one per packet, exactly as defined, with no newline or other characters included.

More information on UDP Commands can be found in the BioLab User Guide.


 

Setting up a Socket Device in E-Prime

First, open the experiment file you want to use to send UDP commands in E-Studio. Double-click the top level Experiment Object to open the Experiment Object Properties. Next, click the Devices tab and press Add… to set up a new device.

From the Devices page, choose the Socket device type and press OK to add it.

Once added, double-click it in the Devices list to edit it. You should name it something to identify it as the device used to send BioLab UDP commands. Set Server to the machine address where BioLab is running, Port  to 1776, and Connection Type to UDP.

Then press OK to save these changes. Finally, press OK again to close the Experiment Object Properties screen. The network device is now set up and ready to use.


 

Sending UDP Commands Using Task Events

Task events allow you to perform a task at a specified time in reference to the presentation of an E-Object in the experiment. This is the mechanism we will use to send UDP commands using our newly configured Socket device.

Double click the E-Object from which you want to send UDP commands, and click the Property Pages button to launch the properties for that object. For this example we are using a Slide object.

Navigate to the Task Events tab and press the Add… button to create a task event.

You can set your task event to occur at a variety of times within the duration of a slide. For this example, we are going to use OnsetTime, meaning this event will occur at the onset time of this slide. Double click the desired event type to return to the Properties page.

Back on the Properties page, we now need to specify what action will occur with the onset of this slide. Click the  button to choose which device to use in this event.

Select the Socket device we set up earlier by double clicking it.

All UDP commands are text-based, so we want to select the WriteString option from the Action selector.

Next, change the Data Type to String

At this point we can fill in our command in the Custom field. We can start acquisition

stop acquisition

and log events

Press OK to finish setting task events for the slide.  Do this for as many UDP commands you want to send throughout the experiment.


 

Setting Up UDP Commands in BioLab

To configure BioLab to receive UDP commands, launch BioLab and navigate to the Events tab on the Configuration screen.

Next, navigate to the Network Events sub-tab and enable the UDP Events button.

BioLab is now configured to start, stop, and log events from UDP commands.

Note: When using hardware triggering, the START command is disabled

Was this article helpful?

Related Articles