TTL-Technology – Getting Things Talking to Each Other

A common issue in psychology research is getting various bits of hardware linked up in the right way. To take a simple example, I mentioned in this post that you can build a simple response box for your experiments, but (deliberately) neglected to mention what happens with the signals from the response box at the computer’s end. How does the computer ‘know’ that your participant has pressed one of the keys? The answer is TTL (Transistor-Transistor-Logic) signals. TTL signalling was invented back in 1961, and intended as a standard way for a piece of electronic equipment to send bipolar logical signals (i.e. 1=on and 0=off) to another piece of equipment. Long before ethernet, the internet or TCP/IP, this was how computers communicated with each other. TTL-type signals can be presented through most computer’s parallel and serial ports.

Standard Computer Parallel Port

Standard Serial Port

Why do we (as psychologists) care about TTL logic? Say for instance you’re doing an experiment which involves recording a subject’s eye movements, while they’re looking at a series of images. You want to know how their eye-movements differ when they’re looking at say, happy vs. sad images. You have one computer which will present the images on its monitor for the participant to look at, and you have an eye-movement camera hooked up to another computer which is running some specialised software which will record their pattern of eye-gaze while the images are on the screen. In order to be able to sensibly analyse the data you need to know which eye-movements were conducted while a happy picture was on the screen of the first computer, and which were conducted while a sad picture was up – in other words, you need to co-ordinate the presentation of each picture with your recording of the eye-movement data – you need the two computers to talk to each other.

Assuming you’ve written a program to present the pictures in a sensible way (and I’m going to cover good tools for writing presentation programs in a future post, as soon as I get up the requisite courage) you might string a cable between the parallel ports of the two computers, and tell your presentation program to send a TTL pulse on one pin of the parallel port every time it presents a ‘happy’ picture. This signal could be received by the other computer, a code generated, and logged with the eye-movement data for that trial. When a sad picture is presented a TTL signal could be sent using a different pin of the parallel port, and would be received and logged in the same way, but with a different code for the trial. Later, when you come to analyse your eye-movement data, you know exactly which trials are which by the codes logged with the data.

The possibilities for this kind of thing are endless – I’ve used TTL signals to record responses, synchronise the start of a program with the scanning cycles of a MRI scanner, and control external equipment used for electrical stimulation. Synchronising stimuli presentations with a MRI scanner in fMRI experiments is a very common usage, and most models of scanner put out TTL signals (or TTL-like signals, often using optical fibres) at the start of every scan for that exact purpose.

A problem nowadays is that more and more computers are being made without the old-style serial and parallel ports, since nearly everyone has moved to the new standard connection which is USB. USB is ‘better’ in lots of ways, but not in this respect. Fortunately, add-in cards for desktop systems are still being made which can give you the old-style ports. The only solution if you want to do TTL-stuff with a laptop is to use a USB-parallel/serial port converter. This might be hard to get working in the right way, and I’d be very leery of using one of these for any timing-critical stuff.

Links:
More than you could ever possibly want to know about TTL, here.
A nice optical-fibre response-box for fMRI studies that uses TTL inputs/outputs here.
The help files for Inquisit (my current favourite way of programming experiments) contain a load of good information about reading and presenting TTL signals through the parellel/serial ports – worth a read, even if you don’t use Inquisit.

TTFN.

Advertisements

About Matt Wall

I do brains. BRAINZZZZ.

Posted on May 16, 2011, in Experimental techniques, Hardware and tagged , , , . Bookmark the permalink. 1 Comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: