Table of Contents
Arduino Development Environment
In order to program the Razor 9DOF board, an environment such as the Arduino IDE, which can be found here , must be installed. Next, plug in the Razor 9DOF device. Using the Arduino IDE, open the code seen below under Razor 9DOF Code, select the appropriate COM port, and then click the upload button on the toolbar (or select upload from the File dropdown menu). The Razor 9DOF will run the code that was just uploaded every time it is turned on, reset, or has the power switched.
Razor 9DOF Code
The Razor 9DOF board came with a set of code created by Jordi Munoz. This code utilized the gyroscopes, accelerometer, and magnetometer to turn the board into an Attitude and Heading Reference System. The gyroscopes require correction by the accelerometers and magnetometers due to their incessant drift. The code that was supplied with the Razor 9DOF can be downloaded below.
Due to the difficulties of working with the gyroscopes, a new set of code was developed that uses only the accelerometer and magnetometer to determine orientation. This code also implements a handshaking procedure, vector normalization, and an unused Gram-Schmidt orthonormalization for a change of basis functions. It can be downloaded below.
In order to test the device in absence of a base unit, a set of test codes were developed in Python. To run these tests, the correct version of the Python environment must be installed (click here for Python 2.6.4) as well as two additional libraries, pywin and pyserial. Once these libraries are installed, the test code in the next section can be run.
The first code is for recording data while the SF9DOF_AHRS code is loaded on the Razor 9DOF board. The data is saved into a .txt file in the same directory as the Python code.
The next code is for recording head orientation data while the AandM_motion code is loaded on the Razor 9DOF board. The first one can be used to test the button presses and the next one does not require a button press to begin recording data. The program will ask the user for a filename, the length of time the device should warm-up, and then the length of time that the device should record for. The data is saved into a .csv file in the same directory as the Python code.
The last code is for recording knee flexion data while the AandM_motion code is loaded on the Razor 9DOF board. The program will ask the user for a filename, the length of time the device should warm-up, the length of time that the device should record for, and whether the device is on the right (R) or left (L) leg of the patient. The data is saved into a .csv file in the same directory as the Python code.