DIY Breath Sensor With Arduino (Conductive Knitted Stretch Sensor)

28,638

37

36

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) OR A BINDER CLIP! (I've actually found a binder clip works easiest for getting a tight fit)
      • 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 (OPTIONAL)

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

      ** OPTIONAL: If you don't have velcro, skip this step and just use a BINDER CLIP to hold the band in place around yourself. I've found a binder clip can actually work better to get a tight fit!

      Step 4: Sew More Velcro (OPTIONAL)

      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!

      ** OPTIONAL: If you don't have velcro, skip this step and just use a BINDER CLIP to hold the band in place around yourself. I've found a binder clip can actually work better to get a tight fit!

      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.

      Be the First to Share

        Recommendations

        • Retro Tech Challenge

          Retro Tech Challenge
        • Tinkercad Student Design Contest

          Tinkercad Student Design Contest
        • Plastic Challenge

          Plastic Challenge

        36 Comments

        0
        rachelgottlieb
        rachelgottlieb

        Question 5 months ago

        Hello, I'm now trying to use conductive thread instead of the ribbon. I'm seeing the data for the A0 input show on the serial monitor but the values are not changing from 680 or so (when connected to 3.3V) or 1000 (connected to 5V) when I connect the alligator clips to a single piece of thread. It doesn't work for a range of resistor values. Does it only work when you knit the conductive thread into the yarn?

        0
        i.saralynn
        i.saralynn

        Answer 5 months ago

        I believe the conductive thread must be knitted. Also, I was using a bit thicker conductive yarn instead of thread so it might be more difficult to get values out of the thinner conductive thread. Please reference these tutorials for more info: http://www.kobakant.at/DIY/?p=1762
        https://www.instructables.com/Circular-Knit-Stretc...
        "The stretch sensing is actually due to the structure of the conductive yarn which is made up of lots of short steel fibers mixed with polyester. Even without knitting the yarn into a structure you can use it as a stretch sensor by simply pulling it taught or relaxing it. But the yarn is not very strong and easy to tear. The knit structure allows you to accumulate more yarn and thus more resistance in less length and also by combining the conductive yarn with regular yarn you can gauge the sensitivity of the sensor by choosing a thicker or thinner yarn - thicker yarn gets more in the way of the conductive yarn making extra contact through the knitted loop structure. Plus knitting creates the stretchy structure giving you some natural tangible feedback."

        0
        halaballard
        halaballard

        Question 3 years ago

        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
        0
        i.saralynn
        i.saralynn

        Answer 3 years ago

        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.

        0
        halaballard
        halaballard

        Answer 3 years ago

        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!

        0
        rachelgottlieb
        rachelgottlieb

        Reply 5 months ago

        Hello, I'm trying to do a very similar project with the same conductive thread and circuit. What resistor value are you using? 10kOhms? Could you gather data from testing a single conductive thread connected to the alligator clips? Or does it only work when you knit the conductive thread into the fabric? I'm seeing values in the serial monitor but they're not changing when I stretch the thread or use different resistors.

        0
        i.saralynn
        i.saralynn

        Answer 3 years ago

        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.

        0
        AneeshS11
        AneeshS11

        Answer 3 years ago

        Color doesn't matter.

        0
        i.saralynn
        i.saralynn

        Answer 5 months ago

        Hi, I'm not sure. It seems like this ribbon doesn't have the ability to stretch, and the set up I created uses the thread/elastic yarn combo as a stretch sensor. If the material cannot stretch, then you won't see a change in the resistance/numbers. I'd try pulling it with your hands to see if you see any noticeable change in the numbers that way, but it seems like it's probably not a stretchy enough material to be sensitive enough to breath.

        0
        Choi nani
        Choi nani

        1 year ago

        Hi, may i know what data acquisition software was used for this? How can we know or see the result or the graph of respiratory rate? Thanks.

        0
        i.saralynn
        i.saralynn

        Reply 1 year ago

        Hi, I used Arduino's serial monitor in this tutorial (as noted in step 6) to see the incoming raw numbers from the sensor, but it does not calculate any respiratory rate or graph. You could use this raw incoming data and send it to any software you like to make your own code/calculations/graph if you wanted. This tutorial just simply shows you how to get the raw data into your computer. For a simple graph you could try using Arduino's Serial Plotter: https://randomnerdtutorials.com/arduino-serial-plotter-new-tool/

        0
        Choi nani
        Choi nani

        Reply 1 year ago

        Ouhh okay2 thank you. And one more thing, it is possible if i add lcd to display the output? Like the lcd show users breath per minute?

        0
        i.saralynn
        i.saralynn

        Reply 1 year ago

        I'm sure it's possible. You'd first have to create a code to determine when a breath is taken based off the raw data (probably something like when there is a certain increase/decrease in the numbers over a certain period of time = breath taken. Then how many of those happen each minute that happens. Then output that number to an LCD screen. I'm sure you can search for other projects that do this with heart pulse sensors and find something helpful. I personally haven't tried to do it specifically.

        0
        i.saralynn
        i.saralynn

        Reply 1 year ago

        I will add this sensor isn't a like perfectly fine tuned machine obviously, it can be finicky. For example data might vary greatly from person to person based on how tight the strap is around a person or where the person is breathing from (the chest or lower in the stomach.. depending on the person it can sit lower or higher on the torso to work best), how deep they are breathing. There is probably a way to code this into consideration, just fyi.

        0
        Choi nani
        Choi nani

        Reply 1 year ago

        Thank you for answering me. I'll try

        0
        ENGRCAI
        ENGRCAI

        Question 2 years ago

        Can i use conductive thread instead of conductive yarn? Please answer. Thank you sir.

        0
        i.saralynn
        i.saralynn

        Answer 2 years ago

        I'm not sure, I've never tried it, you'll just have to test it out. I think it should work, but there is a possibility it might be too thin to get a strong reading and you'll probably need to play around with what resistor works best. Let me know what you find!

        0
        Paul RyanS
        Paul RyanS

        2 years ago

        Is FlexSensor can be used in this project?