Introduction: Pressure Sensing Sock Attachment

When it comes to choosing custom orthotics, there aren't many reliable testing options out there that could help you decide what type of insert is best for the needs of your feet. And the options that do exist almost always specifically test the imbalances of forces in your feet while standing still. In reality, you need your insoles to provide comfort and stability during walking conditions as well, not just while stationary. Curious about how we could begin working towards fixing this issue, we decided to design a simple, affordable, pressure sensor sock attachment that hopefully, once improved in the future, could be used to help diagnose any imbalances in the feet of a patient while walking. This diagnosis could then potentially used, in conjunction with existing medical documentation, to create custom insoles for the patient (or recommend existing ones).

Our current design (the one you can make in this instructable) has three sensors that attach to the bottom of any sock, and result in neopixels (small lights) lighting up when they are pressed. All electronic components are housed in an ankle band, and allow pressure data to be sent to your computer via bluetooth and then plotted in real time. We hope to update this design in the future, but for now here is how to build our current prototype!

(Check out the video above to see what it'll do when you're done.)

Preparation

In order to successfully make this device, there are a few things that you will need to know. The code used for the project has been included, but a basic knowledge of the logic involved could be beneficial if you run into any problems. If you have a problem, there are also forums available on the internet where you can post your problem or look for one that is similar to your problem that has already been addressed. Basic knowledge of electrical wiring, although not too complicated, can make the project go together a bit faster. Finally, you will need to solder some fasteners onto the Flora. Brush up on the basics before beginning!

Safety

Before you get started with the project, there are a few safety concerns that need to be addressed. The finished product itself won't hurt you, but electrical safety isn't always common knowledge. To avoid shorting out any of your equipment, make sure that ground is connected to your device before adding power. Also make sure that none of your conductive thread crosses other conductive thread. Doing so could short the circuit and start a fire. Care should also be taken when soldering the fasteners onto the Flora. Soldering tools are incredibly hot and will cause extremely painful burns if you accidentally touch the tip. Make sure you know what you are doing so you don't burn yourself or damage your circuitry.

Hints and Tips

  • Check to make sure the circuit works before doing any sewing or constructing!
  • If you can't seem to get any data output from a pressure sensor, check to make sure the associated pin on the Flora is functional (one of our pins was broken and we had to get a new Flora).
  • Plan out how you are going to fit all of the components on the ankle band in order to avoid crossing conductive threads at any point.
  • Leave yourself extra room when planning to sew the conductive thread onto the band. Having the threads too close to each other presents a risk of them accidentally touching.
  • To save time, plan your thread placement before sewing it together. If you try to sew it without having a clear idea of where everything will go, you will get frustrated and end up re-doing a lot of it anyways.
  • If you're having trouble connecting to the Bluetooth module, unplug the module, forget the device in Bluetooth settings on your computer, and then reconnect to it.
  • To save time, watch some video tutorials on YouTube about sewing wearable electronics onto clothing

Step 1: Gather Materials and Tools

The create the pressure sensing sock attachment, there are a few things that you will need if you want it to work. Some of the things on the list below are required, and some of them are desired for ease.

  1. A Flora (can be found here for $15)
  2. Bluetooth module. We used the Arduino one (HC06 BT) but you can use a Flora BLE wearable module, too.
  3. A pressure-sensitive conductive material such as Velostat ( available here from Adafruit)
  4. Flora RGB NeoPixels, at least three. (A 4-pack is available from Adafruit for about $8 here.)
  5. Conductive thread
  6. Jumper wires (that look like these with at least one female side). You will need 4.
  7. Alligator clips attached to wires (optional, but extremely helpful)
  8. A sewing needle
  9. A small battery, 3.7V should suffice (available here from Adafruit for about $8). Make sure the battery has the proper connector for the Flora.
  10. Velcro pad, at least 2" x 4", plus Velcro dots.
  11. Small (5mm) sew on snap fasteners. You will need at least 18.
  12. Solder and a soldering iron
  13. An old t-shirt
  14. Fusible interfacing fabric, It can be purchased from most craft or sewing stores. Read some tips & tricks here.
  15. An old t-shirt
  16. Scissors, tape, and patience.

Step 2: Create the Pressure Sensors

  1. Cut out 3 pieces from the conductive fabric. One should be small enough to fit under the average person's heel, and the other two should be roughly 1inch x 1inch squares (but shape doesn't actually matter all that much).
  2. Cut six 18-inch pieces of conductive thread.
  3. Tape one piece of thread to each side of all three pre-cut fabric pieces. The thread should be taped down in a 'J' shape as shown in the image above, and should be trailing off the fabric on opposite sides as shown (keeping about a half inch of space between the tails of the threads).

