Design and Development of Portable LoRa-based Teleoperation Controller

In Industry 4.0, the applicability of wireless communication is superior to that of wired communication because of the mobility, lower cost, and faster internet deployment. Wireless local area networks (WLANs), such as Bluetooth low energy (BLE) and Wi-Fi, have the advantages of a high bandwidth and transmission speed. However, they have drawbacks, such as their limited transmission distances and the high likelihood of interference from other floors. Therefore, the applicability of wireless teleoperated control in complex factory environments is limited when a WLAN is used. The objective of the present study was to develop a portable long range (LoRa)-based teleoperation controller (PLTC) to solve this problem. LoRa is a lowpower wide-area network (LPWAN) technology, which is a suitable approach to communication for PLTCs owing to its physical characteristics of long distance and low frequency. Accordingly, we designed an intuitive teleoperation controller with an inertial measurement unit (IMU) sensor and processed the attitude signal using a complementary filter to operate a robotic arm stably. The IMU is an effective and generally applicable sensor for measuring the attitude of devices. Finally, we integrated a LoRa module and a robotic arm to realize longdistance teleoperation control in a harsh factory environment. The results of this study provide a useful reference for controller development and sensor applications for Industry 4.0.


Introduction
In the Industry 4.0 architecture, the communication layer defines the communication protocol and is responsible for the transmission of data and files. As the number of production systems operating in a network environment continues to increase, it is sometimes necessary to overcome the problem of long-distance communication. (1) The application concepts of cyber-physical systems, Internet of Things, and Internet of Services, which involve the transmission of information through a network, are designed to achieve factory digitization and automation. The overall structure of an intelligent factory is intended to increase the production efficiency of the manufacturing industry. To allow a larger number of sensors, devices, and components to transmit and share information, (2)(3)(4) deploying a sound and applicable network environment in the factory is important.
In traditional factories, wired communication systems are often used to implement industrial monitoring and control systems. However, rerouting the wires in a harsh factory environment or in a flexible manufacturing operation environment is expensive and difficult. Moreover, it typically requires complex manufacturing operations and maintenance. Therefore, for future Industry 4.0 factories, flexible system maintenance is necessary. (5) Wired communication systems enable stable and fast control of production equipment in the factory, and compared with wireless communication systems, they have higher deployment costs. Additionally, the flexibility of the equipment operation is limited; the equipment cannot be flexibly and agilely deployed for production processes. Therefore, a wireless communication control system that is suitable for a complex factory environment and can overcome these drawbacks is needed. The proposed control method is suitable for use in factory environments with complex electromagnetic environments and multiple compartments.
The 2.4 GHz frequency band is the most widely used band in the wireless local area network (WLAN) environment in the industrial, scientific, medical, and other fields. It is the most mainstream wireless network band but has the problems of insufficient coverage and high energy consumption. It also has the disadvantages of mutual interference and packet loss (6) in the same working space. Long range (LoRa) has better anti-interference, a wide range, high penetration, low power consumption, and low-throughput communication, (7) making it more suitable for applications involving a complex electromagnetic environment and multiple compartments.
Sensors are the foundation of IoT applications. By using an inertial measurement unit (IMU) sensor, a user can control a robotic arm more intuitively. (8)(9)(10) An IMU consists of two types of three-axis inertial sensors, i.e., accelerometers and gyroscopes, encapsulated in a polychlorinated biphenyl (PCB) semiconductor, which can be used to estimate the attitude of the device by estimating the relationship between the device direction and the gravity vector. (11) We used an MPU-6050 sensor with a three-axis accelerometer and a gyroscope to provide the input signal of the robotic-arm controller for teleoperation control. Additionally, the original data provided by the IMU was filtered by a complementary filter to enhance the stability of the robotic-arm movement.
In this study, a lightweight portable LoRa-based teleoperation controller (PLTC) was designed, which combines the advantages of long-distance communication and anti-interference with LoRa wireless communication technology to enable the use of an IMU in complex factory environments. The operator can teleoperate the robotic arm in a complex environment. We experimentally verified the suitability of this device as a wireless teleoperation solution for Industry 4.0. Figure 1 shows the architecture of the system designed and developed in this study with the PLTC. It can teleoperate the robot arm in different spaces to perform prespecified actions to simulate control of the production equipment in a factory. Figure 2 shows the system architecture, which is divided into the PLTC and robotic arm. The system contains four modules: an IMU, a microcontroller, a LoRa module, and a motor. The microcontroller module in the PLTC captures the attitude signal from the IMU, filters pitch and roll signals to stabilize the control signal, and transmits the control command via the LoRa module. When the robotic arm receives the signal, the data are converted into a motor control command for the actuator. Figure 3 shows the flow of the system, which was developed using unified modeling language (UML). The flow is mainly divided into two parts: the PLTC and the robotic arm. The flow of the PLTC commences when the system is switched on. First, the LoRa modules of the PLTC and robotic arm are set to Tx and Rx modes, respectively. Secondly, the PLTC reads  the accelerometer and gyroscope measurements from the IMU sensor to calculate the pitch and roll attitude angles and stabilize the control command via the complementary filter (described in Sect. 2.2.2). Next, the LoRa module transmits the packets of the control command to the robotic arm for teleoperation. On the other hand, the initialization of the motor position, the packet analysis of the control command, and the motor actuator are performed sequentially on the robotic arm.

