Pressure Sensor Light Up Shoes
by srihitaponnam in Circuits > Wearables
742 Views, 2 Favorites, 0 Comments
Pressure Sensor Light Up Shoes
This Instructable will cover how to make a pair of Pressure Sensor Light Up Shoes that create flashes of light with every step. I will be using Adafruit's resources and tutorials by Phillip Burgess and Becky Stern, so a majority of the main components including the NeoPixel strip and FLORA will be from the Adafruit platform.
I would like to thank Philip and Becky for their amazing tutorial, which this is based on, and also Berbawy Makers and Ms. Berbawy, for funding this project and providing access to many important pieces of technology in her classroom.
Supplies
For this project you will need
- 2 FLORA main boards
- velostat (1 sheet is enough for both shoes)
- 2 meters NeoPixel 60-LED strip in black or white
- 2 3xAAA battery holder with switch (could swap for a smaller energy source)
- conductive thread
- shoes (make sure there is a hard rim on the bottom for the LED)
- premium jumpers or three pieces of silicone coated stranded wire
- fine sandpaper
- tape
- any adhesive that sticks to both the silicone LED sheathing and your shoe material
- marking pencil
- plain thread
- alligator clips
- USB cable for plugging in FLORA
Along with these products you will also need access to a soldering iron which will be used to finally put the flora together
Making Velostat Step Sensors
Cut a heel-shaped piece of velostat and tape a loop of conductive thread to it. Make sure the conductive thread has at least an 18-inch tail sticking out from one side. Cut another piece for the other shoe and repeat.
Flip both pieces of velostat over and tape another loop of conductive thread on. The tails should be on the same side, but a couple few inches apart.
Sewing Flora Onto Each Shoe
Pick a spot to stitch the FLORA main board on your shoes. I suggest doing it on the left side of the left shoe and the right side of the right shoe as shown in the pictures. Using regular thread you will need to make sure that the FLORA is secured onto the shoes by stitching through a few pads. I highly suggest using pads D12 and SCl since they are not needed for this project
Make sure to keep the sewing close to the FLORA but even closer to the pads you are sewing into. Doing so will make it much cleaner and more organized.
Sewing the Sensor Threads
Pick one conductive thread end and thread it through a needle. Pierce the needle through the side of the shoe and near the sole. Repeat with the other piece of thread attached to the sensor. Make sure to keep the two threads not too far away from each other but not overlapping.
Tighten the stitch by pulling it and it should push the velostat into the heel of the shoe. For more stability, I suggest using gorilla glue to glue the sensor to the inside of your shoe.
If your shoes are made of a hard-to-sew-through material, it helps to use pliers to navigate the sewing needle. The bottom soles are much tougher compared to the regular fabric and it is easy to get hurt pushing the needle in.
After having both threads sewn in and pushed into the inner part of the shoe, locate the GND pad and the D9 pad on the FLORA board. Sew one piece of thread into GND and the other into D9. Make sure to go through it a couple of times and seal your knot with a "fray check" to make sure it is securely connected.
Referring to the circuit diagram provided by Becky, stitch one of these threads to GND on the FLORA, and the other to D9.
Knot the thread on the inside, seal them with a fray check, and snip off any excess thread.
Soldering the NeoPixel LED Strip
When ordering the NeoPixel Strips, you will notice there is a diffuser on top. We will keep the diffuser on at the end but for now, you will need to cut a line in the back of the LED strip to take the diffuser off. Make sure the rubber around the wires at the end is also taken off to the best of your ability.
Now looking at the wires you will see three outputs, two wires on the sides of a connector wire in the middle. The connector wire has two wires leading up to the connector portion at the end. With a pair of wire cutters, you will snip the middle connector at the end exposing the two wires we saw before.
The two black wires are ground so you will strip these wires a bit more than the others and wrap them together and solder them onto the dedicated pad as you do for the rest.
Using the image from the previous step, make sure to solder the wires securely into their designated locations. If needed, use copper tape and a desoldering solder sucker to manage any mistakes. Also, avoid touching the soldering iron to the shoe.
Gluing on the NeoPixel Strip
Make sure to sand the surface of the shoe where the LED strip will be and wipe the surface with isopropyl alcohol to make sure it's clean.
Previously we took off the diffuser but make sure to put it back on before gluing the strip onto the shoe. Measure the shoe to determine how long the LED strip needs to be, and cut off the excess.
Put the shoes on and bend the toe part as much as you can. Using a white colored pencil (if you use a black shoe like I did), mark off the section that bends the most. When you apply glue make sure to skip this section.
Lay down a big scrap paper for any mess and put on gloves so you don't get glue on your fingers. It's also good to have paper towels in case of a spill.
You'll need rubber bands and toothpicks to help you glue. Apply a bit of glue to the shoe sole and stick the start of your LED strip to it. Continue applying glue around the back of the heel using the toothpick. Use the rubber bands to secure the LED strip to the shoe as the glue dries.
Remember to skip at the markings. This will make sure the LED strip won't move away from the shoe when it is bent. Otherwise, the sharp bending could crack the circuit board inside the strip.
You will then use the rubber band to secure the shoe as shown above while it dries for 24 hours minimum.
Attatching the Battery
Attach the battery to the connector on the FLORA board. Make sure to have AAA batteries available. Since the battery pack is pretty big I suggest attaching it to the other side of the shoe, opposite to the FLORA. Grab some velcro and place it on both the back of the battery pack as well as the actual shoe and make sure there is enough to not have a drooping battery pack.
Coding the FLORA
Connect your computer and FLORA using a mini USB connector. Program your FLORA using the code below (provided by Phillip Burgess)
Code for Flora (By Phillip Burgess With Alterations)
// 'Firewalker' LED sneakers sketch for Adafruit NeoPixels by Phillip Burgess
#include <Adafruit_NeoPixel.h>
const uint8_t gamma[] PROGMEM = { // Gamma correction table for LED brightness
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5,
5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,
10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
90, 92, 93, 95, 96, 98, 99,101,102,104,105,107,109,110,112,114,
115,117,119,120,122,124,126,127,129,131,133,135,137,138,140,142,
144,146,148,150,152,154,156,158,160,162,164,167,169,171,173,175,
177,180,182,184,186,189,191,193,196,198,200,203,205,208,210,213,
215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255 };
// LEDs go around the full perimeter of the shoe sole, but the step animation
// is mirrored on both the inside and outside faces, while the strip doesn't
// necessarily start and end at the heel or toe. These constants help configure
// the strip and shoe sizes, and the positions of the front- and rear-most LEDs.
// Becky's shoes: 39 LEDs total, 20 LEDs long, LED #5 at back.
// Phil's shoes: 43 LEDs total, 22 LEDs long, LED #6 at back.
#define N_LEDS 39 // TOTAL number of LEDs in strip
#define SHOE_LEN_LEDS 20 // Number of LEDs down ONE SIDE of shoe
#define SHOE_LED_BACK 5 // Index of REAR-MOST LED on shoe
#define STEP_PIN A9 // Analog input for footstep
#define LED_PIN 6 // NeoPixel strip is connected here
#define MAXSTEPS 3 // Process (up to) this many concurrent steps
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);
// The readings from the sensors are usually around 250-350 when not being pressed,
// then dip below 100 when the heel is standing on it (for Phil's shoes; Becky's
// don't dip quite as low because she's smaller).
#define STEP_TRIGGER 150 // Reading must be below this to trigger step
#define STEP_HYSTERESIS 200 // After trigger, must return to this level
int
stepMag[MAXSTEPS], // Magnitude of steps
stepX[MAXSTEPS], // Position of 'step wave' along strip
mag[SHOE_LEN_LEDS], // Brightness buffer (one side of shoe)
stepFiltered, // Current filtered pressure reading
stepCount, // Number of 'frames' current step has lasted
stepMin; // Minimum reading during current step
uint8_t
stepNum = 0, // Current step number in stepMag/stepX tables
dup[SHOE_LEN_LEDS]; // Inside/outside copy indexes
boolean
stepping = false; // If set, step was triggered, waiting to release
void setup() {
pinMode(9, INPUT_PULLUP); // Set internal pullup resistor for sensor pin
// As previously mentioned, the step animation is mirrored on the inside and
// outside faces of the shoe. To avoid a bunch of math and offsets later, the
// 'dup' array indicates where each pixel on the outside face of the shoe should
// be copied on the inside. (255 = don't copy, as on front- or rear-most LEDs).
// Later, the colors for the outside face of the shoe are calculated and then get
// copied to the appropriate positions on the inside face.
memset(dup, 255, sizeof(dup));
int8_t a, b;
for(a=1 , b=SHOE_LED_BACK-1 ; b>=0 ;) dup[a++] = b--;
for(a=SHOE_LEN_LEDS-2, b=SHOE_LED_BACK+SHOE_LEN_LEDS; b<N_LEDS;) dup[a--] = b++;
// Clear step magnitude and position buffers
memset(stepMag, 0, sizeof(stepMag));
memset(stepX , 0, sizeof(stepX));
strip.begin();
stepFiltered = analogRead(STEP_PIN); // Initial input
}
void loop() {
uint8_t i, j;
// Read analog input, with a little noise filtering
stepFiltered = ((stepFiltered * 3) + analogRead(STEP_PIN)) >> 2;
// The strip doesn't simply display the current pressure reading. Instead,
// there's a bit of an animated flourish from heel to toe. This takes time,
// and during quick foot-tapping there could be multiple step animations
// 'in flight,' so a short list is kept.
if(stepping) { // If a step was previously triggered...
if(stepFiltered >= STEP_HYSTERESIS) { // Has step let up?
stepping = false; // Yep! Stop monitoring.
// Add new step to the step list (may be multiple in flight)
stepMag[stepNum] = (STEP_HYSTERESIS - stepMin) * 6; // Step intensity
stepX[stepNum] = -80; // Position starts behind heel, moves forward
if(++stepNum >= MAXSTEPS) stepNum = 0; // If many, overwrite oldest
} else if(stepFiltered < stepMin) stepMin = stepFiltered; // Track min val
} else if(stepFiltered < STEP_TRIGGER) { // No step yet; watch for trigger
stepping = true; // Got one!
stepMin = stepFiltered; // Note initial value
}
// Render a 'brightness map' for all steps in flight. It's like
// a grayscale image; there's no color yet, just intensities.
int mx1, px1, px2, m;
memset(mag, 0, sizeof(mag)); // Clear magnitude buffer
for(i=0; i<MAXSTEPS; i++) { // For each step...
if(stepMag[i] <= 0) continue; // Skip if inactive
for(j=0; j<SHOE_LEN_LEDS; j++) { // For each LED...
// Each step has sort of a 'wave' that's part of the animation,
// moving from heel to toe. The wave position has sub-pixel
// resolution (4X), and is up to 80 units (20 pixels) long.
mx1 = (j << 2) - stepX[i]; // Position of LED along wave
if((mx1 <= 0) || (mx1 >= 80)) continue; // Out of range
if(mx1 > 64) { // Rising edge of wave; ramp up fast (4 px)
m = ((long)stepMag[i] * (long)(80 - mx1)) >> 4;
} else { // Falling edge of wave; fade slow (16 px)
m = ((long)stepMag[i] * (long)mx1) >> 6;
}
mag[j] += m; // Add magnitude to buffered sum
}
stepX[i]++; // Update position of step wave
if(stepX[i] >= (80 + (SHOE_LEN_LEDS << 2)))
stepMag[i] = 0; // Off end; disable step wave
else
stepMag[i] = ((long)stepMag[i] * 127L) >> 7; // Fade
}
// For a little visual interest, some 'sparkle' is added.
// The cumulative step magnitude is added to one pixel at random.
long sum = 0;
for(i=0; i<MAXSTEPS; i++) sum += stepMag[i];
if(sum > 0) {
i = random(SHOE_LEN_LEDS);
mag[i] += sum / 4;
}
// Now the grayscale magnitude buffer is remapped to color for the LEDs.
// The code below uses a blackbody palette, which fades from white to yellow
// to red to black. The goal here was specifically a "walking on fire"
// aesthetic, so the usual ostentatious rainbow of hues seen in most LED
// projects is purposefully skipped in favor of a more plain effect.
uint8_t r, g, b;
int level;
for(i=0; i<SHOE_LEN_LEDS; i++) { // For each LED on one side...
level = mag[i]; // Pixel magnitude (brightness)
if(level < 255) { // 0-254 = black to red-1
r = pgm_read_byte(&gamma[level]);
g = b = 0;
} else if(level < 510) { // 255-509 = red to yellow-1
r = 255;
g = pgm_read_byte(&gamma[level - 255]);
b = 0;
} else if(level < 765) { // 510-764 = yellow to white-1
r = g = 255;
b = pgm_read_byte(&gamma[level - 510]);
} else { // 765+ = white
r = g = b = 255;
}
// Set R/G/B color along outside of shoe
strip.setPixelColor(i+SHOE_LED_BACK, r, g, b);
// Pixels along inside are funny...
j = dup[i];
if(j < 255) strip.setPixelColor(j, r, g, b);
}
strip.show();
delayMicroseconds(1500);
}
ENJOY YOUR AMAZING NEW SHOES!!!
This project though simple in steps took me many revisions and tries. I hope you too will have fun exploring the world of wearable circuits and are able to rock your very own motion sensor light-up shoes!