Networked Eye Tracker & Joystick

This page is for custom-made devices. For commercial TCP/IP eye tracker products, see this.

Custom eye trackers and joysticks can be interfaced with NIMH ML via Ethernet. Choose "UDP/TCP Joysticks" or "My EyeTracker" in the [Other device settings] menu.

Those who want to connect their networked eye tracker or joystick to NIMH ML should provide either a UDP client or a TCP server, which means that NIMH ML will serve as a UDP server or a TCP client. The frequency of data update is dependent on how often packets are sent to NIMH ML.

If UDP is used, the firewall of the NIMH ML computer should allow inbound traffic for the speficied port (or to the MATLAB).

For TCP communication, NIMH ML will send "ok" first when it is ready to receive a new packet. See the attached example code below.

UDP/TCP Joystick

    Make a string of comma-separated values (CSV) with joystick X & Y coordinates and button states. Then send it to NIMH ML. The total length of a packet must be 512 bytes or less.

    Format: "joyX, joyY, button1, button2, button3, ... , button32" (do not include quotation marks)

    • joy X & Y: integers between -10000 and 10000
    • buttons: 1 - pushed, 0 - released

    • The maximum number of buttons is 32.

    Example: "-500, 300" (XY only), "1000, -250, 0, 1" (XY & 2 buttons)

    Code: UDP_example TCP_example

My EyeTracker

    Send eye X & Y coordinates and extra eye measures in the CSV format. The total length of a packet must be 512 bytes or less.

    Format: "eye1X, eye1Y, eye2X, eye2Y, extra1, extra2, extra3, ... , extra10" (do not include quotation marks)

    • eye X & Y: single-precision floating-point values (floats) between -10 and 10
    • extras: floats

    • It is okay that XY values go below -10 or above 10, but their traces may not be shown on the screen until the calibration is completed.
    • eye2X & eye2Y must be filled. Put just 0, if they are not needed. They will be discarded if the binocular option is not checked.
    • There is no limit in the number of extra parameters sent in the packet, but NIMH ML will pick up only up to 10, for a practical reason.

    Example: "-1.534, 2.378, 0, 0, 3.231" (eye1 XY & pupil size)

    Code: UDP_example TCP_example

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.