IMU module
The IMU sensor allows the user to intuitively teleoperate the robotic arm by changing the attitude of the controller. In the IMU sensor, a capacitor made of a ceramic base material sintered at a high temperature forms the operating circuits with an MPU-6050 sensor. These electronic components are encapsulated in a PCB semiconductor with a size of 4 × 4 × 0.9 mm 3 in accordance with the standards set by the Joint Electron Device Engineering Council (JEDEC). This type of sensor and the PCB are very suitable for portable devices owing to their small size and light weight, respectively.
In this study, the MPU-6050 sensor mounted on the IMU was employed to measure the attitude data with a 400 kHz sampling rate, which is sent to the microcontroller unit through an I 2 C interface. The pitch and roll of the PLTC were calculated in the microcontroller unit by using the physical components of acceleration and angular acceleration measured from the accelerometer and gyroscope in the IMU, which provided signals for controlling the robotic arm.

Microcontroller module
In this architecture, we use the Arduino Uno microcontroller board for data collection, preprocessing, filtering, motor actuation, and data transmission owing to its open-source, easydevelopment, and low-cost characteristics. Although its computing ability is lower than that of a Raspberry Pi, it satisfied the computation, control, and implementation requirements of the experiments in this study.

Attitude acquisition
The attitudinal raw data of the PLTC is measured by the IMU sensor. Figure 1 also shows the coordinate system of the PLTC, where roll corresponds to the x-axis, pitch corresponds to the y-axis, and yaw corresponds to the z-axis. We used the attitude estimation method from a previous work (12) as a basic technology and defined the rotation matrix R as follows: cos cos cos sin sin cos sin sin cos sin cos cos sin sin sin cos sin cos cos sin sin sin cos sin sin cos sin cos cos where R γ , R ρ , and R φ represent the rotation matrices for roll, pitch, and yaw, respectively. Additionally, to calculate the angle of rotation, the measured value of the gravitational acceleration (G a ) perpendicular to the ground is converted into a tilt angle, and the direction of the gravitational acceleration is an extension of the z-axis direction. (13) Thus, the rotation matrix can be rewritten as The gravitational acceleration value (G ar ) read by the accelerometer is normalized to obtain sin cos sin cos cos Finally, we determine the angles of pitch and roll, ρ and γ, respectively: In accordance with a previous work, (14) the angle of orientation is calculated using the gyro value measured by the IMU and Eq. (9): . 131 Here, ω gyro represents the angular velocity measured from the gyroscope of the IMU. Specifically, ω gyro is divided by 131 to convert the diameter into the angle. Finally, the angle of orientation (g angle ) is calculated by integrating the measured intervals (dt). With this technology, the IMU module measures the attitude of the PLTC and calculates the angle of the attitude via the microcontroller module by the method provided in this section as a control command for teleoperating the robotic arm.

Complementary filter
The attitude of the PLTC measured by the IMU sensor will be affected by the cumulative error and noise generated by the sensor, causing attitude estimation errors and oscillations. Thus, the calculated pitch and roll signals must be processed and cannot be immediately used as a control command for the robotic arm. Therefore, it is necessary to address this shortcoming.
Generally, data processing with appropriate filters can stabilize the measurement signals from an IMU. Kalman (15)(16)(17)(18) and complementary filters (19)(20)(21)(22)(23) are two widely used filters. In a previous work, (24) an experimental comparison of both filters found that they can obtain smooth and accurate signals regardless of dynamic or static experiments. The Kalman filter is one of the most widely used filters because of its optimality, tractability, and robustness. However, it implicitly requires complex matrix calculations. Therefore, it will be difficult to use Kalman filters on devices with limited computational capabilities. On the other hand, the complementary filter, which is easy to implement, can be more stable and accurate than the Kalman filter in some cases as long as the parameters of the complementary filter are adjusted optimally. The PLTC proposed in this study is expected to achieve arm control with limited computing resources. Therefore, complementary filters with lower implementation complexity and lower computational requirements are used.
The microcontroller calculates the angular velocity and acceleration of the current attitude from the measured angle and calculates the angular acceleration via the accelerometer and gyroscope in the IMU. When the IMU is in intense motion while the PLTC is operating, the accelerometer is disturbed by non-gravitational acceleration; thus, the calculated attitude is unreliable. At this time, the result can be corrected by the gyroscope, and thus the accelerometer and the gyroscope can compensate for each other. (19) We referred to a previous work (24) to implement the complementary filter to sense the tilt angle. The complementary filter operates in a similar manner to a low-pass filter to estimate data from the accelerometer, only allowing long-term changes to pass through and filtering out short-term fluctuations. Additionally, after the gyroscope output data are integrated, data processing is performed by a high-pass filter to inhibit long-term changes caused by the gyroscope, and the direction can be determined after the two estimated data are integrated by the all-pass filter. The complementary filter exhibits the advantages of both the accelerometer and the gyroscope. In the short term, the data of the gyroscope are used to ensure that the data of attitude is accurate and unaffected by external forces. In the long term, the data of the accelerometer are used to prevent data-drift cumulative error. Figure 4 shows the flow of the complementary filter.
Equation (10) gives the mathematical model of the complementary filter: (24) where θ angle represents the tilt angle of pitch or roll and C cf is the filter coefficient of the complementary filter and ranges from 0 to 1. In accordance with a previous work, (24) we set C cf as 0.96. ω gyro represents the angular velocity of the gyroscope. Δt represents the integration interval (time). θ Acc represents the angle of the accelerometer. Using this mathematical model, the angle of the filtered pitch and roll can be calculated as the control command of the robotic arm. Figure 5 shows the actuator integrated with the robotic arm. The actuator integrates LoRa and the microcontroller into a box fabricated using a three-dimensional printer. The Arduino Uno microcontroller in the box receives the attitude information through LoRa for motor control using the half-duplex UART protocol.

LoRa module
LoRa wireless communication technology exhibits advantages including long-distance communication, low cost, strong penetration, low power consumption, and anti-interference. The controller developed in the study uses an IL-LoRa 1272 module to transmit the attitude control information to the robotic arm and control the robotic arm. According to the official specifications, the IL-LoRa 1272 module can transmit data over 15 km in the suburbs, and the data-transmission distance in dense urban areas is decreased to 2-5 km. (25) However, an excessive controller size should be avoided to keep the dexterity of the PLTC. To increase the applicability of the device, a lightweight module with a short antenna was used. Figure  6 shows the actual size of the LoRa module. Although the short-antenna version had a short transmission distance, the characteristics of the LoRa-based communication satisfy the transmission requirements for a general factory environment.

Robotic arm
In this study, a robotic arm with four degrees of freedom was constructed from four Dynamixel AX-12A servo motors manufactured by ROBOTIS as shown in Fig. 7. The Dynamixel series of motors are smart modular actuators with reduction gears and provide an operating angle of 300° and a rotational angle with a resolution of 0.29°. The state of a motor can be tracked using its servo system, such as the speed, temperature, position, and loading. (26) These features allow the user to easily control the motor. This robotic arm integrated by an intelligent motor is suitable for simulating factory equipment in Industry 4.0. In this study, specific motions of the robotic arm are predefined into the PLTC, and the robotic arm is wirelessly teleoperated by LoRa wireless communication over a long distance.
The architecture is used to verify the potential of the proposed PLTC in Industry 4.0. Three experiments were performed to verify the applicability of the complementary filter, the advantages of LoRa teleoperation, and the performance of robotic arm control through the proposed PLTC.

Experiments
We conducted three experiments to verify the applicability of the proposed PLTC to Industry 4.0. First, the effect of the complementary filter that stabilizes the control signal was verified. Secondly, transmission characteristics experiments of a simulated factory environment for LoRa and Bluetooth low energy (BLE) were performed to verify that LoRa is suitable for Industry 4.0. Finally, we examined whether the PLTC actually controls the robotic arm to complete the specified actions to verify the overall architecture.

