The Development of an Interface Instrument for Collecting Electromyography Data and Controlling a Continuous Passive Motion Machine

Featured Application: This study developed a device to collect electromyography signals and then use the signals to drive a continuous passive motion machine. The device could be applied in clinical rehabilitation programs


Introduction
Human-machine interaction (HMI) technology with rehabilitation systems has received more attention in many studies than methods for traditional rehabilitation devices.Examples of standard HMI systems include bio-signal processing, speech recognition, and image processing [1,2].Although there is great interest in HMI, the current devices used at health centres rarely have any interaction with the patient; for example, the current passive motion system (CPM).CPM machines are one rehabilitation method supported by an advanced treatment exoskeleton and have been commonly used in clinical practice [3].
Signals produced from an individual's body are bio-signals and can potentially be used as the interface of human-computer devices [4].Among the bioelectric signals, EMG is tested to be the basis of a natural means of HMI, i.e., an alternate input mechanism.An input device established using EMG is a natural means of HMI.The electronic activities initiated by an individual's muscle movements can be translated and converted into computer control instructions for rehabilitation equipment [5,6].
Such approaches are enormously valued by physically incapacitated individuals and can potentially be applied as an interface for human-computer devices.Several researchers and applications have exploited electromyography (EMG) signals to realise control systems.In the previous methods for controlling CPM machines, a study by Maneetham and Sutyasadi (2020) proposed a CPM with a hybrid proportional integral and derivative (PID) and iterative learning controller (ILC), which could learn the trajectory tracking feedback in the presence of different sizes from the subject's leg [7].Another way to improve the controlling performance of a CPM machine is through using a pneumatic artificial muscle (PAM) actuator as an alternative to an electric actuator brushless direct current motor (BLDCM) by using a Hybrid Neuro-PID control algorithm using the neural network as a control algorithm [8].Issa et al. (2019) developed a mobile phone application using App Inventor to control the CPM device instead of the main remote controller of a CPM machine [9].This allowed for wireless connection to the CPM device, permitting simplified control and monitoring.Ho and Chen (2009) developed a motorised CPM/CAM knee joint that could provide active mechanical resistance to oppose the motion of the user by using a force sensor under the patient's foot pedal [10].Nevertheless, few previous studies have employed EMG signals to drive a CPM machine for formulating HMI.
Previously, some studies used EMG to drive machines in rehabilitation.Hu et al. (2008Hu et al. ( , 2009) reported that an EMG-driven assistant system is better than a passive motion system for stroke patients with wrist treatment [11,12]; Chen et al. (2009) showed that an EMG-switching robot can be used for hand exercises [13]; Azcaray Rivera et al. (2013) displayed a design that applied EMG signals in a CPM for ankle movement [14]; Kim et al. (2018) introduced three types of assistant systems and EMG was used to verify the effect of the systems on walking, but not for driving movements [15].However, there is a lack of studies which use EMG in the lower limbs to drive CPM directly.
Although these methods for controlling CPM could be useful, these devices lack patient interaction, which is essential in improving rehabilitation outcomes.Therefore, this present study aimed to use EMG signals as the input signal to drive the CPM device, as it would produce a more interactive, informative, precise, and effective approach since the EMG directly reflects the intention of movement.
In structure, this paper is roughly divided into several parts, (1) design of the device, (2) implementation of the device (hardware assembling and software programming), (3) validation of digitalised EMG signals, (4) testing of the device, and (5) discussion on limitation and future studies.
The outcomes showed that (1) this proposed device can digitalise EMG and the processed EMG signals were validated in comparison with the output from a commercial system; (2) the digital EMG can be displayed, saved, and analysed in a PC; and (3) using the device, the EMG signal can be employed to drive a CPM movement.

Requirements of the Interface
This study designed a device to digitalise EMG and then use it as the input signal for a CPM machine.Instead of using a remote control in traditional CPM, the input signals came directly from the muscles.The system's frame diagram is shown in Figure 1.

Requirements of the Interface
This study designed a device to digitalise EMG and then use it as the input signal for a CPM machine.Instead of using a remote control in traditional CPM, the input signals came directly from the muscles.The system's frame diagram is shown in Figure 1.In this device, an EMG system was used to measure the response of the muscles.Then, the muscle signal was sent to the interface system to calculate the required movement of the actuator of the CPM machine based on the algorithm designed in the main controller.This interface allowed the required exit angle to be detected and processed in real time.In addition, a liquid crystal display (LCD) screen was used to display the current value of the operation angle; at the same time, the EMG signal was passed to a personal computer (PC).

EMG
The Delsys ® Trigno TM wireless EMG system (Natick, MA 01760, USA) was used to acquire the EMG signals from the muscles directly [16].The Delsys system has several advantages, including the following:  The system uses a time synchronisation wireless protocol, which reduces the waiting time for data transmission. The main architecture is intended to support high-resolution EMG signals, along with the corresponding biofeedback signals. The internal amplification circuit has a low-pass filter to reduce the noise and increase response performance. All 16 sensors can be used simultaneously to stream the data to the base station.
However, a disadvantage of the Delsys ® system is its high cost.In addition, an external analogue-to-digital circuit needs to be designed to convert the output signal.
EMG signals from the Delsys were collected by two systems: a Vicon ® motion capture system (Oxford, UK) which is standard in the lab and routinely used in clinical practice, and the other was the developed device.
It should be noted that it was not aim of this study to develop EMG equipment with electrodes and sensors.Using Delsys ® , the analogue EMG signals, which are almost equal to original muscle activities, were obtained; using the Vicon ® motion capture system, Delsys ® EMG data could be processed and exported to validate the proposed system.In this device, an EMG system was used to measure the response of the muscles.Then, the muscle signal was sent to the interface system to calculate the required movement of the actuator of the CPM machine based on the algorithm designed in the main controller.This interface allowed the required exit angle to be detected and processed in real time.In addition, a liquid crystal display (LCD) screen was used to display the current value of the operation angle; at the same time, the EMG signal was passed to a personal computer (PC).

EMG
The Delsys ® Trigno TM wireless EMG system (Natick, MA 01760, USA) was used to acquire the EMG signals from the muscles directly [16].The Delsys system has several advantages, including the following:

•
The system uses a time synchronisation wireless protocol, which reduces the waiting time for data transmission.

•
The main architecture is intended to support high-resolution EMG signals, along with the corresponding biofeedback signals.

•
The internal amplification circuit has a low-pass filter to reduce the noise and increase response performance.

•
All 16 sensors can be used simultaneously to stream the data to the base station.
However, a disadvantage of the Delsys ® system is its high cost.In addition, an external analogue-to-digital circuit needs to be designed to convert the output signal.
EMG signals from the Delsys were collected by two systems: a Vicon ® motion capture system (Oxford, UK) which is standard in the lab and routinely used in clinical practice, and the other was the developed device.
It should be noted that it was not aim of this study to develop EMG equipment with electrodes and sensors.Using Delsys ® , the analogue EMG signals, which are almost equal to original muscle activities, were obtained; using the Vicon ® motion capture system, Delsys ® EMG data could be processed and exported to validate the proposed system.

Main Control Unit/Microcontroller
The main controller is responsible for receiving the calculated angle and sending the motion for the motor based on the required angle.At the same time, the microcontroller monitored the actual angle by receiving the measured actual angle from the angle sensor that was built into the CPM machine.Moreover, it was responsible for controlling the reciprocating motion of the CPM machine.In addition, it was responsible for sending the angle data to be displayed on the LCD.2).In the CPM machine, the screw was driven by a brushless direct current motor (BLDCM), with the nut on the screw sliding around with the rotation of the screw, and the cradle relates to the nut.The patient's lower limb is placed on the cradle and can make extension and flexion movements.The main intention of the study was to drive the CPM machine using EMGs.
For this system, its control section was disassembled, and all functions were combined into the control section in the proposed device.

