You are on page 1of 9

Grace Bingham, Cameron Larks, and McKenzie

Windham

MYOWARE
MUSCLE SENSOR
AND LCD DISPLAY
BE 2352 Section 1 Final Lab Project
McKenzie Windham, Grace Bingham, Kameron Lark

BE 2350- Section 1

Final Project: Myoware Muscle Sensor

23 April 2016

Myoware Muscle Sensor

Objectives and Overview:

Ad a er Te h olog ’s Myoware muscle sensor is capable of reading the voltage produced by

flexing muscles, and outputting it as analogue (Electromyography Sensor for Microcontroller

Applications). This technology is easily accessible, because it is made to work with Sparkfun and Arduino

IDE, two open source technologies. The goal of this project was to have the muscle sensor read the

voltage of flexing muscles, have the program convert it from analogue to voltage, and for the LCD to

read the voltage as it varies.

Due to the flexibility of the Sparkfun RedBoard and Arduino IDE, this project had very few

constraints. The length of the wire connecting the sensor and the red board had to be long enough to

allo for eas o e e t ithout dis o e ti g the se sor. Be ause the se sor’s output is a alogue, it

had to be converted to voltage. The placement of the sensor also had to be considered, and is further

discussed in the assembly section.

List of Parts:

x Sparkfun electronics RedBoard (programmed with Arduino)

x Bread Board

x 19 jumper wires

x Liquid Crystal Display (LCD)

x Potentiometer

x MyoWare Muscle Sensor (Advancer Technologies) with header soldered on


x Muscle Sensor Surface EMG Electrodes (at least 3 for sensor)

x USB to mini-USB cord (to transfer program and supply power to the circuit)

x Test Subject

x Extended cable comprised of three wires weaved together for mobility

x Computer capable of loading Arduino IDE software and uploading program to RedBoard

Assembly:

First, assemble the parts listed above, this includes: soldering the header onto the MyoWare

Muscle Sensor; creating the extended cable with proper connection methods on both ends to the

Muscle Sensor and RedBoard; and snapping the Muscle Sensor Surface EMG Electrodes onto the Muscle

Sensor. Do not remove the paper backing on the electrodes until you are ready to place the sensor and

test.

Next, one should construct the two circuits displayed in the schematics using the breadboard

and RedBoard. To provide organization and easily distribute power and ground source to the circuit,

take two wires: connect the first jumper wire from the 5V on the RedBoard to the (+) column on the

breadboard; connect the second jumper wire from the ground (GND) on the RedBoard to the (-) column

on the breadboard. In our first circuit (see Circuit 1 in Appendix), we have an LCD (Liquid Crystal Display)

connected to the RedBoard to the ground, 5 volts, and

digital outputs. This is so the LCD may receive power, as

well as receive the output of our muscle sensor to display it

visibly on our LCD in a numerical format. The LCD is also

connected to a potentiometer, a variable resistor, through


Figure 1: Circuit 1 and Circuit 2 both
the VO pin. The potentiometer has a knob that will allow us setup on the breadboard and RedBoard.

to change the contrast on our LCD screen for a better visual interpretation of our output readings. The

second circuit (see Circuit 2 in the Appendix) is meant to supply power through the 5V (+) column
established earlier, a ground through the (-) column established earlier, and a path for the output

directly to the RedBoard through the A0 pin to the muscle sensor.

Two electrodes should be placed directly on the back of the Myoware Muscle Sensor for

precision testing of muscle activity, and one attached to the

connected black cord, which serves as the control sensor. The

placement of these electrodes once connected to the Muscle

Sensor is a major component of how accurately the sensor Figure 2: The Myoware Muscle Sensor
placed on the center and end of the
will perform. The electrode on the sensor closest to the wires flexor mus le of the test su je t’s left
forearm.
outputting the signal should be placed on the center of a

muscle close to the skin. The second electrode on the muscle sensor should be placed at the end of the

muscle. Lastly, the electrode attached to the black wire should be placed on a separate muscle as a

control. See Figure 2 for visual representation of electrode placement. For this test, we chose a flexor

muscle on the underside of the forearm (most likely flexor digitorum superficialis). Cleaning the area of

ski efore testi g is ad ised to e sure o dirt is prese t that a hi der the se sor’s a ilities.

After connecting both circuits to the board and attaching the muscle sensor to the test subject,

you are ready to upload your program from the IDE software using the USB to mini-USB cord. The

program used in testing will be explained in another section of the report.

Program:

The ode for this proje t had to e put together fro Ad a er Te h olog ’s e a ple ode that

they posted to their GitHub, and Circuit 15, which was an LCD example. Some small changes were made

to suit the needs of the project.

Void setup is the place in the code where everything is put in order, pin modes might be

changed, components may be initialized, and libraries may be included “etup . It will only happen

after power up or reset. In this case, the program was instructed to include all functions from the LCD
library. This saves some time and space that we otherwise might have had to spend building and

defining these functions. The interface pins of the LCD were initialized so that the program would

recognize them.

The serial communication between the muscle sensor and the computer was set at 9600 bits per

second, using the serial.begin function. Finally, using lcd.begin, the LCD dimensions were defined to be 2

by 16.

Void loop is the place where the program really takes action Loop() . As its name suggests, it

