estimation of such measures (Konrad, 2006) (De
Luca, 1997).
Another paper concerns with the acquisition and
analysis of EMG signals for multiple active hand
movements based on wrist-hand mobility for control
of prosthesis robotic hand (
Raurale, 2014). An EMG
hardware module had been developed but the
classifier based on Linear Discriminant Analysis
(LDA) with threshold detection approach, resulted in
a very low processing time for the pattern recognition.
In spite of the documented success of some of
these methods, the algorithm presented in this paper
is based on a previous work in which a smoothing
filter is applied to EMG signal (Russo, 2019). These
filtering is achieved through a derivative component
that evidences the largest variations discarding the
signal noise. These enables the more efficient
application of a single threshold as higher frequencies
of the signal were suppressed.
2 METHODS
The algorithm was initially tested in Matlab using
previously acquired data from EMG signals. Later,
the code had to be adapted in order to be executed in
an ongoing data acquisition. To face the difficulty in
carrying out its debug, there was an intermediate step
of executing the algorithm in Arduino Uno through
the Arduino IDE platform with visualization of the
acquired signals in Opensignals. At this stage, for the
sake of ease in debugging, signals were acquired from
the accelerometer module of BITalino, whose shape
it was possible to adjust in a simple way. Through
Arduino's serial monitor, it was possible to follow the
values of some flags used for debugging, which were
complemented by the visualization of signals in
Opensignals. At this stage, the accelerometer signals
were acquired in parallel by Arduino UNO and a
BITalino. Through these, it was possible to improve
the code, identifying and correcting errors in the
algorithm and debugging the code until the conditions
for the independent execution of the code in Arduino
UNOo were created.
3 ALGORITHM
The initial code of the algorithm was developed in
Matlab, based on data smoothing previously
described in the literature (Russo, 2019). Three
parameters were defined that must be previously
adjusted in order to optimize the efficiency of
onset/offset detection. These parameters together
with auxiliary flags allow to control the flow of
execution of the different routines.
Figure 1 shows the data of an EMG signal
acquisition in which three muscle activations are
identified. Green and red markers corresponding to
onset and offset detection, respectively, are also
represented. These markers are obtained from each
raw-data from EMG sensor, which is computed in
order to calculate the difference from the previous
value. The average of an amount of these values
defined by the parameter arraySize is the key value
for the application of a threshold, defined by a second
parameter, activation, from which it is compared in
order to detect firstly the onset in upward direction
and offset in downward direction.
These markers do not delimit muscle activation,
and it is necessary to establish the time when
activation starts, with the help of First_onset_flag, as
well as the time when muscle activation ends. In this
case, Last_offset_flag is used, defining a period of
time that must elapse since the previous offset, using
the third parameter, DesactDelay. The description of
the various flags used for this flow control is
presented in table 1.
Figure 1: EMG signal acquisition with onset and offset
markers, green and red, respectively.
The parameter arraySize imposes the degree of
smoothness as it raises when the average is calculated
over a larger amount of values of EMG signals.
Consequently it also influences the sensitivity of the
algorithm in onset/offset detection as a greater
smoothing of the signal reduces its fluctuations and
the number of times it crosses the threshold value.
The activation parameter, on the other hand, has a
direct action in the detection of the onset/offset, as a
lower threshold value implies a more frequent
recognition of a variation as an onset, that is, it
increases the sensitivity of the algorithm. It is
important to be clear that this threshold is applied to
the smoothed signal instead of raw EMG signal. In
EMG signal amplitude (a.u.)