## 3 Materials and Methods
### External Attachable Sensor Device
After start-up, the RTC, SD card and accelerometer are initialised in the setup function in Arduino. The initialisation of the RTC requires the correct time to be set. The time when the firmware is written to the computer is used for this time. However, if this time is set every time the sensor device is reset, the time of the RTC reverts to the time at which the firmware was written when the device is reset. Therefore, Grand Central uses Electrically Erasable Programmable Read-Only Memory (EEPROM), which is a non-volatile memory. A flag is stored on the EEPROM to determine whether or not the device has been started up for the first time, and this flag is set after the device has been started up for the first time. This ensures that the RTC time is set only at the first start-up when the firmware is written. In the initialisation of SD, the file number in the SD card is acquired. The file number is the serial number of the CSV file created in the sensor device, and the file name of each CSV is set to this file number to prevent duplicate file names. This value is reset to 0 when the firmware is written and is incremented by 1 when the CSV file is saved. However, if the file number is managed as a variable in the firmware, it returns to 0 when the power is turned off or reset, so it is also stored in the non-volatile memory EEPROM to make it persistent. In the initialisation of the accelerometer, various parameters are set. The parameters to be set are the range of acceleration measured by the accelerometer, the digital low-pass filter, the sampling rate and the FIFO mode. In this research, the acceleration measurement range is set to \(\pm\)2 g, the cut-off frequency of the low-pass filter to 246 [Hz], the sampling rate to 562.5 [Hz] and the FIFO mode to stream mode, which overwrites the FIFO when it overflows. If the initialisation process for these modules fails, the LED on the reset button blinks. The flow of operations of this accelerometer device after the initialisation process is completed is shown below. 1. Creating CSV files
2. Extracting data from the accelerometer FIFO
3. Writing measurement data to CSV files
4. Saving CSV files  
The acceleration device repeats these operations for each measurement time per file. When creating a CSV file, the CSV file number obtained in the initialisation process is used as the file name to create the CSV file. It also acquires the time from the RTC and sets it as the file creation time. This allows the creation time of the CSV file to be checked. Write one line each for device ID, measurement start time and sampling interval as header information in the created CSV file. This allows the web application to retrieve information on which device the CSV file is from, when the measurement start time of the CSV file is, and how long the sampling interval is. Finally, 'x, y, z' is written as the CSV column labels. Here, these labels correspond to the x- y- and z-axes of the triaxial acceleration. Next, data extraction from the accelerometer's FIFO and measurement data writing to the CSV file are repeated alternately. In data extraction from the accelerometer's FIFO, the number of data in the FIFO is first obtained. When data are extracted from the FIFO here, it is necessary to extract the data one by one, but the extracted data are not written to the CSV file one by one and are instead written to a variable array in the microcontroller memory once. The data are inserted once into a variable array in the microcontroller memory. This is because data are added to the FIFO at any time in the accelerometer while writing to the CSV file, and the FIFO may overflow due to variations in the writing time to the SD card. By writing the measurement data to the CSV file after all the data in the FIFO have been extracted once, the data can be stored in the FIFO while writing to the CSV file. The acceleration data extracted to the variable array are written to the CSV file in comma-delimited order in the x- y- and z-axis.