5. Accepted Technical Design
5.2. Software Design
5.2.8. Mobile Application and Matlab Script
The mobile application is based on the Microchip Bluetooth Data application, which is provided by Microchip and has source code publicly available for download at the link found at
"Bluetooth Low Energy" in the references. This source code was downloaded and compiled so that a working Bluetooth application could be used as the basis for mobile application
development for this project. The mobile application was only modified briefly to allow it to automatically save any Bluetooth communications received to a text file. This text file can then be exported to the Matlab script to process any impact data received. The code for the mobile application is complex and the changes made were minimal, so the code is not shown in this report. For the original source code, see "Bluetooth Low Energy" in the references. [NL, JM]
The initial design for this project intended to implement the code within the Matlab script in the mobile application. It was determined that a Matlab script should be exportable using Matlab's Compiler SDK, which compiles Matlab code for other languages such as C++ and Java.
In theory, the content in the Matlab script should be implemented within the mobile application, but this has been left for future work; see section 10.1.5 for more information. For the purposes of this design report, the Matlab script and mobile application are often used interchangeably since the Matlab script is designed to be exported into the mobile application. [JM]
The Matlab script processes the impact data recorded by the microcontroller onto the microSD. The impact data file can be extracted from the microSD via a microSD to USB converter and then placed in the same folder as the Matlab script so it can be called within the code. In theory, the impact data file could be sent over Bluetooth and then called by the Matlab script within the mobile application, but this has been left for future work. The Matlab script processes the impact data, separating each impact as well as the linear accelerations and angular
rates within each impact. The script calculates resultant linear and angular acceleration as well as the HIC and GSI for each impact. The peak linear and angular accelerations and the HIC and GSI are used to determine a PCS score for each impact. These scores are analyzed using results from the study of nearly 300,000 impacts by Greenwald et. al. and an approximate positive predictive value (PPV) is determined for each impact. This value describes the likelihood that an impact at the recorded PCS value or higher would result in a concussion. The multiplication of (1-PPV) for each impact yields the approximate likelihood that no concussion occurred across all recorded impacts. Finally, one minus this result gives the likelihood that at least one concussion occurred within the impact data. This value is an approximate concussion risk value. Note that this value is approximate and is designed to give the user an approximation of how likely it is that they sustained a concussion during a session; it should not be treated as an accurate medical likelihood of concussion. [JM]
The Matlab script also provides histograms of the recorded data. For the purposes of this project, all recorded linear and angular accelerations are shown in histograms since the sample size of impacts was often small for demonstrations of the headband impact recording system.
Additionally, the HIC and GSI are shown for each impact. [JM]
To demonstrate the concussion risk calculation, a botched sample set of data was created.
The sample set contained three impacts. The first impact contains values that are just over the accelerometer's recording threshold, but do not reach values that should indicate any risk of concussion. The second impact contains some values that are relatively large and should indicate some concussion risk. The third impact is a copy of the second. The results of this simulation, including the positive predictive values for each impact, are shown below. For the full code of the Matlab script, see the appendices in section 12.2. [JM]
Figure 5.2.8.1: Matlab script result using a botched dataset intended to demonstrate the concussion risk calculation. Here, three impact data sets were manually created to demonstrate the concussion risk calculation in the case of high acceleration impacts. Note that the concussion risk is nonzero because the impacts contained linear accelerations and angular accelerations with high magnitudes, as indicated in the figures. Also note that the positive predictive values for the
second and third impact are identical, as expected. [JM]
The results of the Matlab script when run upon three impacts recorded by the headband prototype in the demonstration are shown below. Note that since the impacts were small in magnitude (less than 20g peak linear acceleration and less than 1500 rad/s2 peak angular acceleration), the percentage risk of concussion was zero, indicating a concussion risk not significantly over zero percent. For the full code of the Matlab script, see the appendices in section 12.2. [JM]
Figure 5.2.8.2: Results of the Matlab script when run upon three sample impacts recorded during a demonstration.