Introduction: LilyPad Arduino Sensor Demo Mat
This tutorial shows you how to create a sensor demo mat for the LilyPad Arduino. I wanted a place where I could experiment with the different sensors, but also something that I could use to show examples of what can be done without constantly uploading code.
Step 1: Step 1: Supplies
To complete this project I used the following:
- 1 x LilyPad 328 Main Board
- 1 x ProtoSnap - LilyPad Development Board which includes the following:
Although I had the LilyPad Development Board, I decided to use the LilyPad SImple Board so I could use the extra pins as switches.
Step 2: Step 2: the Circuit Diagram
Before beginning any project it is good to take the time to think everything through. I put images of the different sensors and components into lucidchart.com and played around with the placement of the sensors to find an arrangement that wouldn’t just work, but one I also found to be aesthetically pleasing.
Step 3: Step 2: Sensor Placement
Based on the diagram, I arranged all of the sensors and switches onto the fabric. I used the marking pen to indicate where each pin and component would be placed. A dot inside the pin hole was enough to let me know where each component would go.
Step 4: Step 4: Draw the Circuits
I removed the sensors and used the marking pen to draw the circuit onto the fabric. I used a ruler to make sure all of my lines were straight. The nice thing about a pen like a Dritz Mark B Gone is that the ink disappears when it gets wet which allows you to erase your lines with a damp rag if you need to make changes.
When I had the lines drawn, I again placed the sensors on the mat to make sure that everything lined up the way I wanted it to. I ended up changing the position of the RGB light slightly so the lines were less likely to make contact with the other pins on the LilyPad.
I wanted the lines to be part of the final piece so, once I was satisfied with the diagram, I traced the lines with a permanent marker. If I did it over, I would probably color code the lines so that it can be better used to explain how the circuit works.
Step 5: Step 5: Clean Off the Marking Pen
I soaked the fabric in water and then let it dry overnight to remove the blue marking pen marks from the fabric before I started sewing.
Step 6: Step 6: Stitch on the Sensors and Other Components (optional)
To ensure that the sensors stayed put while I sewed the circuits, I did a quick stitch with plain thread to hold the components in place.
Step 7: Step 7: Sew the Circuits
Using the conductive thread, I sewed along each of the circuit lines connecting the different components to the LilyPad. This was probably the most tedious part for me. Especially since the thread kept getting tied in knots. If you have not worked with conductive thread much, you may want to look up a tutorial. I learned about this YouTube video from a friend after the fact.
Tip: Be careful where the Positive lines (red) cross the Ground lines (black). I used a small piece of plastic cut from the LilyPad packaging to make sure that the lines didn’t short. I used hot glue to tack down the plastic so it wouldn't snag on anything.
Tip: As you can probably tell, I am not the world’s best sewer so when I was done I had some large knots on the back. I used a little dab of glue on each knot to keep it from coming undone and to prevent the lines from touching.
Step 8: Step 5: the Code
This part was one of the most enjoyable and yet frustrating parts of the project for me. While I wrote much of the code myself, I also benefitted from the work of others. I have tried to give sources in the code in those instances where I was blessed to find someone who had done some of the work for me. I tested and coded each of the sensors and functions one at a time. Each time I added a new function I ran through all of the previous functions to make sure nothing broke (which it frequently did).
I am sure that there are better ways to do much of what I wrote but I am still adjusting to the Arduino programming. Hopefully this will give you a good start if you are interested.
Step 9: The Final Product
Here is a brief video of each of the functions I programmed into the mat. I made a ball of hot glue to amplify the color being output from the RGB light.
Second Prize in the