DIY Breath Sensor With Arduino (Conductive Knitted Stretch Sensor)

13,272

21

10

Published

Introduction: DIY Breath Sensor With Arduino (Conductive Knitted Stretch Sensor)

About: Hi! I'm an interdisciplinary artist experimenting with interactive electronic technologies to investigate the dynamic acts of listening, communicating and moving.

This DIY sensor will take the form of a conductive knitted stretch sensor. It will wrap around your chest/stomach, and when your chest/stomach expands and contracts so will the sensor, and consequently the input data that is fed to the Arduino. So keep in mind this isn't a totally accurate way to track every breath, and sometimes the movements of the body can influence the sensor to since it is all about how it stretches. Also, in terms of stability, I've found the range of numbers can jump around quite a bit if the sensor doesn't remain a consistent tightness around the body, but if you are just standing and breathing it is pretty accurate/sensitive at picking up the slight expansion of the chest for each breath.

There are quite a few DIY breath sensors I've found while researching on the internet, but they do not have all the specific information needed to get one made and connected to the Arduino yourself. Here are some of those sources I've pieced together to give you the full story in this tutorial:

http://www.kobakant.at/DIY/?p=1762

http://cargocollective.com/nelramon/i-Breathe

https://hackingthebody.wordpress.com/2014/01/03/bluetooth-stretch-breath-sensor/

http://itp.nyu.edu/~ek1669/blog/?p=769

Please Note: I am only a novice of electricity/circuits/arduino/coding, so I welcome any suggestions or corrections if you find any!

