The OpenBCI V3 board does more than just EEG. Yes, I’ve already shown examples of doing ECG and EOG with my old V1 and V2 boards, but the new V3 board includes an accelerometer, which the old boards did not have. How could an accelerometer be useful? Well, you could use it to sense orientation (or change in orientation) of the head as part your BCI. Or, you could use it to sense rough motion, which might suggest that you’ll have motion artifacts in your EEG data. Or, you could sense yourself tapping on the board as a way to introduce markers during your data collection. There are many possibilities! Today, I’m going to look at the accelerometer data for the first time.
OpenBCI V3 Board with Batteries |
Setup: I used my OpenBCI V3 Board (see picture above) as delivered from OpenBCI. On the OpenBCI board, I was running the same software as was shipped by OpenBCI in November, 2014. The OpenBCI board used its wireless link to the PC. On the PC, I ran the OpenBCI GUI in Processing. The GUI logged the data to a file.
Procedure: I inserted the batteries to my OpenBCI board to give it power. I started the OpenBCI GUI to begin recording data. Holding the board in my hand, I completed the following maneuvers:
- Start with board flat and level (z-axis points up, like in the picture at the top)
- Roll it 90 deg to the right (x-axis points down) and 90 deg left (x-axis points up)
- Tip it nose down (y-axis points down) and nose up (y-axis points up)
- Flip it upside down (z-axis points down)
Notice the markings on the OpenBCI board (zoomed picture below) that indicate the direction of the accelerometer’s axes.
The accelerometer is the small black square towards the bottom. Note that “X” points right, “Y” points forward, and “Z” comes up out of the board. |
Data Files: The 3-axis accelerometer data was saved to a text file by the Processing GUI. I analyzed the data using Python. The data and analysis files are available on my EEGHacker repo on GitHub. If you use this data, be sure to unzip the ZIP file in the SavedData directory!
Analysis: The specific goals of this analysis are to confirm that the data is well behaved, that the correct axes are responding to the known motions, that the units are correct, and that the scale factors are correct. I used an IPython Notebook to step through each one of these analyses. You can see the IPython Notebook here.
Results, Data Continuity: The first thing I did was to look at the data to make sure that it was well behaved. The most important part of being well behaved is that the data is continuous. Looking at the packet counter in the data file (a counter which is transmitted by the OpenBCI board), there were no missing data packets. Excellent. I did see however that accelerometer data is only included in every 10th or 11th data packet. Why? Well, looking at the code on the OpenBCI board, it has configured the accelerometer to only produce data at 25 Hz. So, compared to the 250 Hz sample rate for the EEG data (which then drives a 250 Hz rate for data packets), we see why we only get acceleration values every 10th or 11th packet. It makes sense. Good.
Results, Individual Axes: After ensuring that the data was continuous, I looked at the data values themselves. I plotted the acceleration values as a function of time. The plots below show the values recorded from each of the accelerometer’s three axes. As can be seen, the signals clearly reflect the maneuvers defined in my procedure. Additionally, from these plots, we learn that negative acceleration values result when the accelerometer’s axis is pointing down (relative to gravity) and positive values result when the axis is pointing up. This polarity information is important if you wish to use the accelerometer data to estimate the orientation of the OpenBCI board.
Acceleration Values for the Accelerometer’s Three Axes. The three channels correspond to the X, Y, and Z axes. |
Results, Scale Factor: With the behavior of the 3 axes shown to be reasonable, I then wanted to confirm that the magnitude of the values were correct. I wanted to make sure that the scale factors used for interpreting the raw values was correct. The quickest way for me to confirm the scale factor was to compute the magnitude of the 3-axis acceleration vector. When the device is at rest, the magnitude of the measured acceleration should equal gravity, which is 1.0 G. As you can see below, the magnitude of our acceleration was generally close to 1.0 G (though often a little high), except when it was moving during its transitions between positions. This is good.
The magnitude of the 3-axis acceleration vector should equal 1.0 G when at rest. Ours equals about 1.044 G, which is within the known offset error bounds of the device |
When I look very closely at the values, it appears that the typical reading is actually 1.044 G instead of 1.000 G. There is a 44 mG difference. Is this unexpected? Well, yes, it was unexpected at first. And then I read the datasheet. Always look at the datasheet. In this case, it reports that the accelerometer should have a typical offset error of 40 mG per axis. For a 3-axis device, this could result in sqrt(402 + 402 + 402) = 69 mG of error on my magnitude value. As a result, my 44 mG value appears to be in-line with the device’s advertised performance. That’s satisfying.
Conclusion: With this test, I confirmed that my accelerometer is sending well-behaved data, with all three axes responding appropriately, with the correct scale factor. These are good results and I’m pleased. Now it’s time to figure out something fun to do with the accelerometer!