Engineering

Outreach

Resources

Enrichment

Green Engineers

Mechatronics Studio

Contact Us

Mechatronics Learning Studio

 

Electromyography Controlled Car

Katelyn Genoud, Hassaan Khan, and Kyla Sun, Department of Mechanical Engineering, University of Ottawa

 

Introduction

An electromyography (EMG) controlled car is one of many examples of a mechatronics system.  EMG is a technique that is used to record and evaluate electrical activity that is produced by skeletal muscle impulses.  EMG was originally used and designed for medical research and disease diagnosis. However, more recently, EMG has been applied and implemented in control systems such as prosthetics and robotics.  This technology allows users to control any mechatronics device with small muscle movements without physically straining the body.  EMG can be used to control anything from airplanes to cameras.  In this case, we have selected a remote control car to simulate an EMG control system.

 

 

In an EMG controlled car there are two analog inputs and two analogs outputs.  The analog inputs are the EMG sensors that are connected to two set of muscles of the desired muscle groups, such as forearms and biceps.  The four analog outputs are the directions that the car can move (forward and backward).  This system is made possible by four different elements: the sensors, the signal conditioning, the Arduino, and the car.

 

 

The EMG sensors are connected to the signal condition which is the circuit that is composed of an instrumentation amplifier, a high pass filter, a low pass filer, and a precision rectifier; all of which will manipulate the signals from the inputs to obtain the appropriate requirements for the Arduino.  Since there are two sets of EMG sensors, there will also be two circuit boards in correspondence.  These circuit boards are all connected to the Arduino which can be broken down into three parts: the analog-to-digital converter, the multiplexer, and the digital-to-analog converter.  The Arduino is what makes the communication (signal exchange) between the remote controlled car and the EMG sensors possible.  The Arduino is then connected to the remote control circuit which sends all the signals to the car, so the car can move.  An EMG controlled car can be wireless or connected with wires to the whole system, however out of convenience the described system is wireless, which also allows the car travel over a larger range of distance.

 

 

Sensors

The sensor is a fabric coated with a 0.5% saline based conductive gel and AgAgCl.  They are 10-mm in height and 1.25 by 0.875 in length and width.  The sensors are snap-on style to avoid constant wire tempering within the circuit; thus the input wires are not constantly being changed. 

 

It is ideal to wipe down the body where the sensors will be placed before placing the sensors with alcohol to increase the quality of contact and better conductivity.  It is also advised not to apply the sensors to oily skin, skin with make-up, dry skin, scar tissues, or fairly hairy skin.  The sensors can be placed on any muscle group in the body; however for convenience of the project we have chosen the biceps and the forearms.  Two of the sensors are placed on the muscles and one is placed on a surface close to the bone for grounding.  When the sensors are placed on the biceps branchii or the brachioradialis (as seen in the diagram below), the ground will be placed on the wrist or elbow.

 

 

 

Signal Conditioning

The signal conditioning allows the analog signal from the EMG sensors to be manipulated to meet the requirements of the Arduino so the mechatronics system can fully function.  As mentioned earlier, the signal conditioning is comprised of four different parts: the instrumentation amplifier, the high pass filter, the low pass filter, and the precision rectifier.

 

 

Instrumentation Amplifier

The purpose of the instrumentation amplifier is to eliminate noise in the circuit.  The instrumentation amplifier model used in this application is the INA118.  THE IN118 is an instrumentation amplifier that can be used for any general purpose with exceptional accuracy.  The circuit inside the IN118 has a three operational amplifier design (two non-inverting amplifiers and a differential amplifier), as shown in Figure 4.  The design features for the IN118 are:

         The bandwidth can be as wide as 70kHz  at a high gain of 100 due to the current-feedback input circuitry

         It can have an internal input protection that can withstand up to μ40V without damage

         The gain can range from 1 to 10000 when set by a single external resistor

         It is trimmed from a low offset voltage of 50μV, a drift of 0.5μV/μC), and a high common-mode rejection of 110dB at G = 1000

 

 

High Pass Filter, Low Pass Filter, and Precision Rectifier

            The purpose of the high pass filter is to pass high frequencies and cut off frequencies that are too low.  The low pass filter does the exact opposite, so by having both a high pass filter and a low pass filter, a perfect range of frequencies will be obtained in the circuit.  The precision rectifier is used in the circuit to cut off the noise in the circuit resulting in a clean signal.  These three parts of the signal conditioning use the same operational amplifiers.  The operational amplifier chosen for this circuit is the LF351.  The design features of the LF351 are:

  • The offset voltage is internally adjustable
  • Low power consumption
  • Low input bias and offset current
  • There is protection for output short-circuit
  • Internal frequency compensation

Programming the Arduino

The arduino was programmed to hack the original remote control of the car, so that the EMG sensors will control the car whenever there is muscle flexion.  Once the user flexes his/her muscles, the car will move until the user flexes his/her muscles again to stop the car.  The code for the programmed Arduino can be viewed in the appendices.

Implementation

 

 

 

Appendices (Arduino Code)

 

//forward code

int ForInPin = A0;         // the number of the input pin

int ForOutPin = 13;       // the number of the output pin

 

int state1 = HIGH;      // the current state of the output pin

int reading1;           // the current reading from the input pin

int previous1 = LOW;    // the previous reading from the input pin

 

// backwards code

int BackInPin = A1;         // the number of the input pin

int BackOutPin = 12;       // the number of the output pin

 

int state2 = HIGH;      // the current state of the output pin

int reading2;           // the current reading from the input pin

int previous2 = LOW;

 

// the follow variables are long's because the time, measured in miliseconds,

// will quickly become a bigger number than can be stored in an int.

long time = 0;         // the last time the output pin was toggled

long debounce = 200;   // the debounce time, increase if the output flickers

 

void setup()

{

  pinMode(ForInPin, INPUT);

  pinMode(ForOutPin, OUTPUT);

  //

  pinMode(BackInPin, INPUT);

  pinMode(BackOutPin, OUTPUT);

}

 

void loop()

{

  reading1 = analogRead(ForInPin);

 

  // if the input just went from LOW and HIGH and we've waited long enough

  // to ignore any noise on the circuit, toggle the output pin and remember

  // the time

  if (reading1 >20  && previous1 <20 && millis() - time > debounce) {

    if (state1 == HIGH)

      state1 = LOW;

    else

      state1 = HIGH;

 

    time = millis();   

  }

 

  digitalWrite(ForOutPin, state1);

 

  previous1 = reading1;

 

  //back code

  reading2 = analogRead(BackInPin);

 

  // if the input just went from LOW and HIGH and we've waited long enough

  // to ignore any noise on the circuit, toggle the output pin and remember

  // the time

  if (reading2 >10 && previous2 <10 && millis() - time > debounce) {

    if (state2 == HIGH)

      state2 = LOW;

    else

      state2 = HIGH;

 

    time = millis();   

  }

 

  digitalWrite(BackOutPin, state2);

 

  previous2 = reading2;

 

}