Close

A Lesson in SEMG and Analog Physiological Sensing Electronics.

A project log for SynthaSense Suit: Control Stuff With Your Muscles

A better human computer interface. A wearable sensor suit for controlling stuff using SEMG and body movement.

casual-cyborgCasual Cyborg 04/02/2015 at 16:021 Comment

So now we get into the meat of the tech. The good stuff. The Biomedical Engineering coke. It's where the silicon meets the carbon road, where synthetic "life" meets organic "life."

The blending of biology and physics was what got me into biomedical engineering in the first place. Meshing organic with inorganic has this perverse pull for me. Yes, I was the one who found the Borg queen in Star Trek Voyager, the Matrix human batteries, and anime cyborgs sexy as hell, especially with all the attachments put on em. Do I have a sick fetish? Maybe. Is it Visionary? Absolutely.


I started down this path when I was 5 years old, and licked a nine volt battery. That buzz was what got me going. When I was ten, I dissected disposable cameras, and gave myself severe shocks from the flash capacitor as an experiment, and for fun. I also got hit by lightning when I was in college, but that's a story for another day. Since day one, I've had this strange predeliction for electricity and the body, and attaching hardware to my body, for good or bad, is very natural for me.

Naturally I gravitated to muscles and electronics. So what better thing to work with than SEMG? Let's sing the Body Electric.

And now for a lesson in Surface Electromyography, or SEMG for short.


An SEMG signal is an electrical wave that cascades down your muscle. That wave is generated when something called a Motor Unit Action Potential, MUAP, which is a combination of muscle neurons (Motor Neuron) and muscle fibers, starts with a discharge of a set of neuron potentials.

Those potentials are formed from the separation of sodium and potassium - which are positive ions - and chloride ions - which are negative ions - inside of the neural cell synapse, which is that long, tenuous line in the neural cell circuit. At the end point of the neural cell, where the neural electrical discharge ends, it releases neurotransmitters into the muscle cells, which in turn releases cascades of calcium ions, and that triggers the muscle fibers to contract. Now you know why salt, bananas, milk and leafy greens are important for your diet.

That discharge wave cascades down your muscle, creating what's called a Motor Unit Action Potential Train, which is a long line of MUAP's discharging to the end of the muscle. That end, is where the muscle is attached to ligaments or tendons, which in turn are attached to skeletal bone. And that's why you need a ground near bone to complete the circuit.

The full electrical discharge is both motor neural cells discharging, and muscle potentials discharging, ending with one giant, cascade of voltages coming out from your muscles. Which gets really messy, and complicated looking. Like this.


What the electrode is measuring is the muscle discharge from the calcium ions. Lost somewhere in that signal are the motor neuron cells, but those aren't that important to look at for our purposes.

To read electrical signals from muscles, we start with a differential amplifier, aka a diff amp. You need the diff amp because it subtracts the voltage values measured between the two electrodes.

All the diff amp does is it measures a point in the wave, versus another point in the wave, while the ground provides a base reference. When it subtracts those values, you have a voltage value from the muscle, and that's the signal you're working with.

Now, some SEMG circuits use a single electrode, and a ground. Others, like the one we're using, use the belly of the muscle, the ending of the muscle (right where it attaches to tendons), and the ground. You can also get crazier with triple, quad electrodes to get as much signal value as possible.

This improves the resolution of the signal, because of the number of contact points on the skin. But it also gets a lot more uncomfortable. There's a lot of metal shafing on your skin all in a concentrated point.


Good instrumentation diff amps meet these minimum parameters.

  1. Low internal noise (<0.5 mV)
  2. High input impedance (>100 MΩ)
  3. Flat bandwidth and sharp high and low frequency cutoffs (>18dB/octave).
  4. High common mode rejection ratio (CMRR > 107 dB)
  5. Common mode input range (CMR > ±200 mV)
  6. Static electricity shock protection (>2000 V)
  7. Gain stability > ±1%


All of these are important, especially common mode rejection ratio, but the one I consider most important, is high input impedance. You need a high input impedance because you want minimal loading to avoid distorting the signal. Remember, the human body is an AC machine... except for a segment of your brain, which produces more DC.

One of the problems - among many - with SEMG is sweat. Sweat is filled with salts (Sodium ions, +, and Chloride ions, - ), and salt is what makes water conductive. Now, if you have an electrode (the skin contact) with high impedance, and an amplifier with low impedance, you could get a voltage divider formed between your sweat and the electrodes. Which means loss of signal.

I want this to work with any kind of skin in any condition. Not a lab environment where you get to clean the skin with alcohol swabs and scrape it to create better contact. I work under presumptions that the ex Soviet Union worked under, that the conditions are going to be dirty, nasty, and very unideal.

Designing a Better Sensor Platform

