# Hybrid Impedance-Admittance Control for Upper Limb Exoskeleton using Electromyography
## 4 Materials and Methods
### Signal Capture and Processing  
We identified the muscles involved in the movement of the upper limbs and the correct location for the acquisition of electromyographic signals based on the literature [12; 27]. Figure 4 identifies the chosen points which were: (i) _latissimus dorsi_, to identify shoulder extension; (ii) _anterior deltoid_, for shoulder flexion; (iii) _biceps brachii_, for elbow flexion; and (iv) _triceps_, for elbow extension. EMG sensors capture signals and filter surface noise with a Common-mode Rejection Ratio (CMRR) circuit. Figure 5 shows a test that exemplifies the reading of the output voltage of the muscle contraction sensor. The sensor delivers the electromyographic signal appropriately amplified to the analog-to-digital converter (ADC) of the microcontroller.  
The ESP32 microcontroller captures the EMG signals and angles of the gyroscopes, performs the admittance control, and sends its output to the Raspberry Pi 3 via Wi-Fi, which runs the impedance control algorithm. ESP32 also broadcasts the values of the signals collected through MQTT (Message Queuing Telemetry Transport) communication protocol for the PC microcomputer to display them in real-time for analysis. Figure 6 presents the interface of a program developed for monitoring the system in real-time. The figure shows the values of the angles of the user's joints in the upper left corner and the mass of the load that the arm is supporting in the upper right corner. Below, the four charts show the values of the electromyographic signals. At the bottom, the two charts present the inductance control output and the feedback receiver from the servo motors.  
The example in Figure 6 illustrates a sequence of unloaded elbow movements. The user maintains an upright posture, and the shoulder joint is relaxed. In the first graph, we can see the angles acquired by the gyroscopes. The blue line refers to the shoulder joint, which remains at 0\({}^{\circ}\) throughout the observed period as the user does not rotate that joint. The orange line represents the elbow joint, and we can see the variation of the angle measured by the gyroscope. Initially, the user has the elbow slightly flexed (angle close to 30\({}^{\circ}\)) and then performs a slow extension movement. Next, the user keeps the arm extended (angle equal to 0\({}^{\circ}\)) for a while, and flexes the elbow quickly to an angle greater than 70\({}^{\circ}\). From the last two graphs, we can see that the control system's output and the feedback from the servo motors reproduce these movements in real-time. Concerning the other graphs, we can see that the load graph remains at 0 g because the experiment was conducted without load. The four central graphs present the EMG signals read by the ESP32 microcontroller. As its ADC has a 12-bit resolution, the measurements range from 0 to 4095; these measurements are integrated EMG values, an approach used in low-cost systems [27]. The graphs concerning the EMG signals show that the triceps, anterior deltoid, and latissimus dorsi muscles are relaxed, whereas the biceps perform a low-intensity contraction at the moment of the elbow flexion.  
Figure 4: Design of the wearable suit to contain the electromyographic sensors and gyroscopes.  
Figure 5: Test of the EMG sensor.