Raspberry Pi for research labs (2) Connecting an accelerometer
We recently used a smartphone to measure participants’ head motion during an NIRS experiment and got decent results. Smartphone is easy to use, but its size is relatively bulky on participants’ head. Is it possible to use a much smaller device?
In this summer, Joe Baker and Semir Shafi in our lab at Stanford tackled this problem with Raspberry Pi and a standard alone accelerometer. Raspberry Pi costs ~$40 and the accelerometer costs ~$20. So the total investment is ~$60. Not bad.
The accelerometer was purchased from adafruit.com. The size of the accelerometer is like a quarter, fairly small and would have no effect on a participant’s head.
Semir connected Raspberry Pi, the accelerometer, a monitor and a keyboard/mouse. He then developed a python program to read the data from the accelerometer and displayed it in real time.
How did it work? Let’s see a real demonstration by Semir. As you see in the video, while the program is running, Semir took the accelerometer back and forth. The x, y, and z data from the accelerometer is displayed on the screen in the real time.
According to Joe, this accelerometer can capture data at 100Hz, much faster than a smartphone’s accelerometer. Besides, it’s easier to integrate with other devices because Raspberry Pi is highly programmable. For example, it is possible to trigger the measuring with an external program so different data sources can be synchronized.
What is more, it’s possible to integrate Raspberry Pi/Accelerometer system with a tablet (e.g. Microsoft Surface or iPad, or even a smartphone). This will make the system much easier to use.