When I started this whole endeavour, I started with the Advancer Technologies circuit.


I had a lot of problems with it: oversaturation, expense, 60Hz signal, bipolar voltage from two 9 volt batteries, tiny pots that died quickly, loose and faulty connection to the Arduino, and more. Which is why we threw out the whole design, and designed a new one.


The Advancer circuit used an INA106 differential amplifier for the interface with the electrodes. The INA106 is a pricey piece of silicon, and it costs 12 bucks. The INA106 has a few technical issues as well. First you have to use a resistor to set the gain, and a lot of times, you can set the gain too high, you can't adjust it because it's a static resistor, and replacing it with a pot at the very beginning of the circuit means you'll severely oversaturate the rest of the circuit which is decked with filters that have their own gain adjusters. And that's exactly what happened to me. I spent weeks trying to come up with ways to fine tune multiple gain adjustments, when I should've just thrown out the INA106 in the first place.


The other problem with the INA106 was cost. Now, when you're operating on as much of a shoe string as I am, you quickly learn how to get good results fast, on very little. So we got rid of the INA106. I got the INA106 through Texas Instrument's free sample program, which is OK when you're experimenting with a pod or two, but I needed to build a lot more than that for the entire body, which adds up the cost. Even at volume, the price drop isn't that much, especially for the performance I was getting from it.


So, Al and I substituted the INA121, which is more capable, with the benefit of being low power. The INA121 is also half the price of the INA106, it didn't come with that gain setter, which meant I can concentrate on the digital pot at the end filter. I got better control with that setup.


Next was the succession of filters. Al suggested we put in a notch filter to get rid of the 60Hz signal. The Advancer circuit relied on the Diff Amp to remove that signal, which is sufficient, but not always adequate. We also changed the configuration of the filters. We kept the wave rectifier, because when it comes to digital control, you don't need the negative portion of the signal. And we added the part I considered critical, the digital pot.

I also didn't like using the two 9 volt batteries for + and - voltage supplies. That's just too heavy, klunky, and not wearable. So I used an inverting charge pump circuit to get rid of a battery, and generate a + voltage and a - voltage from one battery.


Next, I wanted full integration with the Atmel processor, and I wanted more PWM ports for more LED's. Which meant incorporating a TLC5940NT. I also wanted manual control of the digital pot through the Arduino IRQ's - which I used software for -, so two push button switches were put in. I also put the LED bar graph in there, and I wanted it to be easily programmable on the fly, so the 6 headers for a USB programmer is in there. This was "supposed" to be our demo circuit, designed to show off the concept to prospective investors.


I did all of the digital circuitry and power supply. Al helped make a much better analog circuit, and we incorporated the digital pot with the analog circuitry. I had my refined circuit that I can digitally control with the Arduino, and that opened up a whole new realm of possibilities for Bluetooth, Wifi which leads to the Internet of Things, and Artificial Neural Network control.

This was my new sensor platform. The other great thing about this design is its modularity. Prototyping this on the Arduino platform conferred a massive technological advantage due to the cross platform ability of the Wiring Open Source Framework.

Let's say I wanted more than what the Atmel328P could do as an 8bit microprocessor. If I wanted to, I can easily drop in the Freescale ARM in the Teensy (Wiring), or a Microchip MIPS based PIC32 Pinguino (Wiring) circuit for more power. I''ve also considered the Texas Instruments MSP430, because it's low power, and uses Energia (Wiring). Since I coded the software in the Arduino/Wiring framework, it's basically/kinda/sorta/maybe/wishful thinking cross compatible with those three other platforms.

That creates a massive time saver if I wanted to upgrade the microcontroller.

The most important design goal of this platform was it formed neural unit for a suite of other sensors that I wanted to incorporate, like the IMU, an accelerometer, resistor sensors, etc. And going back to my original grand vision, with the Artificial Neural Network, it would form one node of a suit that had distributed, smart "nodes" sensing across the body - creating a wearable, external spinal network for the human body. As per the the Grand Vision.


But we still had some problems. For starters, the 9 volt battery is still a major problem. It's big, and not sufficiently wearable. Also, the components for the op amp filters weren't the best price/performance values out there. And we still needed to shrink the whole thing down to something we could manufacture.

And this is where Al's expertise came to play.



Appendix: Software used to do the electronics layout is gEDA.



Discussions

lemfn64 wrote 09/03/2015 at 04:14 point

Hi I am in a similar project and was planing on using the advanced technologies circuit until I found yours, my project is more centered on the neural network than on the electronics, not the best at this. So I would like to use your circuit but the advanced technologies has only one output after the last tl072 yours has two, any idea how can I modify the circuit so I can have a analog dc signal that can be passed to a arduino analog pin? 

Great project by the way and seams like a great start to that great suit

  Are you sure? yes | no