## 3 Materials and Methods
### External Attachable Sensor Device
After the measurement time per file has elapsed since the CSV file was created, the CSV file is saved. At this time, the next file number is written to the EEPROM. Next, the configuration and operation of the LPWA communication-compatible accelerometer device used in the industrial machine monitoring phase are described. The appearance of the accelerometer device supporting LPWA communication is shown in Figure 6.  
As the main element of this device, a microcontroller board equipped with an ATSAME53J20A, manufactured by Microchip Technology Inc. (Chandler, AZ, USA) [18] is used. In addition, an ES920 LR2 [19] from EASEL Corporation (Kanagawa, Japan) [20] is mounted as the LoRa module that transmits the features calculated by edge processing. Figure 6: Accelerometer devices for Low Power Wide Area (LPWA) communication. The same ICM-20948 as the accelerometer device in the sensor data collection phase is used as the accelerometer. Power is supplied to the device via the micro USB port. The firmware of the accelerometer device supporting LPWA communication is described here. The device starts up and starts operating when it is connected to a power source via a microUSB port. After start-up, the LoRa module and accelerometer are first initialised in Ardunio's setup function. The initialisation process of the LoRa module sets the parameters required for LoRa communication. The parameters to be set include those related to the transmission method and those related to the network. The parameters related to the transmission method include the communication bandwidth, spread ratio, radio channel, existence of acks and the number of retransmissions. The communication bandwidth and radio channel number must be standardised between the LoRa modules that want to communicate. In this system, the bandwidth is set to 500 kHz, which is the maximum value. This is to shorten the communication time and reduce communication failures due to noise during transmission. Increasing the bandwidth increases the communication speed, but there is a trade-off in that the communication range is reduced. Therefore, a smaller bandwidth is necessary in an environment with many obstacles. The spread factor is another parameter that is a trade-off between communication distance and communication speed and is set here to 7, which is the default value of the LoRa module. For communication over a wider area, a higher spreading factor should be set. The radio channel is set to 4. The ack function confirms that the data sent in the communication between LoRa modules have been received by means of an ack packet. In this system, this function is enabled. This ensures that the packets sent by the sensor device reach the gateway. The retransmission frequency parameter can be set to 5 so that up to five retransmissions are performed if no acks are received. These settings reduce the number of data collection failures due to temporary poor signal conditions. The ones related to the network are PANID, OWNID and DSTID. PANID is the address of the network itself, expressed as a four-digit hexadecimal number, and must be standardised between LoRa modules that want to communicate. The OWNID is the address of the LoRa module itself, represented by a four-digit hexadecimal number, and must be unique within the same network. The DSTID is the OWNID of the destination LoRa module, expressed as a four-digit hexadecimal number. In this system, the OWNID of the LoRa module installed in the gateway is set. This allows a single gateway to aggregate data from multiple sensor devices. The initialisation process for the accelerometer is the same as for the accelerometer device in the data collection phase using CSV. After the initialisation process in this acceleration sensor device is completed, the operating cycle of the industrial machine is detected, the feature values are calculated from the measured data and the feature values are transmitted.