After the discussion a week or so ago regarding timing over USB with SuperLab, I decided to enlist the assistance of an entity I call “RoboSubject” to see if any light could be shed on the situation. Hisham had stated that the expected variability in timing would be on the order of ± 10-12 ms; this seemed large to me, but I wanted to find out more.
RoboSubject is a “Basic Stamp” with a photoresistor and a reed relay. The photoresistor is fed into a voltage comparator. When running, the photoresistor points roughly upwards so that it touches the place on a folded-down MacBook Pro screen where a stimulus consisting of a “=” sign is presented. The comparator is biased so that it is triggered by the difference in light between the presence and absence of the stimulus.
The reed relay is connected to a switch input of one of our X-Keys USB Switch Interface boxes, which is what we have been using to gather experimental data.
The Stamp is programmed to wait for a stimulus onset, then pause for a programmed number of milliseconds, and then close the relay. After 100 ms (I also tried 75 ms and 250 ms for the button press duration), it opens the relay, and waits for the stimulus to go away before looping back again.
The Basic Stamp is no ball of lightning, but it is fast enough for this purpose. I ran it several times with different RTs programmed, and here are a couple of typical results:
At 300 ms programmed RT, the mean was 411 ms (!), with a range of 21 and an SD of 5.0. At 500 ms, the mean was 605, the range 33, and the SD 6.2 ms.
I believe that the extra 100+ ms is a function of the switch interface, but it’s really strange. Why would it wait ~100ms to send the key code? Some kind of aggressive debouncing? In any case, it seems to be roughly a constant.
Some of the constant lag could be due to the position of the stimulus on the screen, but that couldn’t account for more than about 1/4 of a vertical period, since it was about 1/4 of the way down (unless LCDs scan differently from CRTs, which I guess is possible).
The more important and interesting numbers are the range and SD, which are roughly of the magnitude suggested by Hisham. There seems to be a tendency for the variability to increase with longer RTs, I don’t know why this would be the case. I suppose some of this could be the product of my instrumentation, for example variability in the relay closing or the comparator triggering, or in the timing within the Stamp. I suppose I’d feel more comfortable about the timing if I could glue the photoresistor to the screen, but I’m not going to do that with my Macbook Pro.
I’m putting RoboSubject away for now, but I’ll undoubtedly resurrect him/her at some future point. For one thing, I’d like to figure out what’s going on with the X-Keys box and that ~100 ms constant delay. Or is this a general USB or HID phenomenon? For another thing, I think it might be better to set up the Stamp to deliver several different RTs in the same run so that extraneous factors such as the exact positioning of the photoresistor would not change. As it is now, I have to open the Macbook, start the next Superlab run, then close down the lid so it touches the photoresistor. Small differences in positioning could change the sensitivity of the stimulus detection enough to account for the small differences I’m seeing between runs.