This week we are making a switch using sewable materials. I decided to make something similar to what I did for the midterm by using pressure as a trigger.
I imagine the switch would be constructed using some foam/cotton stuffed in a pocket. So I put some conductive tape on both sides of the pocket, which will be made by folding the fabric onto itself. Then, I installed the rest of the circuit by sewing some conductive threads and adding a resistor to prevent a short circuit. I left two threads out, since they will be connected to the microcontroller later.
For the code, I used analog read to get the pin value and then added a counter to trigger the NeoPixels.
Then, I connected the microcontroller and tested it out before sewing it to the pillow.
Final result: I was able to create a “pressure sensor” by using some foam and conductive materials. Now when I hug my pillow, I will get a nice response from the microcontroller!