Introduction: Reading Body Movement

Picture of Reading Body Movement

In this lesson, you continue to use the handmade flex sensor and concepts learned in the Analog Input lesson. You will observe your body's movements in order to determine the difference between sitting straight and slouching. You will then use the handmade flex sensor to capture the bending parts of the body and learn how to test it in different places while evaluating sensor values.

You will learn how to:

+ prototype sensor placement on the body

+ read a body's movements through sensor placement


Materials

Picture of Materials

Download the attached file for this lesson's final sketch. I will also show you how to open it in the Arduino software.

+ microcontroller

+ USB cord

+ alligator leads

+ fitted t-shirt

+ handmade flex sensor

+ resistor for voltage divider circuit from the Analog Input lesson (mine is 680 Ω)

+ resistors nearest to the voltage divider resistor value to experiment with (e.g. 470 Ω and 1k Ω)

+ velcro


Observe

To know where to put the sensor so you can read whether you are slouching or not, you need to observe the movement you are trying to capture. You can do this without taking photos. Move your body into a slouching position then straighten up. Notice where your body curves the most when you are slouching. Sometimes it is beneficial to wait until you naturally are slouching again then take notice rather than forcing yourself into a slouch.

When I work at a computer, which is often, I know I should have good posture while sitting. However, instead of sitting up straight with my shoulders back I end up in a position that is closer to a crumpled piece of paper.

What I should be doing while sitting at the computer.

I should also be sitting back and letting the chair give me any lower back support that it can offer. Still, here you can see that my back should be straight with the shoulders back.

What I really look like while working.

Slouch and straighten a few times to observe the places that curve. Feel free to take your time to observe yourself over a day or two.


Choose Two Spots

Picture of Choose Two Spots

While observing myself I found two areas where my body curved while slouching: the front of the shoulder and the middle of the torso. Observe your own movements and see if you come up with any other areas that bend when you slouch.

To follow along step-by-step choose the shoulder and torso like I did to focus on. If you would like to explore another area feel free to add a third. You will be testing all these places and will choose one in the end.


Testing One Sensor in Multiple Places

Picture of Testing One Sensor in Multiple Places

When testing how to best capture a movement with a sensor you need to be able to move it around the body easily. Sticky-back velcro is good for this, it can be repositioned on the garment and allows you to secure the sensor down in multiple places.

There are two sides to velcro, the loop (softer), and hook (harder) side. Cut two pieces of the hook side and one of the loop to match the length of your flex sensor. Peel the backing off both hook pieces and press them onto the t-shirt where you want to test: the shoulder and the torso.

Place the loop side onto the back of the sensor.


Clip to Sensor

Picture of Clip to Sensor

While the sensor is still off the t-shirt, grab two alligator leads and clip them to the sensor.


Place the Sensor

Picture of Place the Sensor

It's time to put the sensor onto the body! Let's start with the shoulder area, press the sensor down onto the velcro and smooth down.


Build Circuit

Picture of Build Circuit

The sensor is placed and now you are ready to read some values in the Arduino software! By looking at how the sensor behaves in Arduino you will be able to determine if it's in a good place to capture the bend in the shoulder area that happens when you slouch. This is the same circuit from the Analog Input lesson minus the LED. Below you can also see that I am connecting to the resistor without using the felt breakout. Either way works.

While it is velcroed to the shoulder, connect the sensor to the LilyPad. Don't forget the resistor!

Connect the circuit as illustrated.

flex sensor --> power (+)

flex sensor --> resistor

resistor (same side the flex is connected to) --> pin A2

resistor --> ground (-)


Upload

Picture of Upload

In Arduino navigate to:

File > Examples > Basics > AnalogReadSerial

Copy, paste and save the sketch as analogReadDemo.

The difference between this sketch and the one you started off with in the Analog Input lesson is that there is no LED. This sketch just reads the sensor's varying voltage and serial prints the values to the serial monitor. If you haven't already, connect the board to your computer via USB and turn the board on. Hit upload.