Main Control Unit/Microcontroller
The main controller is responsible for receiving the calculated angle and sending the motion for the motor based on the required angle.At the same time, the microcontroller monitored the actual angle by receiving the measured actual angle from the angle sensor that was built into the CPM machine.Moreover, it was responsible for controlling the reciprocating motion of the CPM machine.In addition, it was responsible for sending the angle data to be displayed on the LCD.

Mechanism of the CPM Machine
A CPM machine (Oaao Rock 480E made in Canada by OrthRehab) was used in this project (Figure 2).In the CPM machine, the screw was driven by a brushless direct current motor (BLDCM), with the nut on the screw sliding around with the rotation of the screw, and the cradle relates to the nut.The patient's lower limb is placed on the cradle and can make extension and flexion movements.The main intention of the study was to drive the CPM machine using EMGs.
For this system, its control section was disassembled, and all functions were combined into the control section in the proposed device.

Display
A display module was used to show the current operating angle in the running process because the study aimed to calculate the required angle.

PC
The main purpose of the PC is to calculate the required angle and save the input data.After being digitalised, the EMG signals must also be visualised and saved for further analysis and research.

Development and Design Process of the Control System Hardware
This section gives a detailed explanation of the design process and implementation of each of the interface components.It also describes how the materials fit into the overall development of the interface.
According to Figure 3, the main control unit (STM32F103VE) collects and processes eight EMG signals using an analogue signal acquisition module (AD7606), which is used to convert EMG output signals from analogue to digital.It then determines the movement angle based on the calculation process, outputs the corresponding control signal to the motor circuit, and rotates the motor accordingly to drive the slide motion of the lower limb.At the same time, the main control unit acquires the signal from the angle sensor in real time to identify and correct the current angle of the mechanical device.An LCD screen displays the current operation angle; at the same time, the EMG signals are sent to a PC, displayed on screen, and saved in the memory.The terminal block SCSI-II is required to take the EMG signal from the base station to the acquisition ADC circuit.

Display
A display module was used to show the current operating angle in the running process because the study aimed to calculate the required angle.

PC
The main purpose of the PC is to calculate the required angle and save the input data.After being digitalised, the EMG signals must also be visualised and saved for further analysis and research.

