I made a little automatic slipper foot massager with the Lilypad Arduino and some of the Lilypad Vibe Boards for the actual massager. The sensor it uses is a Lilypad Accelerometer that I'm only using as a basic tilt sensor. Essentially it detects when the slipper is in a more vertical position (like when you would kick your feet up to relax) and then turns on the motors. When the slipper is in a more horizontal position (like when you're walking), the motors turn off.
Read on for a parts list and guide on how to modify your own slippers (or shoes) to do the same thing.
Step 1: Parts List
The parts I used for this project are:
- 2 x Arduino Lilypad Main Board (I ordered the newer USB style from a shady dealer on ebay, but was sent the older mainboard style by mistake, but since they shipped from Hong Kong, and I was doing this for a class project, I couldn't wait for the correct boards to be shipped. I should have ordered from SparkFun.com, they cost a little more than ebay, but they are fast shipping and I haven't had an order messed up yet from them. Any arduino would work, even an UNO, but Lilypads are more conducive to e-textiles obviously. If you do get these older boards, make sure you have an FTDI board to program them, that's another advantage to the newer boards that have the USB built into them, no need for extra programming boards).
- 2 x Lilypad Accelerometer Boards
- 2 x Lilypad Power Boards (I only had to order these since they sent the older boards and I had already ordered the lithium ion batteries from sparkfun that use the JST connectors. Newer lilypad boards have the connector built onto them, or you could use a different power supply if you wanted altogether).
- 4 x Lilypad Vibe Boards
- 2 x Lithium Ion Polymer Batteries (I used their medium sized ones, they have smaller and bigger, this seemed like a nice middle ground. Again, you can use any power source you prefer, these are just nice little rechargeable batteries, and the price is right on them. I wouldn't use the smaller batteries as the vibe motors won't last long on those, but they should last a good while on this size fully charged).
- ~5 feet of Conductive Thread (can't tell you exactly how much you'll need, but it didn't take very much. All of the components are in a relatively small area, so you won't need to sew long traces, so just a few feet of thread is all you'll need. You could use wires, but the thread is much more comfortable on wearables).
- 2 x Slippers (I used some knit slippers called Pantoufles, pronounced "pawn-toof", popular in Quebec, but any kind of slipper would work, or even shoes, heck you could sew it into a pair of socks if you really wanted to. Just need something that will be worn on your feet).
- You may also need access to a soldering iron, and possibly a multimeter for troubleshooting, but those items may not be required.
Step 2: Circuit Diagram
Here is my basic circuit design for this project. As you can see, I am only hooking up one axis on the accelerometer (the "X" axis). Since I am only using it as a simple tilt sensor, this was all that was needed. You could hook the "Y" and "Z" axis and really either get more precise tilt sensing (although the one access is sufficient) or you could have other crazy movements tracked to trigger the vibe boards. For this project though, we will only focus on using the single "X" axis.
In the circuit diagram, I have it laid out pretty close to how it goes on the slipper. You could change the placement of the vibe boards if you wanted it to focus it's massage on different areas of the foot, but this is what worked for me. Also, if you have a newer lilypad board, the power board diagram will not be needed, you can just take that part out and use the on board battery jack.
Notice on the diagram how I have the board laid out. I did this for simplicity of getting to the pins I needed. In my code I am making extra ground and positive pins for the vibe motors and accelerometer, and we'll discuss that later, but if you notice, the accelerometer is placed in a very specific way on the graphic diagram. There is a blank little pad that points up, I used that as my reference point, so when I was tracking the numbers and seeing what movements produced certain numbers in the serial monitor, I always held that pin forward (pointing toward the toes in the final slipper project) and started flat parallel to the floor. That was my "home" position. My code then is set to react if the sensor value hits above a certain number. This will be explained more in the coding section, but it's good to note this when laying our your circuit especially with the accelerometer.
Step 3: Code
For the code, I took an existing sketch that far better coders created to gather the accelerometer sensor values and make them more usable. Essentially, they create 3 arrays for the "X", "Y", and "Z" axis values. The arrays take 8 values that the board spits out, and then divides those values by 8 (to get the average of the values), and then it spits that averaged value out. It smooths out the output and makes the data from the accelerometer much more usable.
I just added an "If" statement to say if the sensor value is greater than a certain threshold (with my setup it was 660), then turn the main board LED on and also the 2 massage vibe boards. I have uploaded this code so you can download it and change it to suit your hardware and preferences.
I'll talk about prototyping in the next step where you can upload this code and then view the numbers your hardware is giving you and that way you can set the numbers to your liking.
Make sure and update the code with your own pins that you use on your board. Because I was just playing around with this code, I didn't do the greatest job with naming variables etc... so you'll have to search the whole code for pin changes.
Step 4: Prototyping
Before you sew your circuit together on your slippers, it's not a bad idea to grab some alligator clamps and test it out with your own hardware. Just hook it up following the wiring diagram, load in the code (making any pin changes that you may need based on your hardware), and then test out the function.
As you can see in the picture, I just tilted the accelerometer to test to see if it would make the LED turn on and off. Once I knew that was working, I could confidently move on and sew the actual parts down to the slipper. This is also a great time to check the serial monitor in your Arduino IDE. If you are using different hardware/power/etc... your values from the accelerometer may be different.
Once you have your board hooked up and the code loaded in, hit the serial monitor magnifying glass in the upper right of the Arduino IDE to view what actual numbers your hardware is spitting out. Move the accelerometer around while you have the serial monitor open so you can see what changes occur with each action. Since I only used the "X" access, I only pay attention to the first column of numbers (there will be rows and rows of 3 columns of numbers, it is the "X", "Y", and "Z" values). For my setup, 660 was a good number to indicate a tilt up, so I used that, you may have to adjust your code to suit your preferences/hardware.
Another thing that may save you some time is to know that the lilypad accelerometer has a surface mount resistor on the board. The datasheet for the accelerometer chip says it wants 3 volts, but it will work fine with the lilypad 5 volts since it has that built in resistor, no need to bother with your own resistor (and before I realized this, I tried to use PWM to get my 3 volts, and it doesn't work well with an accelerometer since it's got too much noise that gives you funny values for your axis numbers, just a FYI).
One last tip that may save you some headache. If you do use the power board, and you haven't used one before, you are going to have to solder the jumper closed on the board before it will work. It's a simple little quick fix, but if you have never used one and don't read the second paragraph on the site, you'll wonder why the circuit works while hooked up to computer power, but not on battery power.
NOTE: My older board required a baud rate of 4800, newer boards will want 9600, so check your board specs, if the serial monitor is spiting out garbled nonsense instead of rows of 3 columed numbers, then you probably have the incorrect baud rate selected in the code or the serial monitor.
Step 5: Assemble Your Slippers!
DISCLAIMER: I am not a very good sewer. In fact, I'm probably a really bad sewer, but you don't need great skills with these types of projects. I'm sure there are specific types of stitches or something that make a better bond, but I just wing it and try to sew in a kind of straight line. It's not the prettiest, but it works. I always check my leads with my multi-meter to make sure I'm not touching anything I shouldn't and that there is continuity.
Once you are satisfied with your code and setup, it's time to start stitching it together. I just started by laying all of the pieces close to where I wanted them on the slipper. Like I mentioned before, you could move the vibe boards, or even add more if you wanted, but I found for my slippers, up near the top was best.
Accelerometer: I started by stithcing the "X" pin on the accelerometer, being careful to line that blank pad on the board facing straight towards the toes of the slipper. I just put a bit of conductive thread on a needle (I also run the thread through some wax to help it sew easier. If you don't have wax, chap stick would probably work fine too). I don't put too long of a thread on the needle because the conductive thread seems to tangle and knot up too easily if it's left too long. Since we have all of our parts so close, it's easier to use shorter thread.
Once I have the "X" pin sewn, I place the Lilypad where I want it, and sew down to the designated pin from my circuit diagram. I make sure and leave allowances for the other threads that will be coming close to this one. I also make sure I don't run the thread under the boards where they could short out. Then I finish up and sew the positive and negative pins to the correct lilypad pins from my diagram.
Power Board: Once I have that all stitched on, I move onto my power board. Again, if you use a newer board, you don't have to worry about that, but if you are using one, you may have noticed that my diagram has the positive pin going around the whole board to reach the correct pin on the Lilypad. This is because I wanted the outlet of the power jack to be facing a certain way on my slipper. Your slipper may suit a different orientation better. You can adjust this to suit your project, and possibly save yourself some circuitous stitching.
Vibe Boards: I do the vibe boards last since they have to be sewed to the underside of the slipper and it's a bit of a pain to do this. I found it easiest to turn the slipper inside out and then start with either the negative or positive pin on the vibe board (can start with either vibe board, doesn't make a difference). Once I have sewn the pin about 3 times, I stick the needle through to the front side of the slipper, making sure it's not near another trace, and then I flip the slipper right side out and then sew it up to the correct pin on the Lilypad. Just repeat those steps with both boards for the positive and negative pins.
Test It Out: Once you have it all sewn together, grab a battery and test it out. Make sure both motors are turning on, and check to make sure the angle of the accelerometer is still working for your applications.
Sewing with Conductive Thread: If you have never worked with conductive thread, there are lots of tutorials available by searching google, here is a great video that details a few tips:
Step 6: You're Finished!
You're all finished now, kick your feet up and enjoy your hard work with a well deserved foot massage!
Honestly, the massage is pretty subtle. You definately feel it, but I wouldn't say it a deep tissue massage. Maybe if you strapped the vibe motors to some elastic that could then press the vibe motors tighter to the areas you want massaged, or if you added a few more motors, it could make it better. But it's still a fun project, and it does give a nice subtle massage.