Step 1: Materials and Tools

    Materials/Tools:

      • A spool of conductive yarn (I bought this kind from Sparkfun: https://www.sparkfun.com/products/12806) (UPDATE: Looks like they retired it, so this should work from Adafruit: https://www.adafruit.com/product/603 )
      • A spool of elastic yarn, I used the brand HiKoo CoBaSi (I found that yarn with some stretch is better because this sensor relies on being able to expand and contract. If you use stiff yarn, the sensor won't expand and contract as well)
      • Velcro ( about 6 inches... can be multiple smaller parts, it is used for securing the sensor around yourself)
      • Normal sewing thread (~1 yard)
      • Knitting needles (I used size: 5)
      • Sewing needle
      • Resistor Kit (x1) (A range of different resistors is needed, the one you need depends on how long your band is, and the tightness of the stitches. I don't think you'll need one smaller than 10k though. Changing the levels of resistance changes the output numbers found in the serial monitor)
      • Alligator clips (x2)
      • Jumper Cables (x7)
      • Arduino Uno
      • Computer (PC or MAC)
      • USB A to B cable
      • Volt meter
      • Bread board

      Step 2: Knit

      Begin by knitting a 2" wide band combining both the conductive yarn and elastic yarn.

      Knit with the conductive and elastic yarn as if it was one piece of yarn!

      You can use a standard stitch. My band was 10 stitches across and about 30 inches long.

      If you don't know how to knit, Youtube is your friend. :) **Tip: Find videos that are specific to your dominant hand. This one helped me: https://www.youtube.com/watch?v=b21msW3cS34

      Step 3: Sew Velcro to Your Knitted Band

      On one end of your knitted band sew a few inches of Velcro (I recommend using the hard/pokey Velcro half).

      Step 4: Sew More Velcro

      Flip over your band and sew the other matching velcro (the soft half, if you used the hard half on the other side) onto the other end of your knitted band. You'll want the length of this velcro to be a bit longer, approx. 7 inches.

      *** Before you sew make sure when you wrap the band around yourself the velcro halves match up!

      Step 5: Build the Circuit

      Use the photos on this step to wire up your Arduino to the sensor.

      Attach 2 alligator clips to the knitted band, one on each end. The amount of stretch will only be measured between these 2 points. ** Be sure to clip the band securely and choose a spot where a lot of the conductive yarn is exposed, it is essential for the conductive yarn and metal clip to make contact (I've tried to check this connection with the Volt Meter, but I've found even if it is working it doesn't necessarily show that it is on the Volt Meter, I recommend wiring up the whole circuit and then seeing what the numbers look like in your serial monitor to see if it is working) **

      Use this Analog Input Tutorial provided by Arduino to help wire up your circuit. (Just substitute the photosensitive resistor with the knitted band + alligator clips, and it's the exact diagram/schematic you need).

      Step 6: Upload the Arduino Code to the Arduino

      If you've never used Arduino before please refer to this "getting started" page and download the Arduino Software (it's free!).

      Once you have the software downloaded on your computer, open up the program and follow these steps:

      1. Open up the "AnalogReadSerial" sketch. (File>Examples>Basics>ReadAnalogSerial).
      2. Connect the Arduino Uno (and attached circuit) to your computer via the USB A to B cable.
      3. Click "Upload" icon (looks like an arrow) in the sketch box (Make sure the correct board (Arduino Uno) and Serial port are selected under "Tools").
      4. Keep the Arduino connected to the computer and then click the "Serial Monitor" icon (Looks like a magnifying glass)
      5. This should open a box called the serial monitor, and you should see a stream of numbers. Stretch the sensor and watch the numbers change!

      TROUBLE SHOOTING TIPS IF YOU DON'T SEE A STREAM OF NUMBERS:

      • If you don't see any numbers or see a series of weird characters make sure that the baud rate is set to 9600 within the serial monitor drop down menu
      • Make sure all your connections are secure
      • Try a different level of resistor
      • Try clipping the alligator clips to a smaller section of your knitted band. If the conductive yarn is broken at some point between the alligator clips it won't work.

      Step 7: Test It Out!

      Wrap it around yourself and monitor the numbers while you breath! You may need to try different resistors to get the right range of numbers that work for your specific project.

      Experiment putting the band round different areas of your chest/stomach. You'll probablly need longer wires than the alligator clips once it is around yourself. I think it works best under your clothes, or on top of unbaggy clothes.

      Now you can take this code and sensor and modify it however you want, and apply it in a lot of different ways!

      Example idea: Make an LED change brightness with each breath.

      Share

        Recommendations

        • Clocks Contest

          Clocks Contest
        • Casting Contest

          Casting Contest
        • Planter Challenge

          Planter Challenge
        user

        We have a be nice policy.
        Please be positive and constructive.

        Tips

        3 Questions

        Hi! Can you please tell me what length of conductive yarn you used for the band in total? Just trying to do my project within budget! The options are jump from 45m to 250m. Thanks.

        Hi, I don't remember exactly, but you don't need too much (it's based on how thick and long you want the band to be)... 45 meters would definitely be plenty... probably more like 10 meters would be a safe amount. A good guestimating formula would be if your band is 30 inches long, and 10 stitches wide...30x10=300in.

        300in. = 7.62meters + a few meters extra for safe measure = 10 meters.

        I'm using the Adafruit conductive thread and I am knitting it. I also used different colored wires, does that make a difference? I am going to unplug and insert them back in to see if that works.

        IMG_6426.jpegIMG_6427.jpegIMG_6428.jpegIMG_6429.jpegIMG_6430.jpegIMG_6431.jpeg

        Also make sure the alligator clips are clipped to the conductive thread not the yarn... I had a thicker conductive thread so maybe you aren't getting a good connection there. It looks like you are pinching the yarn and not the thread.

        3 more answers

        I took out the LED and repositioned some of the wires and it works and is gathering data. Thank you for answer and taking the time to help me!

        In the pic it looks like the yellow wire might not be plugged in all the way? The color of the wires doesn't matter, a wire is a wire, the colors are just a tool to help you keep track of which one is the power/ground etc. Did you try it without the LED and set it up like my schematic exactly? Also try different resistor strengths, did you try the one I recommended? The colored bands on the resistor tell you what strength it is.

        Color doesn't matter.

        I am currently working on a project that requires us to gather data from the Arduino and I chose to focus on breathing. I followed your steps but when I plug in my Arduino to my computer and open the serial monitor, I am only getting values of 0's unlike you. I was wondering what I can do/change in order to gather data. If you could reply ASAP that would be amazing since I need to gather data pretty soon. Thank you!

        My theory is your band's connections is broken somewhere. Try touching alligator clips together without band and see what happens. if you get non zero values this is a problem with your band.

        1 more answer

        Hi, did you try my trouble shooting steps? What are you using for the conductive yarn? Sounds like something isn't connected, use a volt meter to test all your connections and try using different resistors, and try connecting your alligator clips directly on a piece of conductive yarn.

        10 Comments

        hi ! i have a question please , if we substitute the conductive knitted by a piezo disc ,the code remain the same ?

        thanks

        4 replies

        thank you very much, it's my first arduino project i read somewhere else that we need libraries for each sensor so we should use libraries here or no need?

        i will upload the prototype that i will be carried out and can you give me wish one to follow

        thank you very much again again !

        Untitled.png

        Are you trying to use the piezo to detect breathing? I don't think that will work if that's the case because it can't sense the stretching, it can sense pressure, but the pressure would always be the same tightness around the waist/chest I believe. It never hurts to test anyways though. Let me know what you find!

        If you just want to just read the analog serial data coming from the piezo you don't need libraries. I've found Libraries are usually only needed for more complicated sensors or code, and a tutorial will tell you what Library to use if it is needed. Also, Arduino comes pre-downloaded with some libraries so you really shouldn't need to worry about them at all until you try more advanced projects.

        More info about Libraries: https://www.arduino.cc/en/Guide/Libraries

        thanks again !

        yes im trying to create a respiration monitor sensor based on piezo disc sure i read a detailed article about that and i will give you the link of the video explaining that :

        https://www.youtube.com/watch?v=brTVT--qcwI

        Hi. Thanks for posting this! I was planning to try this same thing myself. I have a question - instead of conductive yarn, would it work as well using just conductive thread with non-conductive yarn?

        1 reply

        Hi! I don't think the thread would work as well as the yarn, but it's worth testing! I can't remember if I tried using thread or not in the past...Let me know what you find! I'm guessing the thread might make it harder to detect the changes in resistance/produce smaller overall changes that make the breaths hard to detect. You also might need to try using different resistors to amplify the signal enough. I imagine because the thread is thinner it might have an overall weaker signal being sent through it.

        Where can I get conductive yarn? The link is sold out! Thanks

        1 reply

        Hey! Sorry for the slow reply, it looks like Adafruit has some! https://www.adafruit.com/product/603

        This is an interesting project. Thank you for sharing! I hope we see more from you in the future.