Development and Design Process of the Control System Hardware
This section gives a detailed explanation of the design process and implementation of each of the interface components.It also describes how the materials fit into the overall development of the interface.
According to Figure 3, the main control unit (STM32F103VE) collects and processes eight EMG signals using an analogue signal acquisition module (AD7606), which is used to convert EMG output signals from analogue to digital.It then determines the movement angle based on the calculation process, outputs the corresponding control signal to the motor circuit, and rotates the motor accordingly to drive the slide motion of the lower limb.At the same time, the main control unit acquires the signal from the angle sensor in real time to identify and correct the current angle of the mechanical device.An LCD screen displays the current operation angle; at the same time, the EMG signals are sent to a PC, displayed on screen, and saved in the memory.The terminal block SCSI-II is required to take the EMG signal from the base station to the acquisition ADC circuit.
A prototype circuit board manufactured for some parts, such as a driver circuit board with a protection board, was designed to control the motor motion by STM32.Furthermore, an angle sensor acquisition circuit was designed for the filtering and amplification of the signal before it was received by STM32.In addition, an ADC circuit was designed for circuit protection and filtering of the signals.A prototype circuit board manufactured for some parts, such as a driver circuit board with a protection board, was designed to control the motor motion by STM32.Furthermore, an angle sensor acquisition circuit was designed for the filtering and amplification of the signal before it was received by STM32.In addition, an ADC circuit was designed for circuit protection and filtering of the signals.

EMG Sensors
The sensors support a low-noise, high-fidelity sensing circuit for detecting EMG biofeedback signals.The sensor's bandwidth range is 20-450 Hz, and the input range is 11 mV.The EMG sensor incorporates a differential amplifier with a gain of 1000 v/v and a Butterworth bandpass filter.The common mode rejection ratio (CMRR) is greater than 80 dB.Each EMG sensor has a distance transmission range of up to 40 m with a sampling rate of up to 4000 samples/s.The output signal has a fixed delay of 48 ms from the time the sensor detects the event to the time the analogue signal is reproduced (TRIGNO TM Wireless System User's Guide, 2014) [16].

EMG Base Station
The main purpose of the base station is to receive the sensor signal using a timesynchronised wireless protocol that minimises the data latency across sensors.The base station can receive data from 16 wireless sensors simultaneously.The base station is equipped with high-speed USB communication with the PC and has a 64-channel analogue output with an analogue output range of ±5 V.It is capable of streaming data to the analysis software and of generating 16 EMG analogue channels for integration with other third-party data acquisition systems.EMG signals are provided by the 68 pin connectors of the base station through the analogue output connectors.EMG signals at these outputs are amplified by a factor of 909 (TRIGNO TM Wireless System User's Guide, 2014) [16].The output analogue port EMG 1-16 moves through an SCSI I-to-II cable to be transferred to an eight-way connection to gather the reading of eight sensors.The delay of the base station is less than 500 µs.

EMG Sensors
The sensors support a low-noise, high-fidelity sensing circuit for detecting EMG biofeedback signals.The sensor's bandwidth range is 20-450 Hz, and the input range is 11 mV.The EMG sensor incorporates a differential amplifier with a gain of 1000 v/v and a Butterworth bandpass filter.The common mode rejection ratio (CMRR) is greater than 80 dB.Each EMG sensor has a distance transmission range of up to 40 m with a sampling rate of up to 4000 samples/s.The output signal has a fixed delay of 48 ms from the time the sensor detects the event to the time the analogue signal is reproduced (TRIGNO TM Wireless System User's Guide, 2014) [16].

EMG Base Station
The main purpose of the base station is to receive the sensor signal using a timesynchronised wireless protocol that minimises the data latency across sensors.The base station can receive data from 16 wireless sensors simultaneously.The base station is equipped with high-speed USB communication with the PC and has a 64-channel analogue output with an analogue output range of ±5 V.It is capable of streaming data to the analysis software and of generating 16 EMG analogue channels for integration with other third-party data acquisition systems.EMG signals are provided by the 68 pin connectors of the base station through the analogue output connectors.EMG signals at these outputs are amplified by a factor of 909 (TRIGNO TM Wireless System User's Guide, 2014) [16].The output analogue port EMG 1-16 moves through an SCSI I-to-II cable to be transferred to an eight-way connection to gather the reading of eight sensors.The delay of the base station is less than 500 µs.

EMG Digitalising
The EMG signal is an analogue voltage signal, so the AD7606 chip was chosen to convert this signal into a digital one.The AD7606 chip has a specialised 16-bit simultaneous sampling and can operate on a single supply of 5 V. Data collection is a very important process, because the precise collection of EMG signals is a good foundation for the control system to understand the patient's intentions.It has eight simultaneously sampled channel inputs with a sampling rate of 200 KSPS.Internally, AD7606 has a digital filter (a secondorder Butterworth filter), which has a cut-off of 3 dB with a frequency of 22 kHz and Appl.Sci.2023, 13, 12221 6 of 23 provides an antialiasing rejection of 40 dB.The time taken for information to be passed to the STM32 chip is 2730.6 µs.

Angle Sensor
In the running process of the control system, the operating angle needs to be collected to determine the equipment's operating position.The angle sensor of the CPM machine was used.The sensor transforms the angle values into voltage variations.By inputting the voltage value of the sensor into the ADC unit of the STM32, it is possible to calculate the current operating angle.When the EMG-controlled CPM device is running, it needs to obtain the angle data through the angle sensor.
The value of the angle sensor can be recalculated through a formula in the program: where 4096 is the ADC resolution, 3.32 is the reference voltage, 0.64 is the voltage value when the angle is 0 degrees, and 0.021 is the voltage value for a one-degree angle.

Design and Manufacture of the Printed Circuit Board
A double-sided circuit board was designed, because too many circuits needed to be connected to the same controller, and this board aimed to arrange all the circuits together.The board included a motor drive circuit, a main control unit interface, a display interface, and a signal acquisition interface.After obtaining the EMG signals with an SCSI I-to-II cable from the Delsys ® system, the data are collected by an AD7606 circuit board via a Terminal Block and SCSI-II 68-Pin Connector and are then transmitted to the STM32.An illustration of the designed board and connections is shown in Figure 4.

EMG Digitalising
The EMG signal is an analogue voltage signal, so the AD7606 chip was chosen to convert this signal into a digital one.The AD7606 chip has a specialised 16-bit simultaneous sampling and can operate on a single supply of 5 V. Data collection is a very important process, because the precise collection of EMG signals is a good foundation for the control system to understand the patient's intentions.It has eight simultaneously sampled channel inputs with a sampling rate of 200 KSPS.Internally, AD7606 has a digital filter (a second-order Butterworth filter), which has a cut-off of 3 dB with a frequency of 22 kHz and provides an antialiasing rejection of 40 dB.The time taken for information to be passed to the STM32 chip is 2730.6 µs.

Angle Sensor
In the running process of the control system, the operating angle needs to be collected to determine the equipment's operating position.The angle sensor of the CPM machine was used.The sensor transforms the angle values into voltage variations.By inputting the voltage value of the sensor into the ADC unit of the STM32, it is possible to calculate the current operating angle.When the EMG-controlled CPM device is running, it needs to obtain the angle data through the angle sensor.
The value of the angle sensor can be recalculated through a formula in the program: where 4096 is the ADC resolution, 3.32 is the reference voltage, 0.64 is the voltage value when the angle is 0 degrees, and 0.021 is the voltage value for a one-degree angle.

Design and Manufacture of the Printed Circuit Board
A double-sided circuit board was designed, because too many circuits needed to be connected to the same controller, and this board aimed to arrange all the circuits together.The board included a motor drive circuit, a main control unit interface, a display interface, and a signal acquisition interface.After obtaining the EMG signals with an SCSI I-to-II cable from the Delsys ® system, the data are collected by an AD7606 circuit board via a Terminal Block and SCSI-II 68-Pin Connector and are then transmitted to the STM32.An illustration of the designed board and connections is shown in Figure 4.   Equipment programming is mainly used to realise the following: functions of the EMG signal acquisition, motor drive, angle signal acquisition, LCD screen display, and key control and communication with the computer software.The whole program is written in the C language.
Computer interface software programming is mainly used to implement the functions of reading EMG signals, saving EMG signals, and sending the required angle to the microcontroller.To facilitate the collection and storage of EMG signals, PC acquisition software is required.The PC acquisition software of this study was developed under the Visual Studio 2012 (VS2012) environment in the C# language.

Software Coding and Flow Chart Design
The program starts by identifying the main parameters and functions and by initialising the devices, which includes identifying the serial port, interrupt function, AD7606 setting, timer initialisation, direct memory access (DMA), motor, ADC, and LCD.
The next step is to read the angle of the sensor and compare it with the original angle.If the current angle is greater than the original angle, then the motor is set to unfold mode; if the current angle is less than the original angle, then the motor is set to fold mode.
This step is repeated until the current angle equals the original angle.Then, stop the motion of the motor and start the alarm signal that indicates the end of the process, as shown in Figure 5.
key control and communication with the computer software.The whole program is written in the C language.
Computer interface software programming is mainly used to implement the functions of reading EMG signals, saving EMG signals, and sending the required angle to the microcontroller.To facilitate the collection and storage of EMG signals, PC acquisition software is required.The PC acquisition software of this study was developed under the Visual Studio 2012 (VS2012) environment in the C# language.

Software Coding and Flow Chart Design
The program starts by identifying the main parameters and functions and by initialising the devices, which includes identifying the serial port, interrupt function, AD7606 setting, timer initialisation, direct memory access (DMA), motor, ADC, and LCD.
The next step is to read the angle of the sensor and compare it with the original angle.If the current angle is greater than the original angle, then the motor is set to unfold mode; if the current angle is less than the original angle, then the motor is set to fold mode.
This step is repeated until the current angle equals the original angle.Then, stop the motion of the motor and start the alarm signal that indicates the end of the process, as shown in Figure 5.After that, explain how the EMG signals is converted and sent to the PC: the STM32 sends a signal per millisecond to initiate the conversion operation of the AD7606.As soon as the AD7606 receives the signal, it starts the analogue-to-digital conversion function.
Once it completes, it sends an interrupt signal to STM32, causing STM32 to turn to the interrupt function.In this function, the converted data are stored into the array, and when it is complete, the DMA mode is started to transmit the data to the PC by using the serial port cable as shown in Figure 6.
sends a signal per millisecond to initiate the conversion operation of the AD7606.As soo as the AD7606 receives the signal, it starts the analogue-to-digital conversion function Once it completes, it sends an interrupt signal to STM32, causing STM32 to turn to th interrupt function.In this function, the converted data are stored into the array, and whe it is complete, the DMA mode is started to transmit the data to the PC by using the seria port cable as shown in Figure 6.The final step is explaining the CPM machine's reciprocating motion.It starts by in tialising the motor motion in stop mode and then delaying for 2 s using the timer function After that, the movement instruction is set to fold or unfold mode to apply the CPM mo tion.Comparing the current angle and the receiving angle to stop the motor motion for s, the motor moves in the opposite direction until it reaches the original angle.After tha the motor repeats this reciprocating motion until it receives a stop signal from the pus button, as shown in Figure 7.The final step is explaining the CPM machine's reciprocating motion.It starts by initialising the motor motion in stop mode and then delaying for 2 s using the timer function.After that, the movement instruction is set to fold or unfold mode to apply the CPM motion.Comparing the current angle and the receiving angle to stop the motor motion for 2 s, the motor moves in the opposite direction until it reaches the original angle.After that, the motor repeats this reciprocating motion until it receives a stop signal from the push button, as shown in Figure 7.

Interface Software Program
The interface program is built in to make the human interface easier and to monitor all the data, as the readings of the EMG sensors can be displayed.In addition, the software calculates the required signal for motion according to the root mean square equation.Nevertheless, there is another button that gives the user the ability to set the required angle manually, neglecting the calculation step.Figure 8 shows the layout of the interface software design.

Interface Software Program
The interface program is built in to make the human interface easier and to monitor all the data, as the readings of the EMG sensors can be displayed.In addition, the software calculates the required signal for motion according to the root mean square equation.Nev ertheless, there is another button that gives the user the ability to set the required angle manually, neglecting the calculation step.Figure 8 shows the layout of the interface software design.Upon pressing the send button, the software performs a root mean square calculation on all the data received so far and then sends the results to the control system.When the control system receives the angle value sent by the PC, it continuously reciprocates between 0 degrees and the angle value.Every time the switch of the STM32 is turned on, the CPM machine will automatically return to the original position, and a clear 'beep' is heard after this is complete.All operations should be started after the beep.After the initialisation process, the central control circuit board will automatically send data to the PC, as shown in Figure 9. Upon pressing the send button, the software performs a root mean square calculation on all the data received so far and then sends the results to the control system.When the control system receives the angle value sent by the PC, it continuously reciprocates between 0 degrees and the angle value.Every time the switch of the STM32 is turned on, the CPM machine will automatically return to the original position, and a clear 'beep' is heard after this is complete.All operations should be started after the beep.After the initialisation process, the central control circuit board will automatically send data to the PC, as shown in Figure 9.

Angle Sensor
Experiments were used to define the relation between the angle value and the voltage reading from the angle sensor.Using a digital multimeter to measure the output voltage on the pin of a sensor with different values of angles which were measured by a protractor,

Angle Sensor
Experiments were used to define the relation between the angle value and the voltage reading from the angle sensor.Using a digital multimeter to measure the output voltage on the pin of a sensor with different values of angles which were measured by a protractor, it was clear that the relation was directly proportional with a positive slope relation as shown in Figure 10.Then, the microcontroller was provided with that relationship as every 0.021 V increase in the angle sensor signal being equal to a one degree change in the angle position.Table 1 represent the corresponding measured voltage by a multimeter for different angle values.Therefore, the following equation represents the relationship between values of the volt and angle: y = 0.021x + 0.64 (2) where y represents the voltage value in volts and x represents the angle value in degrees.it was clear that the relation was directly proportional with a positive slope relation as shown in Figure 10.Then, the microcontroller was provided with that relationship as every 0.021 V increase in the angle sensor signal being equal to a one degree change in the angle position.Table 1 represent the corresponding measured voltage by a multimeter for different angle values.Therefore, the following equation represents the relationship between values of the volt and angle: where y represents the voltage value in volts and x represents the angle value in degrees.

Model Reliability
This section aims to verify the proposed system sampling hardware and firmware by comparing the EMG data collected via the Delsys ® and Vicon ® systems as a standalone acquisition with that sampled by the proposed system.

Model Reliability
This section aims to verify the proposed system sampling hardware and firmware by comparing the EMG data collected via the Delsys ® and Vicon ® systems as a standalone acquisition with that sampled by the proposed system.

Participants
A total of 600 EMG trials were collected from 10 healthy participants to assess the reliability of the proposed system measurement.Table 2 reports the subjects' demographic characteristics.

Equipment and Experimental Protocols
The EMG data from six major lower limb muscles (rectus femoris, RF; vastus lateralis, VL; biceps femoris, BF; tibialis anterior, TA; gastrocnemius medialis, GM; and semitendinosus, ST) were collected during movements.The location of the electrodes was determined based on the specific anatomical landmarks system following the SENIAM guideline (Surface ElectroMyoGraphy for the Non-Invasive Assessment of Muscles is a European concerted action in the Biomedical Health and Research Program (BIOMED II) of the European Union) as shown in Figure 11.The data of five different movements with variable speed of the dominant lower limb (knee flexion, knee extension, ankle plantar flexion, ankle dorsiflexion, and straight-leg raising) were randomly selected for a total of 50 movements, and a total of 600 EMG trials were recorded in both systems from all EMG sensors.

Participants
A total of 600 EMG trials were collected from 10 healthy participants to assess the reliability of the proposed system measurement.Table 2 reports the subjects' demographic characteristics.The EMG data from six major lower limb muscles (rectus femoris, RF; vastus lateralis, VL; biceps femoris, BF; tibialis anterior, TA; gastrocnemius medialis, GM; and semitendinosus, ST) were collected during movements.The location of the electrodes was determined based on the specific anatomical landmarks system following the SENIAM guideline (Surface ElectroMyoGraphy for the Non-Invasive Assessment of Muscles is a European concerted action in the Biomedical Health and Research Program (BIOMED II) of the European Union) as shown in Figure 11.The data of five different movements with variable speed of the dominant lower limb (knee flexion, knee extension, ankle plantar flexion, ankle dorsiflexion, and straight-leg raising) were randomly selected for a total of 50 movements, and a total of 600 EMG trials were recorded in both systems from all EMG sensors.

Implementation and Integration between Both Systems
EMG activities were recorded via the Delsys ® Tringo wireless system as a standalone acquisition.However, data were also collected by the developed system simultaneously as shown in Figure 12.The EMG data of the Delsys ® system were collected through the Vicon Nexus 2.8.1 software using a desktop computer, while the EMG signals sampled by the developed system were displayed and visualised using the software developed for this project on a personal laptop as shown in Figure 13.

Implementation and Integration between Both Systems
EMG activities were recorded via the Delsys ® Tringo wireless system as a standalone acquisition.However, data were also collected by the developed system simultaneously as shown in Figure 12.The EMG data of the Delsys ® system were collected through the Vicon Nexus 2.8.1 software using a desktop computer, while the EMG signals sampled by the developed system were displayed and visualised using the software developed for this project on a personal laptop as shown in Figure 13.

Statistical Analysis
Statistical analysis was performed using the Statistical Package of Social Science software (SPSS ® version 25).To measure the reliability of the proposed system, it was necessary to compare the EMG output collected data via Delsys with that sampled by the proposed system at the same time to evaluate the correlation between the two collected EMG measurements.An in-house program using Matlab ® was used to analyse and compare the experimental output data from both systems, which were stored in datasheet files to identify the time shifting and matching between both signals in each trial, and to perform other calculations of measurements such as the mean, mean difference, SD, root mean square difference, p value, and Pearson Correlation Coefficient for all paired data from both systems.After that, SPSS was used for analysing the data, and descriptive statistics identified

Statistical Analysis
Statistical analysis was performed using the Statistical Package of Social Science software (SPSS ® version 25).To measure the reliability of the proposed system, it was necessary to compare the EMG output collected data via Delsys with that sampled by the proposed system at the same time to evaluate the correlation between the two collected EMG measurements.An in-house program using Matlab ® was used to analyse and compare the experimental output data from both systems, which were stored in datasheet files to identify the time shifting and matching between both signals in each trial, and to perform other calculations of measurements such as the mean, mean difference, SD, root mean square difference, p value, and Pearson Correlation Coefficient for all paired data from both systems.After that, SPSS was used for analysing the data, and descriptive statistics identified any statistically significant differences that existed between the means and standard deviations of both systems.An intraclass correlation coefficient test (ICC) was also used to identify the level of correlation between both signals.
ICC estimates and their 95% confident intervals (CI) were calculated in SPSS using a single-measure, absolute-agreement, two-way mixed-effects model, and it was found that an excellent interrater reliability existed between the proposed device and the Delsys ® system.As shown below in Figures 14-19, three different examples of 200 ms of EMG data were recorded by the Delsys ® system and sampled by the proposed system at the same time.This demonstrates that both systems had the same pattern of EMG signals that would reflect each other.
Appl.Sci.2023, 13, x FOR PEER REVIEW 16 of 26 any statistically significant differences that existed between the means and standard deviations of both systems.An intraclass correlation coefficient test (ICC) was also used to identify the level of correlation between both signals.
ICC estimates and their 95% confident intervals (CI) were calculated in SPSS using a single-measure, absolute-agreement, two-way mixed-effects model, and it was found that an excellent interrater reliability existed between the proposed device and the Delsys ® system.As shown below in Figures 14-19, three different examples of 200 ms of EMG data were recorded by the Delsys ® system and sampled by the proposed system at the same time.This demonstrates that both systems had the same pattern of EMG signals that would reflect each other.The single measure of ICC was 0.978 with a 95% confidence interval from 0.970 to 0.984  , 96.254, p < 0.001).The single measure of ICC was 0.958 with a 95% confidence interval from 0.081 to 0.990  , 277.225, p < 0.001).The single measure of ICC was 0.978 with a 95% confidence interval from 0.970 to 0.984 (F (200,200) = 96.254,p < 0.001).

Results of Reliability
A total of 600 EMG trials were analysed from both systems.Table 3 provides a statistical summary of the control system efficiency.The EMG output data sampled by the proposed system were compared to the EMG data of the Delsys ® system from 300 pairs of EMG trials.It was found that a statistically high correlation and similarity existed between the proposed device and the Delsys ® system with a median correlation coefficient of 0.81; the 25% and 75% values were 0.56-0.92and were significant with p < 0.001 for all paired values, and the shifted difference between the two means for both systems was 0.00187 V, meaning that the proposed device worked well.

Results of Reliability
A total of 600 EMG trials were analysed from both systems.Table 3 provides a statistical summary of the control system efficiency.The EMG output data sampled by the proposed system were compared to the EMG data of the Delsys ® system from 300 pairs of EMG trials.It was found that a statistically high correlation and similarity existed between the proposed device and the Delsys ® system with a median correlation coefficient of 0.81; the 25% and 75% values were 0.56-0.92and were significant with p < 0.001 for all paired values, and the shifted difference between the two means for both systems was 0.00187 V, meaning that the proposed device worked well.This experiment aimed to monitor the output reciprocating motion of a CPM machine.Figures 20 and 21 give some basic methods and practical components used.In addition, a Supplementary File includes a piece of video that shows how the EMG from the leg muscles is used to drive the CPM movement in real time.This experiment aimed to monitor the output reciprocating motion of a CPM machine.Figures 20 and 21 give some basic methods and practical components used.In addition, a supplementary file includes a piece of video that shows how the EMG from the leg muscles is used to drive the CPM movement in real time.The developed system was able to work as an interface between the EMG and CPM medical devices that needed to use EMG to function in real time.Furthermore, EMG signals were effectively employed to control the CPM machine in real life as shown in the supplemental file where a piece of video shows the muscle EMG signals driving the CPM movement.

Discussion
All current CPM machines can only move the patient's leg passively without requiring any interaction initiated by the patients [17].To incorporate human-machine interaction into this technology, the traditional control system of the CPM machine was changed to utilise the EMG biofeedback signals in this study.This project was a preliminary study that used EMG signals to drive a CPM machine, suggesting that this horizontal EMGbased control system could assist bedridden patients with severe muscle weakness in rehabilitation.As previously mentioned, Ho and Chen (2009) developed a motorised CPM/CAM knee joint that could provide active resistance to oppose the motion of the user by way of a force sensor under the patient's foot pedal [10].Their device could be suitable for patients in the advanced stages of rehabilitation who have had knee replacement surgery.However, adding an EMG signal control to the device would constitute a more interactive and effective approach since it directly reflects the intention of movement; also, it could be suitable for neuromuscular patients with severe weakness of the lower limbs in the early stages of rehabilitation.
Some previous research groups have designed their own EMG interface system instead of using the Trigno TM system.Trigno TM has a high cost; however, it helps to simplify the interface circuit.According to previous studies, without the Trigno TM system, researchers had to build an external amplification circuit followed by a filter circuit [18][19][20].In this study, eight EMG signals were used for a comprehensive measure of muscle movements.In that case, eight amplification circuits need to be implemented, in addition to eight filter circuits to avoid noises, which made the design more complex and increased the possibility of signal interference and noise.Because the Trigno TM EMG system has its own internal amplification circuit, the signal is clearer, avoiding noise, and the circuit is simplified.
According to the previous studies, there is a limitation with the number of EMG signals because of the design of external amplification and filter circuits.For the present

