Synchronizing multiple computers for experiments

In many rigs, multiple computers are used, and they need to talk to each other. For example, one computer handles the imaging, another the electrophysiology, and yet another handles the sensory stimulation; and they all need to be synchronized. There are several ways to handle this.

Digital I/O via DAQs

This is typically the most straightforward solution, but requires that there is some sort of DAQ for each computer. You can use something very simple, like a parallel port interface. Parallel ports are very old fashioned, but they’re still standard issue on most full-sized motherboards (see image above). Wire up the each data pins to a separate BNC and you have an extremely inexpensive digital I/O (the pinout is on Wikipedia and elsewhere on the net). The logic is a TTL-like 0-5v, however, beware that motherboards will vary quite a bit in their logic-high voltage level, and they typically can only source a small amount of current, 10-20 mA. So don’t try to split the signal to a bunch of different devices. (more info).

Alternatively, you can buy an inexpensive USB DAQ. For example, Measurement Computing‘s boxes are supported by MATLAB’s DAQ Toolbox. On that topic, let me briefly mention Dennis Pelli’s excellent MATLAB toolbox for controlling Measurement Computing’s USB-1208FS. It’s one of the simplest ways to do data acquisition in OSX using MATLAB. And be sure to read his explanation about why he programmed it up. It has more to do with the Second Amendment than you might expect. (link)

Ethernet connections

This approach has the advantage of using something that most computers have built in: an ethernet port. There are several protocols that ride on IP networks. You’re probably most familiar with TCP, but only slightly less well known is this: UDP. This is the protocol used for DNS queries. This is a leaner, faster way to send short messages to synchronize computers in an experimental setup. It’s not as tight as using a direct pulse to a DAQ, but it’s fast enough for most applications. The big advantage is that it’s pretty simple to send configuration data in addition to a simple trigger pulse via UDP. Several scientific software packages directly support UDP (e.g., here’s MATLAB’s UDP function).

Single computer solution

Getting programs to talk to each other
Even when a single computer is used, there may be multiple programs that need to talk to each other. In the first intrinsic imaging rig I built, I wrote my own OpenGL-based visual stimulation program which ran on the same computer as the imaging software (pdf). Both programs were written in C++ using Visual Studio. In order to get the two computers to talk to each other, I used custom Windows messages. Most modern operating systems have a messaging system where individual processes can send and receive messages. I was able to use this to pass messages between the two programs. If you want to do the same thing, and are already comfortable dealing with Windows messages in C++, this link can get you started.