Turn board on.


Upload sketch and open serial monitor to see sensor values.

Once the sketch is uploaded open the serial monitor.

Look at the stream of values while you are in a straightened position. Now slouch and watch what happens to the sensor values. They will be jumpy but you should see the values go up. Repeat the action: straight, slouched, straight, slouched. What you are looking for is repeating behavior from the values. You also want the difference between the values you get while straight to be far enough away from the values gotten while slouched. For example, If your values are at 700 when straight and around 730 when slouched that 30 value difference is most likely going to be too difficult to read accurately each time. Especially when the sensor's values jump quite a bit. Even when you smooth the values, which you will do eventually, you need the difference to be as large as possible.


Try Different Resistors

Picture of Try Different Resistors

In the Analog Input lesson you learned that the varying voltage being read depends on the relationship between the resistance of the sensor and fixed resistor. You can change the range of values by changing the value of the fixed resistor. Grab a resistor that is close to the value you have been using. For example, I have been using a 680 Ω resistor so I am going to try a 470 Ω resistor. Swap resistors and watch the values change in the serial monitor.

Now go up and try the 1k Ω resistor. You can see the range of voltage changing. The goal is to end up with a large range of values to work with. If you prefer, feel free to swap the resistor you started with out for one you just tested.


Try Multiple Placements

If you feel like the values you get while straightened and slouched are too close together try repositioning the sensor on your shoulder. Do this by removing and sticking the velcro and sensor sandwich to another position. For example, I found that if I angled the top of the sensor more towards the point of my shoulder I got a larger difference. As you experiment and move the sensor around record the straight and slouch values for each position. In the least, record the straight and slouch values for the position you like best on the shoulder.


Old position.


New position.

After you have experimented with the shoulder, try the sensor at the second position on the torso and see what kind of readings you get there. Remember, you want the values to be able to hit a general range of values repeatedly. You will smooth the sensor values later so that will help with any jumpiness. Record the straight and slouch value from the torso reading. You should now at least have two sets of values.

1) Straight and slouch values for shoulder

2) Straight and slouch values for torso

Have fun with this step! Take some time to test different parts of the body.


Choose the Final Placement

Picture of Choose the Final Placement

Take a look at your sensor readings and choose a place that you feel will allow you to capture a slouch. Another thing to remember is comfort. Although I saw a bigger difference between straight and slouch on the torso, I partially decided to go with the shoulder for comfort. The other factor was visibility, it's easier to illustrate the final circuit when the sensor is on the shoulder.

Pick one spot that you got some good readings from. Once you have decided, you are done with the testing and placement of your sensor! Take it off of the shirt carefully leaving the hook side on the t-shirt so you know where it goes once your transfer the circuit onto the t-shirt.

In the next lesson, you will alligator clip the rest of the circuit together and upload the final sketch.


Test Your Knowledge

{
    "id": "quiz-1",
    "question": "Is it easier to move a sensor around the body using pins or Velcro?",
    "answers": [
        {
            "title": "Velcro",
            "correct": true
        },
        {
            "title": "pins",
            "correct": false
        }
    ],
    "correctNotice": "That's correct",
    "incorrectNotice": "That's incorrect"
}
{
    "id": "quiz-2",
    "question": "The value you get when you have a straight back and the value you get when you slouch should be…",
    "answers": [
        {
            "title": "as close to each other as possible",
            "correct": false
        },
        {
            "title": "as far away from each other as possible",
            "correct": true
        },
 {
            "title": "the same value ",
            "correct": false
        }
    ],
    "correctNotice": "That's correct",
    "incorrectNotice": "That's incorrect"
}

Where did you place your sensor? Share a photo of the sensor in the spot you chose below!

CLASS PROJECT

Share a photo of your finished project with the class!

Nice work! You've completed the class project