Discussion
All current CPM machines can only move the patient's leg passively without requiring any interaction initiated by the patients [17].To incorporate human-machine interaction into this technology, the traditional control system of the CPM machine was changed to utilise the EMG biofeedback signals in this study.This project was a preliminary study that used EMG signals to drive a CPM machine, suggesting that this horizontal EMGbased control system could assist bedridden patients with severe muscle weakness in rehabilitation.As previously mentioned, Ho and Chen (2009) developed a motorised CPM/CAM knee joint that could provide active resistance to oppose the motion of the user by way of a force sensor under the patient's foot pedal [10].Their device could be suitable for patients in the advanced stages of rehabilitation who have had knee replacement surgery.However, adding an EMG signal control to the device would constitute a more interactive and effective approach since it directly reflects the intention of movement; also, it could be suitable for neuromuscular patients with severe weakness of the lower limbs in the early stages of rehabilitation.
Some previous research groups have designed their own EMG interface system instead of using the Trigno TM system.Trigno TM has a high cost; however, it helps to simplify the interface circuit.According to previous studies, without the Trigno TM system, researchers had to build an external amplification circuit followed by a filter circuit [18][19][20].In this study, eight EMG signals were used for a comprehensive measure of muscle movements.In that case, eight amplification circuits need to be implemented, in addition to eight filter circuits to avoid noises, which made the design more complex and increased the possibility of signal interference and noise.Because the Trigno TM EMG system has its own internal amplification circuit, the signal is clearer, avoiding noise, and the circuit is simplified.
According to the previous studies, there is a limitation with the number of EMG signals because of the design of external amplification and filter circuits.For the present study, researchers looked for a sufficient microcontroller that would offer a highly stable performance.By considering other studies [21,22], it was found that using Arduino UNO with an ATMEGA microcontroller may have limitations with the functions of clock performance in getting an accurate output value with a high response.In addition, there were a limited number of input and output ports.For example, according to [21], which studied controlling the movement of a wheelchair using EMG signals collected from the arm, they used two Arduino UNO microcontrollers, one for collecting the EMG signals and another Arduino UNO for sending the signals to the actuator.While in the present study, researchers only used one microcontroller "STM32" that collected EMG signals and sent the required signal to the actuator simultaneously.
The reliability of the proposed system was validated, and overall, the results confirm high reliability of the developed interface system when compared with the EMG output data of the Delsys ® and Vicon ® systems.The findings show that there were constant differences in amplitude values between both systems.The proposed system had slightly higher values than the Delsys ® and Vicon ® systems, within an average rate of 0.00187 V.In other words, the systematic shifting value between both systems was 0.00187 V, and when this value is subtracted from the proposed system's EMG reading, both systems have the same amplitude values.The results obtained show that the developed instrument could work as a controller interface between EMG and a CPM medical device that needs to use EMG for its function.

Advantages and Disadvantages
The proposed device has an important advantage: it can use EMG signals to drive the movement of CPM.This function may find many applications in clinical practice; for example, an orthopaedic patient might use their EMG to drive a CPM which help exercise their limbs.So do other types of patients, e.g., with stroke and cerebral palsy.An obvious disadvantage is that this device uses an EMG station which acquires surface EMG from muscles using EMG electrodes and sensors.So far, this proposed device has not held a function to acquire EMG directly.It was recognised at the beginning that this study was not aimed to develop an EMG instrument with EMG electrodes, as many commercial companies have such EMG products in market.

Limitations of This Study
Since this study developed a prototype of the EMG-controlled system, at present, all the EMG signals need to be transmitted to the PC and then calculated to generate a certain angle value, which is then sent to the CPM device to drive the motor.This could be improved in the future, as a range of complicated processes could cause time delays when using that as a rehabilitation device.Additionally, the angle was calculated using a general root mean square equation.That equation could be improved for a more accurate angle.Further, this proposed device employed the Delsys Trigno TM system for the analogue signal source, and the latter could be replaced by a self-developed part in the future, although some issues exist.These limitations really indicate the research directions in the future.

Future Study
Some recent studies have explored different topics in modelling and information processing, e.g., electromechanical coveter [23,24], and signal processing and optimisation [25].These studies could be considered as references in the future.Along the direction of current study, further projects are recommended in various aspects: (1) To build a standalone system which directly acquires EMG through electrodes on the skin.Though this work is mainly involved in the manufacture of electrodes and amplifiers and has been conducted by many companies, a cheap and high-quality EMG system is still worth developing.
(2) To test various algorithms which could combine multi-channel EMGs into a certain instruction to make the limbs moveable at a specific way.(3) To try different signal sources, e.g., speech and finger/arm posture which could be used to drive CPM.Obviously, these

Figure 1 .
Figure 1.Diagram of the system's functions.Note: The two boxes of functions were implemented by this study.

Figure 1 .
Figure 1.Diagram of the system's functions.Note: The two boxes of functions were implemented by this study.

Figure 2 .
Figure 2. The CPM machine (left) and the disassembled mechanical section (right).

Figure 2 .
Figure 2. The CPM machine (left) and the disassembled mechanical section (right).

Figure 3 .
Figure 3.The process of the interactive interface system.

Figure 3 .
Figure 3.The process of the interactive interface system.

Figure 4 .
Figure 4. Illustration of the PCB and connections.Figure 4. Illustration of the PCB and connections.

Figure 4 .
Figure 4. Illustration of the PCB and connections.Figure 4. Illustration of the PCB and connections.

2. 3 .
Programming 2.3.1.Overview System software programming consists of two parts: equipment programming and computer interface software programming.

Figure 5 .
Figure 5. Flowchart of the main functions.

Figure 5 .
Figure 5. Flowchart of the main functions.

Figure 6 .
Figure 6.Flowchart of reading the angle input signal.

Figure 6 .
Figure 6.Flowchart of reading the angle input signal.

Figure 7 .
Figure 7. Flowchart of the CPM output motion.

Figure 7 .
Figure 7. Flowchart of the CPM output motion.

Figure 8 .
Figure 8. Layout of the interface software.

Figure 8 .
Figure 8. Layout of the interface software.

Figure 9 .
Figure 9. Sequence of receiving angle signals.

Figure 9 .
Figure 9. Sequence of receiving angle signals.

Figure 10 .
Figure 10.Relationship between angle and voltage.Note: The blue dots were measured from the real readings.

Figure 10 .
Figure 10.Relationship between angle and voltage.Note: The blue dots were measured from the real readings.

Figure 12 .
Figure 12.The method of connection protocol diagram between both systems during data collection.

Figure 12 .
Figure 12.The method of connection protocol diagram between both systems during data collection.

Figure 13 .
Figure 13.The main interface of the Getting EMG software (v.1).

Figure 13 .
Figure 13.The main interface of the Getting EMG software (v.1).

Figure 14 .Figure 14 . 26 Figure 15 .
Figure 14.Correlation between the two EMG signals from both systems for rectus femoris.

Figure 15 .
Figure 15.Scatter plot (correlation between the two measures for rectus femoris).

Figure 16 .Figure 16 .Figure 17 .
Figure 16.Correlation between the two EMG signals from both systems for gastrocnemius medialis.

Figure 18 .Figure 18 . 26 Figure 19 .
Figure 18.Correlation between the two EMG signals from both systems for biceps femoris.

Figure 19 .
Figure 19.Scatter plot (correlation between the two measures for biceps femoris).

Figure 20 .
Figure 20.The method of connection protocol diagram during the experiment.Figure 20.The method of connection protocol diagram during the experiment.

Figure 20 .
Figure 20.The method of connection protocol diagram during the experiment.Figure 20.The method of connection protocol diagram during the experiment.

Figure 21 .
Figure 21.The actual view of connection during the experiment.

Figure 21 .
Figure 21.The actual view of connection during the experiment.The developed system was able to work as an interface between the EMG and CPM medical devices that needed to use EMG to function in real time.Furthermore, EMG signals were effectively employed to control the CPM machine in real life as shown in the Supplementary File where a piece of video shows the muscle EMG signals driving the CPM movement.
Mechanism of the CPM MachineA CPM machine (Oaao Rock 480E made in Canada by OrthRehab) was used in this project (Figure

Table 3 .
Descriptive Statistics that Represent the Differences and the Correlation between Both Systems (n = 300).

Table 3 .
Descriptive Statistics that Represent the Differences and the Correlation between Both Systems (n = 300).