Step 3: Connect the Pressure Sensors to the Flora

  1. Using alligator clips, for each pressure sensor attach one conductive thread tail to a ground pin on the Flora and the other to one of pins 6, 9, or 10 (connections shown in the image above on the left). The code you will be using designates the sensor on pin 9 as that which will be located on the heel, the sensor on pin 6 as that which will be located on the ball of the foot, and the sensor on pin 10 as that which will be located under the outer portion of the foot (beneath where the knuckle of your littlest toe is located). If you have shaped your sensors specifically to be used in one of these locations, make sure it is attached to the correct pin.
  2. Situate the sensors so that they are flat on the table and none of the threads are crossed or touching.

(Note: If you need to fit multiple alligator clips onto one pin of the Flora, stick the end of a small wire between the existing connection and then attach your clip to the protruding end as shown above in theimage on the right.)

Step 4: Connect the NeoPixels to the Flora

  1. Connect each NeoPixel to GND. They can all be connected to the same ground.
  2. Connect the NeoPixels in series, with the first one connected to pin 12 on the Flora.
  3. Pay attention to which way the arrows are pointing. The arrow pointing towards the center is the incoming signal and the arrow pointing away from the center is the outgoing signal.
  4. Connect each NeoPixel to VBATT.

The wiring diagram is shown in the image above as a reference.

Step 5: Wire Bluetooth to the Flora

  1. Connect the GND pin on the Bluetooth module to a GND pin on the Flora.
  2. Connect the VCC pin on the Bluetooth module to a 3.3V pin on the Flora.
  3. Connect TXD on the Bluetooth module to RX #0 on the Flora.
  4. Connect RXD on the Bluetooth module to TX #1 on the Flora.

If the Bluetooth module is wired incorrectly it could lead to frying the circuit or miscommunication between the module and the computer.

Step 6: Construct the Circuit

  • Using the above circuit diagram, assemble all components (DO NOT try using conductive thread yet. For now, just use alligator clips and insulated wires or other temporary wires of your choice).

Step 7: Download the Code and Connect the Flora to Your Computer

  1. Download the code using the link below and open it in Arduino IDE.
  2. If you don't have the Adafruit NeoPixel Library installed, download it from GitHub. Install this library and be sure to include it in your Arduino Libraries folder.
  3. If you don't have the Arduino Filters Library installed, download it here from GitHub. Install it and be sure to include it in your Arduino Libraries folder.
  4. Connect the Flora to your computer with a micro USB to USB cable (pictured above).
  5. Click on "Tools" > "Board" > "Adafruit Playground" to tell the software which hardware you are using.
  6. Click on "Tools" > "Port" and then in the drop down menu select the COM port that your Flora is connected to on your computer.

Here's the code you need!

NOTE: You may need to adjust the thresholds in the code for determining when to turn on/off a NeoPixel. Adjust each one for each sensor.

Step 8: Upload Code to Flora

  1. Click the "Upload" arrow in the top left corner of IDE (circled in the image above).
  2. Because the code has been uploaded, you can now disconnect the Flora from your computer. Communication between the Flora and your computer from here on out will be done through Bluetooth connection.

Step 9: Connect Bluetooth Module to Computer

  1. The light on the Bluetooth module should be blinking at this point.
  2. Open Bluetooth preferences on your computer.
  3. Connect to the module by clicking on the 'HC-06' option.
  4. Once connected, the light on the HC-06 should stop blinkingand remain constant, as seen in the image above.

Step 10: Test Functionality

  1. At this point, the Bluetooth module should be transmitting data from the pressure sensors you created to your computer.
  2. The downloaded code takes this data and plots it as three separate lines (one for each sensor).
  3. In IDE, click on "Tools" > "Serial Plotter."
  4. You should see the three mentioned lines, all likely at different starting values.
  5. Press down on each pressure sensor one at a time to ensure you see a response in its respective plotted line (pressure should result in a dip in the curve).
  6. If you don't see any data being plotted, check to make sure the baud rate on the plot is set to 9600.
  7. Don't move on to the next step until you ensure data is being collected and the plots are responding to pressure on the pressure sensors

Step 11: Cover the Sensors

  1. Cut out pieces of thin, non-conductive fabric (we used an old t-shirt) in the same shapes as your pressure sensors (just slightly larger). Cut out 2 pieces of fabric for each sensor.
  2. Sandwich each sensor between its designated 2 pieces of fabric, and then sew around each sensor (being sure not to puncture it).
  3. Once sewing is completed, cut out 3 pieces of Velcro (the rough side) of the same shape and size as your sensors.
  4. Stick the Velcro to the corresponding newly covered sensors (only on one side of each).
  5. If the Velcro doesn't stick well to your fabric, you can sew it on as well. Again, however, be careful not to puncture the sensors. The Velcro will serve as the method for attaching the sensors to a sock.

Step 12: Plan Your Threading

Now that you have assembled a rough draft of the prototype and have verified that it does indeed work, you can try sewing it together for a final product. Remember, don't cross your conductive thread and plan your stitching before sewing. There are endless possibilities for where to place the Flora, Bluetooth, and NeoPixels. The above image is one possibility that we found worked. The three NeoPixels are connected in series and each is connected to power and ground. Plus, no wires cross! making this an excellent layout.

Step 13: Assembling a Prototype: Sewing Part 1

The sensors are covered, the code works, and you've planned your threading. Now it's time to assemble a final product. We sewed everything onto an ankle band (made from an old t-shirt) that can be wrapped around and secured with Velcro. You can try the same idea, but we encourage playing with it and finding a set-up that works for you! Follow the steps below and make sure to watch your connections!

  1. Iron the interface onto a strip of the t-shirt, being careful about which side is face down. The strip should be long enough to wrap around an ankle and wide enough to sew on the Flora, Bluetooth, and NeoPixels.
  2. Decide where you want to place the Flora, Bluetooth module, and NeoPixels.
  3. Sew the female side of the snaps onto the t-shirt where you want to place the Flora. None of the snaps should touch each other.
  4. Make sure you check locations of each snap as you sew to make sure they will line up with the correct pin on the Flora. (Seen above in image.)

Remember to keep referring to your threading plan throughout these stages so you don't cross wires or forget to connect something.

Step 14: Assembling a Prototype: Sewing Part 2

Now that you have the framework down, let's move onto sewing components:

  1. Glue the NeoPixels where you want them to be. This is not strictly necessary, but it is helpful for holding them in place while you sew them down.
  2. Sew the NeoPixels onto the t-shirt.
  3. Sew the Bluetooth onto the t-shirt. We made a small pocket, as seen in the image above, but exercise your creative mind to decide the best way to hold it down.
  4. Using conductive thread, sew connections between the snaps for the Flora, the Bluetooth, and the NeoPixels.
  5. Don't cross the threads! If crossing threads is unavoidable, put some sort of insulation between threads, like part of the t-shirt.

Step 15: Assembling a Prototype: Sewing Part 3

Once the NeoPixels are sewn down, move onto connecting the pressure sensors to the circuitry:

  1. Sew a line of six snaps about an inch below the NeoPixels.
  2. Thread conductive wires between the Flora and the new line of snaps. These will act as connection points for the pressure sensors. (There should be three connected to GND and three connected to analog signal pins 6, 9, and 10.)
  3. We brought the wires from each pressure sensor up the back of the ankle and threaded them through part of the t-shirt to keep them from touching each other.
  4. Secure the male side of the six snaps onto the end of the conductive thread from the pressure sensors.
  5. These snaps should snap onto the line you just sewed down.

Refer back to your threading plan during these steps to ensure that you don't cross wires and that you connect the right snaps.

Step 16: Assembling a Prototype: Soldering

Now we move into soldering. Remember to review your safety because soldering irons can be very painful if touched.

  1. Solder the male side of the snaps onto the Flora. (Seen in image above on the left.)
  2. After each snap gets soldered, double check the position of it with the sewn snaps. It's faster to adjust one snap with solder than it is to re-sew all of the snaps because they aren't lined up properly.
  3. Once the snaps are soldered to the Flora, you can attach it the rough assembly of parts to see how it fits, seen in the image on the right.

Step 17: Assembling a Prototype: FInishing Up

  1. We covered the back side of the strip (where all the threading and knots are exposed) with another portion of t-shirt. It would be a shame if a wire snagged and ripped!
  2. Create a little pocket for the battery if desired.
  3. We created a flap to cover all of the components, but this is entirely up to you!
  4. Add Velcro dots to the strip of t-shirt. This will serve as an adjustable size securement to hold the band around the ankle.
  5. One you've finished, try it on for size and see if it works!

Step 18: Further Ideas

In the near future, we hope to add further processing to achieve a clearer signal, and feedback to inform users of imbalances between pressure sensor readings. These imbalances could hopefully then be used to make suggestions of an insole for the user (again, having a more precise and complete sensor grid would make this easier).

In the further future, this project could be expanded to include a more precise array of pressure sensors. If, say, a pressure sensing grid of some sort were used, it could create a much more detailed collection of data. This data could then be used to create a real-time rendered image of a foot with areas of higher and lower pressure designated by a range of colors. This would make the sensor attachment much more useful in a clinical setting, because a doctor could visually recognize abnormalities in force distribution across someone's foot as they walk. He or she could then look at the numerical data and, based on the findings, recommend treatment for the condition (i.e. what type of insole to purchase to improve comfort). Such functionality is a long way off for this project, but we believe this Instructable definitely has a lot of potential!

Thank you so much for taking the time to read through our tutorial and (maybe!) try it. Let us know if you have any suggestions or feedback in the comments section below.

Microcontroller Contest

Participated in the
Microcontroller Contest