Response Time Box

 

July 2010

I have been using the Response Time Box from Xiangrui Li. I found the demos all worked fine and it was easy to get up and running. I am, however, not planning to use it to record subjects’ responses with the buttons. I bought it for its photodiode, because I wanted to detect the precise time at which a light flash occurs.

RTBoxdemo_reportflashtimes.m is some demo code I wrote to detect light flashes. Thanks to Xiangrui Li for his advice. In particular, I learnt it’s key to have the photodiode in darkness; it will only detect one light event at a time; afterwards you have to clear it. So, if there is too much ambient light, it will already be detecting light, and so won’t see your flash. In the demo code, the flash consists of the entire screen turning from black to white for 1 frame; the photodiode is attached with its suction cup to the middle of the screen. The screen was entirely black apart from the flashes, but I still had to run this with a towel draped over the monitor to prevent ambient light getting to the photometer.

I found that the RTBox reported the flash as occurring, on average, 3.68ms +/- 1.22ms after PTB reported it (via the timestamp of the Flip command).

For purposes of testing the system, I have now attached the photodiode via its suction cup to the bulb of a desk lamp. I have draped this in light-excluding cloth. Now, when I flick the lamp on and off, the RTBox reports the time of the flash.

To get the RTBox ready, I use the following Matlab code:

1
2
3
4
5
6
7
8
ratio = RTBox('ClockRatio');
RTBox('enable','light'); % enable light detection for trigger, also open device if needed
% Stop RTBox responding to button-presses; I only want to know about light
RTBox('disable', 'release' );
RTBox('disable', 'press' );
RTBox('clear',0);
% Set time out to wait for response (in seconds):
timeout=1;

I then flick on the light, and read the time with:

1
2
RTBox('clear',0);
tRTB=RTBox('secs',timeout)

Xiangrui Li kindly added some helpful comments:

1. It is not a good idea to do RTBox(‘ClockRatio’) within each code, since it is time consuming. You can do it only once at Command Window. Normally you don’t need to do it unless the box loses power from USB.

2. RTBox(‘disable’, ‘release’ ) and RTBox(‘disable’, ‘press’ ) can be simplified into one line
RTBox(‘disable’, {‘release’ ‘press’});

3. RTBox(‘clear’,0) won’t synchronize clocks of RTBox and GetSecs, although it returns quickly. It seems to me you need RTBox to return GetSecs time, so the synchronization is necessary. You can use RTBox(‘clear’), i.e., omit the second input to perform synchronization. This will take about 0.3 second. If you like it to return faster, you can use a smaller number than the default 20, such as RTBox(‘clear’,5). This might explain the large variation (3.68 ms) you got. For CRT, that variation should be less than 0.1 ms or even better; for LCD, it depends on models, but is much larger than CRT.

4. After you do RTBox(‘clear’) or enable light detection, you can simply use RTBox(inf) to wait for the first light signal.

5. Although the suction cup can be used to attach the sensor to a monitor or other light source, it is better to tape it if you are going to measure for a long time. The small movement of the sensor over time will introduce bias to the measurement. Also, you can use some black tape to cover the outside of the suction if it absorbs light from outside.

Leave a Reply

Your email address will not be published. Required fields are marked *