Smoothing spikes of analog data

Discussion in 'The Projects Forum' started by EMGcircuit, Oct 29, 2013.

  1. EMGcircuit

    Thread Starter New Member

    Oct 29, 2013
    4
    0
    Hello,
    I'm currently trying to figure out whether it is possible to smooth an EMG-signal in an analog circuit.
    My problem is that I would like to turn on a vibrator, if the EMG reaches a certain amplitude and turn off, once the muscle reflexes via use of a comparator - of course happening in real time.

    Due to EMG's nature, a raw signal looks like:
    http://www.biomed.drexel.edu/labs/biomechanics/images/emg_fig3.gif

    My theory is that the vibrator would constantly turn on and off, thus giving discomfort to the user. Firstly, my plan is to rectify the signal to make all values positive. After this, I would like some sort of smoothing. Digitally, root mean square would be ideal for my purpose (see image below), however, I am pretty lost when it comes to implementing a method similar to this in an analog circuit.

    http://www.jjengineering.com/Images/Screenshots/emgraw-1WebSmall.jpg

    I have been recommended a low pass filter to filtrate some of the highest frequency, however this won't change the oscillative nature of an EMG signal. Is there anything I can do to lessen this? Must be in an analog circuit.

    Thank you!
     
  2. Danm1

    Member

    Jul 19, 2010
    55
    7
    If you have a wave form that you want to smooth and want to implement a filter, it can be done in analog or digital.

    It more depends on your system, are you reading it from transducer on the persons body and then want to correct the condition by smoothing the signal? Then why not use a digital filter?

    If you must use an analog filter, you can look at Butterworth, Chebyshev or Elliptic.
     
  3. #12

    Expert

    Nov 30, 2010
    16,261
    6,768
    You have 4 variables to work with. First, an RC low pass filter can act as a crude integrator with (1) adjustable charge and (2) discharge times. Third, the time the vibrator is on is adjustable.

    You could use an operational amplifier as a precision rectifier and integrate the resulting signal for a more precise result. This seems important because of the DC offset. Use a capacitor to couple the signal to the precision rectifier and use resistors and a capacitor to set the charge and discharge times.

    The goal seems to be to integrate fast pulses and switch on the vibrator (4) at a certain level.

    Something like this:
     
  4. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    I think your signal in picture two is low-pass filtered. I would suggest a bessel filter for this application.
     
  5. Danm1

    Member

    Jul 19, 2010
    55
    7
    Do you have access to Matlab or similar program? You should simulate the filter circuit to see how it filters your sample signals. Then you will be able to tweak it precesely to get the exact result you want.
     
  6. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,282
    1,236
    It looks like a envelope detector to me. Is what you care about the amplitude of the signal and not all the "grass" that creates the envelope?
     
  7. #12

    Expert

    Nov 30, 2010
    16,261
    6,768
    Yes. Muscles are controlled by a series of pulses. Repeat rate is the key factor. Picking out any particular pulse is useless. The integral of pulses per time is the important metric.
     
  8. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Picture two was also kind of blurry. But as I see it now. The signal rectified, using an ideal rectifier/precision rectifier (http://sound.westhost.com/appnotes/an001.htm), and then lowpass filtered
     
  9. EMGcircuit

    Thread Starter New Member

    Oct 29, 2013
    4
    0
    My specific application is for a project, during which I have to develop an analog system, which samples EMG from apoplexia patients and monitors their muscle activity in certain muscles to prevent what is known as compensatory movements (Patients use their core and / or shoulder region to move their arms, when they should be using... well... their arm, which can lead to pain and loss of control)... Anyway my circuit is currently:
    An instrumentational amplifier (small gain ~ 10) -> high + low pass filter (butterworth) -> OpAmp (gain ~ 300)

    From here on, I'm in trouble when it comes to the further components of my circuit. Even with my filters, I still have those large spike, which would turn my vibrator on / off. I assume it'll have to involve a full-wave rectifier and then we're back to my initial statement. I do have access to MATLAB, but this particular system is supposed to be using by patients at home, so there should not be any external analysis of the data recordings, but rather have it all done by components of the circuit.

    As noted in a previous comment by #12, I am not particularly interested in one exact spike of EMG, but rather the amplitude tendencies which can be drawn from it. Ideally, I would like to implement a Schmitt-trigger, which would supply the output to the vibrator.


    #12, I think you may be onto something, however, I see a potential problem with integration of the signal. Say, for example, if the patient has medium (but allowed) muscle activity for a certain amount of time, then because of the integration, wouldn't that eventually add up to an amplitude value, which is "not allowed" and then trigger the vibrator falsely? Also, how would I set the time frames in which the signal in integrated and then reset from 0?
     
  10. #12

    Expert

    Nov 30, 2010
    16,261
    6,768
    The resistors marked, "charge time" and "discharge time" are used to set how much time the subject is allowed to move before an alarm and how fast the integral dissipates toward zero. You are just going to have to tell the subject to hold still because "allowed" movements create exactly the same signals as, "not allowed" movements.

    You can replace the second amplifier with a Schmidt Trigger or add a positive feedback resistor to turn the opamp into a Schmidt trigger. I think the second option is right because it would be adjustable.
     
    Last edited: Oct 29, 2013
  11. EMGcircuit

    Thread Starter New Member

    Oct 29, 2013
    4
    0
    This might not be a problem, afterall. My current plan is to sample data from a muscle that should be next-to inactive during an exercise, so I guess it would be possible to create such a configuration that would allow just a tiny bit of movement, but have the alarm threshold and dissipation times set rather strict
     
  12. #12

    Expert

    Nov 30, 2010
    16,261
    6,768
    Here are some numbers to start with. No guarantees, just ballpark numbers that won't pi$$ off the amplifiers.
     
  13. EMGcircuit

    Thread Starter New Member

    Oct 29, 2013
    4
    0
    Perfect, I'll just run this proposed solution + numbers by my fellow students and see how they like it.
     
Loading...