To get started, I ironed some fabric stiffener to the front and neck of the sweater, because I've learned the hard way that conductive thread doesn't work reliably with stretchy yarn (without a little help). My original thought was that I'd keep the Neo-Pixels and sensors confined to one side of the sweater, while sewing LEDs onto both sides.
The fabric stiffener did its job, but I ended up having to cut some of it out, because the sweater ended up looking rigid and boxy in the shoulders.
The next thing I did was work on writing the code and prototyping the circuit. This took a long time, because I wanted my sweater to have the following features:
1. Neo-Pixels triggered by a light sensor
2. Multiple songs triggered randomly
3. The ability to turn the music off and on with the press of a button
4. A light display triggered by a temperature sensor
5. A motor that did something useful (if only marginally)
After lots of experimentation, and some judicious remixing, I have a fully functioning program! The code compiles and circuit works! While I kept the idea for the motor alive in my code, I ended up scrapping the idea.
Of note, the LilyPad Arduino 328 Main Board doesn't have a JST socket soldered to it, so I sewed on a LilySimple Power to add an on/off switch, as well as a place to put the battery.
Based upon preliminary tests, I noticed that powering the circuit directly from the LilySimple Power was interfering with my temperature sensor. The interference didn't happen whenever the LilyPad was connected to a USB port through the FTDI cable. After a lot of experimentation with different batteries, voltages, and plugs, I determined that my problem might be that I had too many things connected to the positive (+) pin on the LilyPad. When using a LilySimple Power, which attaches to the positive pin of the LilyPad, I thought that I needed to come up with another way to send power to the temperature sensor.
While trying to figure out how to solve my problem I came across this LilyPad Temperature Sensor Example code, which explained that I needed to declare a spare analog pin as an output, set it to high, and then connect the positive (+) pin of the sensor to it. BRILLIANT!
But...even after I made those changes to the code, the temperature sensor was still reading higher than it should have whenever my LilyPad was powered via the LilySimple Power. The simple solution, which I wish I'd thought of earlier, was to modify the sensor threshold in the code itself.
To save time, I used the cording foot on my sewing machine to attach the silicone wire used for the power and ground rails going up the center of my sweater.
Very carefully, I split the coating of the wire in places where it needed to come in contact with the NeoPixels, and I hand-sewed them to gaps in the wire.
All of the wires and hot glue look pretty messy inside, but I'm hoping they'll be strong enough they way they are.
When I turn the power on, green and white LEDs flash in an alternating pattern. If I cover the light sensor, the NeoPixels fill with green, red, and then blue. When the temperature sensor gets triggered by warm hands (or a warm cup of coffee), red LEDs turn on and flash. If I want to hear one of four random Christmas tunes, I simply toggle a momentary push button and a piezo buzzer kicks into high gear, in sync with the lights!
No comments:
Post a Comment
Thanks for commenting.