Reading in data from the photometer

Anya Hurlbert has very kindly lent me her Minolta LS-100 photometer. I bought a connection lead (LS-A12) to connect it to the serial port of the PC. Here are some useful tips I picked up on doing this.The Psychtoolbox (PTB) documentation says you should run PTB with Matlab in “No Java Virtual Machine” (-nojvm) mode. However, you need the JVM in order to read the serial port in Matlab. So I took my initial measurements not using PTB: just putting up a Matlab figure window over the whole screen, and setting the figure colour to the appropriate shade of gray, and reading in from the photometer. Later, when I wanted to use the PTB gamma look-up table function, I discovered that you can actually use PTB very well in JVM mode — it crashed occasionally, but basically seemed to work. So that’s what I did.

To use the photometer in PC mode, first turn off both PC and photometer, and connect the cable to the serial port (COM1 in the example below). Then you have to hold down the button labelled “F” while turning the power switch to on. The photometer display should now have a “]” symbol after the “cd/m2” on the right of the screen. This means the photometer is ready to send data to the PC. To read the luminance value, you first need to send the word “MES” to the photometer.

Here’s an example of the Matlab code needed to read data in:

1
2
3
4
5
6
7
8
9
10
11
12
% Open serial port for reading
port = serial('COM1', 'BaudRate',4800,'databits',7,...    'parity','even','stopbits',2,'terminator','CR/LF','FlowControl','hardware');
fopen(port);
% Take a measurement 
fprintf(port,'MES');
[line, nlin] = fscanf(port);
j=min(findstr(line,' '));
val = str2num(line(j+1:end));
if isempty(val)
    val = 0;
end
fclose(port);

The variable “val” should then contain the reading from the photometer (or 0 if this failed). Before reading each value, you have to send this ‘MES’ command again. Thanks to Bruce Cumming and Boris Sheliga for this information!All the measurements shown on the pages about gamma correction and ghosting were taken automatically via the serial port. The lab was unoccupied and in complete darkness apart from the light from the projector being measured (the other projector was generally switched off while the measurements were being taken).