We were motivated to begin this project because of the widespread issue of poor posture and its negative effects. Incorrect posture is a seemingly insignificant hazard to one's daily health, but when it continues, it can lead to serious health issues and pain. Sitting or standing in a poor posture creates a multitude of both long and short term problems including tension headaches, diminished breathing, fatigue, chronic back pain, or even more serious internal damage such as intestinal bruising and other complications. This is a device we actually would use in our daily lives to help prevent some of the problems listed above.
The following are steps to create a Posture Sensor to make users more aware of their posture. When the user needs to adjust their posture, they will feel a vibration from the wearable system. This Posture Sensor is an effective way to record instances of bad posture in both short-term and long-term methods. The system will vibrate to notify the user that they are slouching. It also stores the amount of times the user had to adjust their posture and will return that value when the user takes off their wearable system that day. With proper use, the user will hopefully improve their posture will no longer need to wear it.
Step 1: What You'll Need
- LilyPad Arduino Simple Board
- LilyPad vibration motor
- LilyPad button
- Flex Sensor
- 10 ohm resistor
- Alligator Clips
Not shown in Photos:
- Conductive Thread OR Thin Copper Wire
- Wire Strippers
- Soldering Iron
- Exercise shirt, closely fitted to the body
- A shirt-sized piece of scrap fabric
- Plain Thread
Get What You Need here >>> https://www.sparkfun.com/
Step 2: Preparation
You should have a basic understanding of how electricity works. You don't want to have anything short circuit or fry your board. Read over the material from the links below to prepare yourself.
You will also want to have some coding experience so you can manipulate the code for your own project and make it even better than ours! Here is a link below that can help you with programming your Arduino/LilyPad.
Step 3: Connecting the System With Alligator Clips
Connect the alligator clips to the Lilypad, button, and sensors as shown in the Fritzing image above:
- Connecting the flex sensor with alligator clips is tricky, be careful that the positive and negative ends are not touching.
- The resistance is supposed to be built into the LilyPads, but it is difficult to get an accurate reading from the Flex sensor without a resistor in this instance.
-We are taking inputs from the Flex sensor and the button so we have them hooked up to analog pins.
**Pos = Positive
**Neg = Negative
Button : Pin A5 > S , Neg > Neg
Vibe Motor : Pos > Pin 6, Neg > Neg
*** The positive end of the flex sensor is the "railroad track side" as we like to call it.
*** The negative end of the flex sensor is the skinny white strip.
Flex Sensor/ Resistor Combo:
- Pos prong > Pos Pin on LP board
- Neg end of Flex sensor > resistor, Resistor > Neg Wire, Pin A2 wire > Resistor
** For the above, you will solder the wire running to A2 and to the Negative pin anywhere on that end of the resistor.
Step 4: Programming the LilyPad
Once the system is set in place with alligator clips and all correctly connected, the code must be implemented into the LilyPad so that the information can be processed into an interpretable manner.
Download the code from the link below:
-The sensor reading is just something that will read the sensor and write the value. You can use this to test your flex sensor.
These are important parts of the code that makes this system work. You can make changes to them to make the code work better for you.
// This part of the code includes the EEPROM function and the serial function so that you can read the data and display it on your computer.
// This part of the code is essential as it lets the lilypad know what pins the sensors are plugged into and how to treat each sensor.
// This part of the code tells the lilypad that the device should be in what we call, the "off" mode. It then has the lilypad wait until the button is pressed. Without the delay, when you push the button at the end of the day, it turns your device off and then back on before you have time to take your finger off of the button.
if (button_pressed == 0)
val = 0;
power = digitalRead(button);
if (power == LOW)
button_pressed = button_pressed + 1;
// This part of the code is what we call the "on" mode. After the button is pushed for the first time, the device will turn on and begin reading the flex sensor.
else if (button_pressed == 1)
int sensor_1 = analogRead(flex_sensor_1) / 4;
// These two lines of code are what define what we have considered to be good and bad posture. The first line is bad posture and the second is good posture.
if ((sensor_1 < 115) || (sensor_1 > 130))
if ((sensor_1 > 115) && (sensor_1 < 130))
// Turns the vibration motor on when in bad posture and then delays for one second giving the wearer enough time to adjust themselves.
// This part of the code tells the device what to do when the button is pressed a second time. It checks to make sure that it is writing the correct data to the correct address for the EEPROM and makes sure that the data it is writing is valid. Then it returns the device to the off mode. This code appears in two separate if statements to make sure that the device can be turned off whether the person is sitting with good posture or not.
if (button_pressed == 2)
if (addr >= 7)
addr = 0;
if (val < 256)
addr = addr + 1;
button_pressed = 0;
else if (addr <= 6)
if (val < 256)
addr = addr + 1;
button_pressed = 0;
// This part of the code tells the serial what to display for each address. Address zero is Monday, address one is Tuesday, and so on. The printed lines will display for each day of the week and the data will be stored for only seven days.
if (address == 0)
value = EEPROM.read(address);
if (value == 255)
Serial.print("You did not wear your shirt on Monday.");
address = address + 1;
Serial.print("You had bad posture ");
Serial.print(" times on Monday of this week.");
total = value;
address = address + 1;
Step 5: Testing Your System/Troubleshooting
If your system is not properly working by this point, breathe and relax! It is common for troubleshooting issues to arise already, but they are more often than not very manageable problems. Some of the problems we encountered included:
-The flex sensor can create a variety of issues including seemingly random values. We learned through experience that this may not have to do with the flex sensor itself but with the alligator clips connecting it to the system. These clips are easily manipulated and, if touched, will cause a breakdown in reading values from the flex sensor. They also disconnect very easily and in a project like this it becomes an all too common occurrence. Our solution was to ensure the alligator clips do not touch one another at the flex sensor, or if you feel confident in the rest of your system to solder one end of two wires to the flex sensor and abandon the alligator clips. You can always use alligator clips on the open ends of the soldered wires if you are not quite comfortable soldering the rest of your system anyway.
-Be careful in how you thread the wiring through the Lilypad! It must be wrapped around the holes with a tension that allows for some movement but will hold firm against the systems weight when sitting/standing.
-Of course, always wear protective wear when soldering anything. With safety in check it is also important to be tedious and precise with soldering, as some of these parts cannot overlap in conductivity.
-If you are having code issues, try to isolate the problems by turning on and off different components of the system. For example, if the button is not properly working then comment out the button portion of the code to see if that is truly the problem. If the issue persists, try the flex sensor code, etc.
Step 6: Replace Alligator Clips With Wire or Conductive Thread
LilyPads are often "wired" with conductive thread. However, since we were using a flex sensor and some other tricky components like the resistor, we decided to use really thin copper wire and solder the parts in place. Simply replace the alligator clips you have connected together according to the Fritzing diagram using the method of your choice(wire or conductive thread). This will give you a much sturdier system that can be worn and tested.
- Wear protective eyewear while soldering.
- Don't touch the hot soldering iron.
- Unplug the soldering iron after use.
- If your Solder has lead in it, wash your hands after use.
- Lastly, when soldering together metal parts, remember that not just the solder site of that part will heat up, but the rest of the part as well.
-Strip the wire about a half of an inch where you plan to solder to the sensor/parts. You want enough wire to work with but still keep most of the wire wrapped and protected.
-Strip the wire anywhere from an inch to an inch and a half where you connect it to the board.
- Connecting parts to the board: Wrap your wire/thread through the holes on the Lilypad multiple times for a strong connection as shown above.
-Be as minimal as possible when soldering the wires. Particularly where the resistor is placed, it is important that each connection remains separate and doesn't touch other parts of the system. A small, well placed, drop of solder is all that is needed to securely connect these components.
-If you are using conductive thread, be sure to wrap around components several times! Thread can easily become loose and that will result in a weak connection. By wrapping around things several times, you will get a much stronger connection and a better functioning system.
Step 7: Check Your Work
At this point, the system should be properly connected (if not, refer to troubleshooting or leave a comment for us!). It is strongly encouraged to test your system before it is sewn to anything, switching from alligator clips to secured components can change some things, especially when working with conductive thread.
When you are confident in your system to be working normally, now begins the process of translating your work into a wearable device.
Step 8: Transforming the System Into a Wearable Device
Lay out your scrap piece of fabric. You'll want it to be large enough to fit the whole system, but not as large as an entire shirt. You can place your components where you'd like but remember:
- The flex sensor should be placed where it can easily sense the changes in posture
- The button should be easily reached by the user.
- The vibration motor should be placed in a spot where the user will feel it.
We placed our flex sensor towards the top of the spine, our button down closer to the top of the user's hip, and the vibration motor up near the shoulder blades.
Secure the board by sewing/looping through the unoccupied holes on the LilyPad at least 3 times. Sew all of the wires down tightly. We wrapped our thread around the wires leaving them looking like candy canes almost (shown above). Sew them tightly and neatly to prevent the wires moving around. Sew the other components down as well like the button, vibration board, and flex sensor by looping around them with thread. This is a slow process, but a thorough job produces the best results for a wearable device.
Step 9: Make It Removable
Why not sew this onto an actual shirt you can wear?
You can, if you really want to. We chose not to because:
1. We don't want to wash this system, so we want it to be removable.
2. We want to test our system on different body types, so we weren't going to sew it into one shirt.
Use Velcro to switch the system between shirts.
On your scrap piece of fabric/ wearable system, run a strip of Velcro horizontally across the top and bottom edges.
On your plain shirts, run strips of velcro vertically along the left and right side of the shirt.
When you put the wearable onto the shirt, the Velcro should connect in a rectangular shape.
Do the same with other shirts to test it out on different users!
Note** You'll probably have to readjust the sensor threshold when changing the position of the flex sensor from user to user.
Step 10: Here's What You Get
Step 11: Improve Upon Our Work!
1. We would have liked to implement a better visual display using LED's. Perhaps the LED's could change color throughout the day from Green to Red depending on how many times the user has slouched.
2. Implement another flex sensor at different points of the spine/back. Good posture is not determined by one specific point of the user's back.
3. Lastly, you don't have to rely on flex sensors to do this. You can build your very own bend sensor to measure resistance or you can sew in a "coverstitch" pattern to measure resistance as the seam is stretched.
Here are links for the bend sensor: