Data Acquisition And Analysis Of Movement Phase 1

Recently I have started to run.  It is not fun at all but I need to do it to improve my health.  While running a thought popped into my head, “I wonder what my movement looks like?”  Thus the start of a project.

Objective:  Collect the movement of my legs and then model them to see the change in X Y Z axis along with roll, pitch, and yaw of my legs.


Phase 1)

The first step in all of this is seeing what sensors are out there and figuring out what we need.

The set up is to first measure the acceleration and rotation of the thigh and just below the knee.  I used 4 sensors, one attached to my hip, one at the top of my thigh, one just above me knee and one just below my knee.  All the information will be put on a SD card to be analyzed with a more powerful computation program.


Figure1: Placement of sensors (1)

All sensors are oriented the same way, all X + are pointing forward of the person.  All Y+ is point into the earth and Z+ is coming out of the image towards you.

To keep everything small an Arduino pro mini was picked.  this is a very small micro controller that is about 1″ x 2″ in size.  I picked the 3.3v version as oppose to the 5V version because I needed to run this off a Lipo battery and a single cell Lipo outputs 4.2 to 3.4v.  the pro mini RAW pin has a built in voltage regulator thus I can use that to power everything form the battery.

form SparkFun, the 6 axis IMU (LSM6DS3) this chard was picked because it ran of 3.3V which the Arduino pro mini runs off of.  It was able to output to SPI which allows for more than 2 sensors connected to a single Arduino .  the two comes about because if the I2C communication protocol was used, there are only 2 address that can be picked form.  the SPI allows for many more.

The SPI control is also important to note since that is the communication method of the micro SD card.  Thus at the end of it all, there are 5 breakout boards using SPI communication.

All the data will be dumped onto a SD card that will be attached to my self as I run.  The only thing to note is that the chipSelect pin is set to pin 10 in the below code, but that is just for testing.

The Pro mini is programed using a FTDI programmer. Which is just a usb to serial connection.

First the acceleration change of running was collected.  A harness was made to keep keep the sensors in the correct position. The Fritzing diagram below shows the connections of everything and where the wiring should go.  To keep things clean and organized I used ribbon cables to run the signals and power to each board.  One of the issues that came about was connecting the MISO, SCL, MOSI, GND and VCC ribbon cable to each board then bridging it to the next one.  To accomplish this, I attached a sturdy lead wire out of a 5-pin connector, and then tied the 2 wires for VCC to it, soldered it up and attached it.  then added shrink wrap to keep it all connected.


Figure 2: Basic circuit diagram


Figure 3: Board created

Using the data collected from the sensors, I used Sci Lab to analyze and graph the data.  Integrating over the data at the delay built into the code allowed me to get the velocity at any given point and the position of the each sensor on the harness as I ran.harness.jpgFigure 4: attached Harness

It should be noted that the data is very noisy and after reviewing the data log file, there were a few blank lines.  For a proof of concept this was a success.  A lot more refinement is needed.  With time permitting, there should be more refined graphs below.Position-7

Figure 5: Position with respect to time

Since each sensor believes its at the center of the universe, we need to add offsets to the analysis to be able to get a reasonable diagram of what is going on.  To do this, I set the sensor at my hip as the 0,0,0.  the rest of the sensors will have to get a off set form that location.  That offset is the distance each sensor was form each other.  Now, the only value that needs to be adjusted is the Y direction value, since all the rest of the directions work on the same plane just offset by the Y direction.  This assessment can be made by looking at figure 1.



A few problems came about while running the experiment.  The first and most important one was that one sensor was not working due to the chip select pin not being connect.  that needs to be secured.

While running, my natural arm swing kept bumping and hitting some of the wires on the harness.  For the next phase, that will need to be secured better to avoid accidentally pulling a wire out.

A personally preference is that the Arduino and a few of the other components where directly soldered onto the protoBoard.  That makes it difficult to replace the controller if something breaks.  the board needs to be rewired and re soldered to allow easier replacement of the micro controller.

the last this is to add a switch to turn on and off the battery.  the current method is to just attach two leads to the board and it turns on.  I would rather have a toggle switch that allows me to turn off and on the board as needed.

besides the pin not being connected a lot of the issues than came about are more ease of use and preventive measures as oppose to functionality.

The next phase will be to do more signal analysis of the data and make it much cleaner along with adding more sensor to record the lower half of the leg and feet movement.


(1) “Anatomy Atlases: Atlas of Human Anatomy: Plate 14: Figure 2.” Anatomy Atlases(Tm) : A Digital Library of Anatomy Information,