Experiment design
In this study, three experiments were conducted to verify the performance of the PLTC. In the first experiment, to verify the stability of the controller, we compared the performance of Butterworth, Kalman, and complementary filters. As shown in Fig. 8, the MPU-6050 sensor was mounted on the motor to present the movement attitude of the IMU objectively. The motor performed a rotation from 0 to 180° as a ground truth for the experiment. Furthermore, the sampling data were used to facilitate further analysis of the pitch and roll generated by the IMU and the filters.  We then conducted a transmission performance experiment on the wireless communication technology to evaluate the transmission restrictions of LoRa for the teleoperating robotic arm. We investigated the maximum transmission distance of LoRa and compared it with that of a low-power BLE module [HM-10 board (27) ]. This experiment was conducted in an open space by sending 300 packets at specific time intervals (named time windows) from the PLTC to the robotic arm at different distances. The purpose was to determine the optimal transmission of LoRa and BLE with the lowest packet-loss rate to avoid signal jamming.
Finally, a simulation of the factory robotic arm's tasks was conducted by the PLTC to teleoperate the robotic arm, and maneuvers were performed using predefined IMU data. The PLTC and robotic arm were placed at separate locations. Subsequently, the teleoperation ability of the PLTC while constantly sending signals to the robotic arm was verified. Figure 9 shows the predefined sequential motions 1 to 5 of the robotic arm. Motions 1, 3, and 5 are the initial positions of the robotic arm. On the other hand, motions 2 and 4 simulate the factory arm gripping items in different positions. These five motions were counted as one teleoperating motion, and 20 motions were counted as one round. The motion achievement rate of the robotic arm controlled by the PLTC was verified for three rounds in each position. Figure 10 illustrates the configuration of the experiment. A multiple-compartment building was used to simulate the complex environment of a factory. The robotic arm receiving control  commands from testing points 1 to 4 was located at the bottom-left corner on the 2nd floor. Among the four testing points in the building, test point 3 had the longest signal-blocking distance. Additionally, test point 4 was on the 3rd floor and the remaining points were on the 2nd floor. During the experiment, wireless signals were likely to penetrate the concrete wall of the building, which was 48 cm thick, as well as the 74.5-cm-thick floor. The configurations of the testing points are shown in Table 1. Figures 11 and 12 show the experimental results of the filtering effect compared with the ground truth. From the error of the filters, it can be observed that the output of the Butterworth filter has the greatest oscillation and the maximum range of error. In addition, the signal of the pitch processed by the Butterworth filter is significantly unstable, so the pitch data were further analyzed, as discussed in the next section. However, the performance of the easily implemented complementary filter was comparable to that of the high-performance Kalman filter.

Experimental results
To discuss the performance of the filters more objectively, the error among the filters calculated with the ground truth are shown in Fig. 13. The signal filtered by the Butterworth filter is unstable, indicating that the signal is unstable as a control command. On the other hand, although the Kalman filter exhibits the most stable and smoothest filtered signal, the overall error is slightly higher than that of the complementary filter.  The actual angles of the pitch processed by the filters recorded from 0 to 180° in the experiment are shown in Fig. 14. It can be seen that the Butterworth filter is less stable than the other filters and is clearly unable to stabilize the control signal. Furthermore, the degrees of the complementary and Kalman filters were slightly lower than the ground truth for up to 300  items of data, but then reverted back to the ground truth immediately. In addition, the filtered waveforms of the complementary and Kalman filters almost overlapped, so the two filters had similar performance. Therefore, the PLTC in this study can not only meet the requirements of control stability via the complementary filter, but also reduce the computational load of the microcontroller.
In the transmission performance experiment, the packet loss rate of LoRa was 1.43% at 621.33 m, compared with 5.67% at 65 m for BLE. When the range exceeded these distances, the packet loss was more significant. These distances can be used as the maximum transmission distances in experimental design.
After the results for the transmission-distance limitation were obtained through experiments, an experiment was performed in an indoor environment to simulate the transmission efficiency in a factory. To match the transmission-distance limit of BLE, we conducted the experiment in  a 60-m-long room. The experiment indicated that BLE had the maximum stable transmission range. Figure 15 shows the packet-loss conditions of LoRa. The packet-loss rate remained under 1% when the time window was set as >50 ms, indicating the stability of the data transmission. There was significant packet loss when the time window was <50 ms, indicating that the transmission speed was higher than the physical limit of LoRa and affected the stability of communication. Conversely, the packet-loss rate of BLE is shown in Fig. 16. Within the time window of 25-200 ms, the maximum packet-loss rate was 4.11%. However, the packet-loss rate increased to 87.78% when the time window was <10 ms. The results indicate that the packet transmission speed of BLE was superior to that of LoRa.
Finally, the teleoperation experiment of the PLTC was performed, and the results are presented in Table 2. Testing point 1 had the shortest distance, yielding the joint best motion achievement rate of 100%. Testing point 4 also exhibited a motion achievement rate of 100%  even though it had the longest total transmission distance, and the signal had to penetrate four walls and one floor. This is because of the courtyard along its path. According to the results, the PLTC is applicable in factories with a considerable length and multiple floors.
Additionally, testing point 2 had the most complex environment for transmission. Although the total distance was shorter than that of testing point 3, the signal transmitted by LoRa had to pass through six concrete walls and two rooms with lockers, resulting in significant packet loss. In summary, walls have a significant influence through the blockage of wireless communication.
The teleoperating ability of BLE for the robotic arm was evaluated under the same configuration. At testing point 1, the controller was completely unable to control the robotic arm. Therefore, the distance was reduced to 6, 8, and 12 m, corresponding to testing points A, B, and C, respectively, as shown in Fig. 17. The results are presented in Table 3. When the distance exceeded that of testing point C, we were unable to control the robotic arm. Hence, BLE wireless communication is significantly affected by the distance and is completely inapplicable in factories with multiple floors or different spaces.

