-
Notifications
You must be signed in to change notification settings - Fork 28
The basics of EMG design
Electromyography (EMG) is a way of measuring electrical activity produced from skeletal muscles. EMG typically refers to intramuscular EMG where an electrode is inserted into a muscle and another is used as a reference point. Surface Electromyography (sEMG) uses a pair of electrodes on the skin and an operational amplifier to measure and amplify the very small voltage differences between the two electrodes [1].
sEMG signals are noisy due to surface measurements: electrical noise, ambient noise, motion artefacts and the inherent instability of the signal. There are many techniques reduce these different types of noise [2] [3] [4].
Differential amplification is often used in sEMG to eliminate large noise signals from powerline sources. Two electrodes are placed on the muscle and one reference electrode is placed on electrically unrelated tissue. The signals from the two muscle electrodes are subtracted and the difference is amplified, therefore any signal common to both detection sites is removed. In practice, differential amplifiers do not have perfect accuracy so some noise is still present [1] [2].
- Acquire some signal (Electrodes)
- Amplify the signal (Instrumentation Amplifiers or Operational Amplifiers)
- Filter the signal (Sallen-Key second order filter, Bandpass filters, Op Amps etc)
- Decode the signal (An ADC, some computation and a lot of knowledge)
Commercial sEMG systems are expensive and require the use of adhesive pads, often covered with gel to increase conductivity and decrease noise. These pads are commonly used in a medical environment but are wasteful and removing them is too painful for daily use by the public. Professional Dry electrodes are often made from Silver Chloride, but some options for cheap dry electrodes could be corkboard pins or small copper pads often sold as laptop CPU heatsinks.
Pictured above is a DIY dry electrode setup made using elastic, stick on velcro and some corkboard pins that fit into duport connectors.
Electrodes could also be made by using a custom printed PCB like in the 3DC armband. Wires from the electrodes to the amplifiers are a great place to pick up noise, so some designs curl electrode wires around each other to reduce noise and the icibci even covers the wires in tinfoil.
Apart from the electrodes, care has to be taken to create a wearable design that keeps the electrodes touching the skin. A 3D printed case could be combined with elastic, in a similar way to the Myo. Alternatively electrodes could be mounted into sweatbands or sleeves.
The voltage of EMG signals differs between individuals but an amplitude between tens of μV and few odd mV can be expected. For a computer to read these signals an ADC (Analog to Digital Converter) is needed, these have a voltage range and a resolution. We need to pick an amplifier with a gain that maximizes the spread of the ADC that will be used. [5]
Some initial choices are:
- INA128 - Has better characteristics than the INA106, used in the Super Simple EMG Circuit and PsyLink.
Datasheet. - INA333 - Better input impedance than the INA128. Sadly not available in a DIP package, but can be purchased in a PCB in the CJMCU-333 module. The INA333 was chosen for this 2021 paper, which details the process of EMG design.
Datasheet. - INA106 - Very cheap but low gain.
Used in the MyoWare Alpha design, see here.
Datasheet.
Note the INA106 is a 1 op amp design, called an instrumentation amplifier but really a difference amplifier, using 1 op amp inside. These chips are part of a multi stage design and usually followed by other op amps for further gain. Unlike the INA106, The INA128 is a proper instrumentation amplifier, using 3 op amps internally.
Key Terms
low-pass filter - lets signals lower than a selected cutoff frequency passthrough.
high-pass filter - lets signals higher than a selected cutoff frequency passthrough.
band-pass filter - lets signals within a certain range passthrough, can be made by having a high-pass follow a low-pass or vice-versa.
notch filter - lets everything but signals within a certain range pass.
[Filter response curves from all about circuits: Source]
A bandpass filter allows for basic noise removal, and is much easier to implement in hardware than in software. Creating a design which reduces the noise picked up is also key. For example using a wired design with a charging laptop will generate lots of noise due to the shared ground, unplugging the laptop is a less noisy and safer way to operate but working over Bluetooth Low Energy (BLE) is even better.
When building filters, using an active second order filter such as a Sallen-Key topology is recommended. For a comparison between active and Sallen-Key filters see this YouTube tutorial.
After the ADC, further preprocessing could be done but that all depends on the use case. For classification or regression, machine learning and deep learning techniques like LSTMs could be used, but for simpler projects smooth averaging might be enough as demonstrated in NeuroBreakout.
The decisions made around filtering and decoding will influence what micro controller you use. Some chips have special Digital Signal Processing capabilities and some even support TensorFlow Lite for Microcontrollers. Tensorflow Light for microcontrollers supports predictions using Dense and Convolutional layers. Recurrent layers are not yet currently supported. See Zack Freedman's Small Brain, Big Think: AI on the Edge for more info.
One recommendation is the Arduino Nano 33 BLE sense due to its BLE support, IMU, Gesture sensor and support for TensorFlow Lite for Microcontrollers.
I strongly recommend communicating over BLE for both safety reasons and to reduce noise that would be picked up from being connected to a PC and therefore mains. If you need to be wired, use a laptop and don't charge it while wearing electrodes.
[1] - M. Z. Jamal, “Signal Acquisition Using Surface EMG and Circuit Design Considerations for Robotic Prosthesis,” in Computational Intelligence in Electromyography Analysis, G. R. Naik, Ed. Rijeka: IntechOpen, 2012.
[2] - C. J. De Luca, “Surface electromyography: Detection and recording,” DelSys Incorporated, vol. 10, no. 2, pp. 1–10, 2002.
[3] - R. H. Chowdhury, M. B. I. Reaz, M. A. B. M. Ali, A. A. A. Bakar, K. Chellappan, and T. G. Chang, “Surface electromyography signal processing and classification techniques,” Sensors , vol. 13, no. 9, pp. 12431–12466, Sep. 2013.
[4] - M. B. I. Raez, M. S. Hussain, and F. Mohd-Yasin, “Techniques of EMG signal analysis: detection, processing, classification and applications,” Biol. Proced. Online, vol. 8, pp. 11–35, Mar. 2006.
[5] - Designing a portable EMG based on the BBC micro:bit https://blog.thomaspoulet.fr/portable-emg-microbit/