3 degrees of freedom: gyroscope to PC

Gyroscopes can measure rotations. It would be great to make such measures easily accessible to response latency experiments. I now managed to connect a gyroscope to my PC via an Arduino. I used components from Seeedstudio: a Xadow Arduino main board, a Xadow 6DOF unit that has an accelerometer and a gyroscope, an additional breakout board to connect an additional pin, and software from ic2devlibs.

Below are some photos showing how the “head” on the screen responds to rotation of the sensor (which is placed on the small white board in my hand). Next to the head, the rotation angle (up vs. down pointing of the nose) is displayed. This can easily be saved along with timestamps. There is also a video displaying the connection.

2014-02-13 15.01.55 2014-02-13 15.01.51 2014-02-13 15.00.58 2014-02-13 15.02.28 2014-02-13 15.02.25

testing processing 2

this is a graphical equivalent of the processing test. If processing would measure to the millisecond, the dots would be set with almost no blanks in between – ideally you would see a white screen in the end. Instead, what I always see are lines. This shows that the measurement is rounded. In addition, there are “wholes” showing that during these times, the measurement got even worse, with less accuray.

timetest

testing processing 1

a quick timing test of processing. It measures the latency between two draw cycles for different frameRates. The test shows on all computers that we used that millis() seems to measure not continuously, but in steps of 10-15 ms, depending on the computer. In other words: every time measured with millis() will be rounded up or down to the nearest 10 or 15 ms.

Note: download the processing code and run in the processing environment on your computer to see the full output. The output to the screen may be cut of.

on my machine (old ibm thinkpad running win xp), the output looks like this – you clearly see the jumps of 10 ms irrespective of the frameRate

Rate was 60
0 337x
10 641x
11 9x
20 9x
21 1x
30 2x
60 1x
——————————————–
Rate was 100
0 12x
10 955x
11 15x
——————————————–
Rate was 200
0 446x
10 542x
11 8x
20 4x
——————————————–
Rate was 500
0 779x
10 203x
11 2x
20 7x
30 3x
40 4x
50 2x
——————————————–
Rate was 1000
0 848x
10 147x
11 3x
20 2x
——————————————–