Discussion
Recently, LoRa technology, which possesses low-power, wide-area, and anti-interference abilities, has led to a novel thinking in IoT applications. In this study, we innovatively simulated the complex environment in Industry 4.0 and applied LoRa to the PLTC to teleoperate the robotic arm intuitively. The 2.4-GHz-band wireless networks (such as Wi-Fi and Bluetooth) are generally used as wireless communication technologies in factories. These technologies tend to reduce communication stability as a result of distance, building compartments, and signal interference. Therefore, LoRa technology is expected to be suitable for overcoming these disadvantages. Although lightweight and portable controllers in factories can reduce deployment and maintenance costs, they also face the disadvantage of insufficient computing capability. To improve the shortcomings, the PLTC stabilized the intuitive control signal obtained from the IMU sensor with a low computational load by using a high-efficiency complementary filter.
The objective of teleoperating the robotic arm via LoRa was achieved. As shown in Figs. 15 and 16, the packet-loss rate of LoRa was higher than that of BLE when the time window was set as 25 ms. However, when the time window was set between 50 and 200 ms, the average packetloss rate of LoRa was 0.47%, which was superior to that of BLE (1.42%). The results indicate that LoRa is more stable than BLE for these time windows. According to the experimental results, the motion achievement rate of the signal sent from the PLTC to the robotic arm at four testing points was 93.33% under the configuration of an indoor environment with an average distance of 45.19 m. The distance and motion achievement rate of BLE were smaller and lower than those of LoRa, respectively. Therefore, the PLTC designed in this study is more applicable than BLE in complex factory environments.
For the IL-LoRa 1272 module, the transmission distance cannot reach the official 15 km owing to the indoor environment with multiple obstacles and the short antenna. Replacing the IL-LoRa 1272 module by one having a longer antenna is expected to enhance the transmission distance of the PLTC, making it suitable for large-scale factory environments.
In some studies on portable teleoperation, (8,28,29) teleoperation was implemented using 2.4 GHz wireless technology. The applications of these studies are obviously limited by the communication distance. In Ref. 28, an IMU was used to teleoperate the robotic arm. The control commands were received from the accelerometer, which were processed by a firstorder low-pass filter. However, this method lacks an effective means of solving the problem of transient oscillations from the accelerometer, reducing the stability of the controller. In Ref. 8, a large wireless teleoperation robotic arm system that stabilizes accelerometer and gyroscope signals through complementary filters was proposed. However, the robotic arm was actuated by a standard PC host, and this can make the device more expensive and larger. In Ref. 29, distributed controllers were worn on the wrist and forefinger to respectively predict gestures by measuring the attitude from individual accelerometers and gyroscopes. However, the teleoperation of an object by specific gestures resulted in slightly unsatisfactory intuitive  control. Summarizing the above points, the PLTC proposed in this study has the advantages of intuitive teleoperation, stability, light weight, low cost, and long-distance communication, demonstrating the innovative contributions of this research.

Conclusions
In this paper, an intuitive PLTC for teleoperating a robotic arm was proposed. A complementary filter with low computational complexity was used to process the attitude signal of the PLTC measured from an IMU sensor, which was verified in an experiment. The result showed the excellent efficiency of the complementary filter in terms of stable control commands through appropriate parameter setting. On the other hand, with the integration of an IMU sensor and LoRa, the robotic-arm controller was capable of teleoperating a robotic arm in a complex building with concrete walls and floors. The mechanism of teleoperating presented in this study allowed the robotic arm to achieve 93.33% of the designed movements in an environment with a long distance (average of 45.19 m) and obstacles. This concept and structure can enhance the field of wireless communication in Industry 4.0. Therefore, integrating the IMU sensor and LoRa module allows long-distance teleoperation control. The results of this study provide a useful reference for the development of sensor-related applications for Industry 4.0.