loops repeatedly, allowing the program to change in response to input. This loop began by defining the

sensor value integer to be what is going into A0. This was named as such because this is a value that is

expected to change, so, in order to reference it later in the program, it was given a generic name and a

defi itio that the progra a li k it to. The us le se sor’s output is a alogue, hi h is ot of

interest, so it needs to be converted to voltage. This was accomplished via a float function to give the

program instruction on how to convert the analogue value to a voltage value. The conversion is the

sensorValue multiplied by the quotient of the maximum voltage to the maximum analogue value (5V

and 1023, respectively). Using the setCursor function, the LCD cursor position was set at (0,1). Finally,

.println functions were used to tell the program to print to the LCD and the serial monitor of the

computer. The raw code can be found in the Appendix.

Testing Procedures:

A B Figure 3: A shows the su je t’s arm


relaxed, while B shows the su je t’s
arm flexed.

We separated out overall setup

into 2 main groups: the muscle sensor

and the LCD. Before trying the whole thing together, we tested these groups individually, just to make

sure that they were running. For the muscle sensor, we set it up alone on the Sparkfun RedBoard and
breadboard, and ran just the example code. We observed the voltage changes on the serial monitor. For

the LCD, we set it up alone on the Sparkfun Redboard and breadboard, and ran Circuit 15. Once we saw

that they were operational individually, we set them up together and ran the code that we built for it.

We had the subject seated, resting her arm on her thigh. The muscle sensor was placed on her forearm,

as shown in Figure 3. Relaxed was when her hand was allowed to rest flat, while flexing was when a fist

was made and curled up, which the arm remained resting on the leg. These positions may be seen in

Figure 3. We observed the lowest voltage obtained when the subject was not flexing, and watched the

serial monitor for significant variation when the subject was flexing. We also checked to make sure that

what we saw on the serial monitor was what appeared on the LCD. We allowed this process to continue

for a period of time, disconnected and repeated to assure we were receiving similar results.

Data analysis:

For data collection, it was important to keep the muscle sensor in the same location on the

forearm for each trail. Two trails were run which consisted of approximately twenty seconds. These

twenty seconds included two muscle contractions also. Figure 4 shows the voltage for each trail for

approximately twenty seconds. The peak of each line on the graph represents each time a muscle was

flexed. The highest output read when the muscle was flexed was about 4 Volts. The lowest points on the

graph represented when the muscle was relaxed. This output ranged anywhere from 0.17-0.47 Volts.

These voltages are accurate because we started a flow function in our program. We changed our values

to float voltage so the scale could be higher.


Figure 4. Sensor reading of muscle contractions and relaxations for 2
trails.

Potential Issues and Complications:

There were numerous complications encountered during this project. Some of which could have

been avoided if the parts were troubleshot before beginning. The first complication involved coding.

Usually a code is provided but in this case we had to tweak an example code. Circuit 15 from the SIK

Guide was used to set up part of the circuit since we were using

an LCD screen (Liquid Crystal Display). In order to get visible

readi gs o the LCD s ree , a LCD pri t output fu tio had to

incorporated into the code. Another issue was that the MyoWare

Muscle sensor needed to be soldered. To save time, we used a

previous sensor from a senior design group. Once the circuit was

complete (Figure 5) and the sensor was set up, the program kept Figure 5: One of the muscle
sensor setups.
reading one numerical voltage throughout the time of testing.

Whether the muscle was relaxed or flexed, only one number was read. An explanation for this could

have been that most of the power went to the LCD, which interfered with the sensor reading. The actual

issue was the muscle senor itself, not the LCD. Once we switched to a new muscle sensor, the readings

were appearing accurate but were not showing up on the LCD. To test the LCD, we disconnected the

muscle sensor and set the LCD up with Circuit 15 alone. The LCD was switched 3 times and it still would

not work. The only part that could have been an issue was the potentiometer. We changed the

potentiometer and everything finally worked properly.

Summary:
The Myoware Muscle Sensor, when combined with Muscle Sensor Surface EMG Electrodes, is

capable of tracking muscle movement through electrical activity. By creating a code that utilized both

the Liquid Crystal Display and Myoware Muscle Sensor, we were able to program the RedBoard to

denote the analog output of out muscle sensor onto our LCD in voltage format. To achieve this, we

needed to establish a test that ensured our muscle sensor and LCD setup was working. We placed the

muscle sensor on the underside of the left forearm of our test subject, with one electrode on the middle

of the muscle and one on the end of the muscle. As the test subject clenched her fist there was an

increase in our output voltage, so our test was successful.


Works Cited

Electromyography Sensor for Microcontroller Applications (n.d.): n. pag. Advancer Technologies.


Advancer Technologies. Web. 20 Apr. 2016.

Loop ." Arduino. N.p., n.d. Web. 20 Apr. 2016.

"Setup." Arduino - Setup. N.p., n.d. Web. 20 Apr. 2016.

"SIK Guide. Vol. 3. San Francisco: SparkFun Electronics. Print.

Appendix

Schematics

Circuit 1: Circuit 2:

Program

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
Serial.begin(9600);
lcd.begin(16, 2); }
void loop() {
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.0);
Serial.println(voltage);
lcd.setCursor(0,1);
lcd.println(voltage); }