You will need the following:
- Conductive Thread
- Lithium-Ion Battery
- 2x LilyPad XBee Breakout Board
- 2x XBee
- 6 pin header
- 2x 15K Resistor
- Flex Sensor
- Pressure Sensor
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Setup XBee Modules
We need to designate one XBee as the Coordinator and one as the End Device (AT MODE). Soldering a 6pin header to a LilyPad XBee Breakout allows for easy programming with the standard USB-FTDI connector which comes with the LilyPad Pro. We used XCTU to program the XBee units. Make sure the high and low destination address of the End Device is 0. This ensures that the End Device communicates with the Coordinator. It is also suggested to name your own Node Identifier, this must be done on BOTH the Coordinator and the End Device. For a great tutorial on programming XBee please consult Ladyada. (Note: XCTU works under wine for linux)
Step 2: Measure Bend Sensor
Measure the bend sensor in flexed and non-flexed positions. We measure 13.1K when lying flat and 43.8K when bent. (You should probably do this prior to sewing in the sensor)
Step 3: Voltage Divider
A voltage divider
Analog Input Value = (+ side of lilypad) * (Flex Sensor)/( Z1 +Flex Sensor)
or in our Min and Max Values from Flex Sensor were: 13.1K 43.8K . Therefore, we should expect
Min and Max Voltages of 2.3V and 3.7V. (These values will be converted into a value between 0 and 1023 by the LilyPad)
The same method is used also used for the Pressure Sensor. For more information please read the adafruit tutorial.
Step 4: Sensors and Resistors
Both the Pressure Sensor and the Flex Sensor have tiny leads which can not be sewn into. Soldering a tiny wire to each lead can be tricky but will allow us to form a loop through which we can sew.
We also need to solder a 15K resistor (for each sensor) from the + side of the LilyPad to an analog input pin. For this project we used Analog Input pins 0 and 2, so we need a 15K resistor from +-> a0 and another 15K resistor from + -> a2
Step 5: Time for Sewing!
- LilyPad to LiPower
- XBee Breakout to LiPower
- LilyPad to XBee Breakout
- Flex Sensor to LilyPad
- Pressure Sensor to LilyPad
Step 6: Program and Test Wireless
With the Arduino programming environment we can tell the LilyPad to get the analog values from Analog Inputs 0 and 2, store and operate on the values, then send any information we want to the XBee connected to a computer.
Let's test the wireless communication. Plug in the XBee and XBee Breakout Board with 6 pin header into an ftdi-usb chip then into your computer. Load your favorite Serial Terminal Program. I use a flavor of Linux so cutecom is my choice. ( For Windows check out HyperTerminal, I think Zterm works with OSX.)
I have provided the PDE file used by Arduino to demonstrate sending values from the flex and pressure sensors.
Step 7: Time for Play!
If you have successfully transmitted data from your sensors you can control (map movements) to anything you desire. Again, we were using this in a dance piece and a composer at IU (Eric Lindsay) wrote a program in Max/MSP to read in the data from the Serial Port. He kindly provided a highly annotated patch for you to learn from. (Note: the serial port in max gets mapped to a letter. In the picture below the XBee is mapped to port a.)
This project was a team effort:
Composer: Eric Lindsay
Costume Designer: Amy Burrell and Jay Garst
Choreographer: Utam Moses
Software and Hardware Designers: Benjamin Zaitlen and Alex Jacobs
The piece was supported by Indiana University (Prof. Kylie Peppler) and performed at the Buskirk-Chumley Theatre.
This material is based upon work supported by the National Science Foundation under Grant No. 0855886. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.