Wednesday, September 10, 2014

Sigh Collector using Arduino [Full Tutorial]


Sigh v. i. [imp. & p. p. {Sighed}; p. pr. & vb. n. {Sighing}.]
1. To inhale a larger quantity of air than usual,
and immediately expel it; to make a deep single
audible respiration, especially as the result or
involuntary expression of fatigue, exhaustion,
grief, sorrow, or the like.
[1913 Webster]

Description:
These are instructions for building a home monitoring system that measures and 'collects' sighs. The result is a physical visualization of the amount of sighing, for personal use in a domestic environment.

The project is in two parts. The first part is a stationary unit, which inflates a large red air bladder upon receiving the appropriate signal. The second part is a mobile unit, worn by the user, which monitors breathing (via a chest strap) and communicates a signal to the stationary unit wirelessly when a sigh is detected.

Assumptions:
1. You have a basic understanding of construction and fabrication techniques,
as well as access to the appropriate tools and facilities.
2. You have a working knowledge of physical computing (reading circuit diagrams)
3. You are overwhelmed with the anxiety of living in a failing state, and frustrated
that most of your household objects address only physical rather than emotional health.

Step 1: Material Needed

Here is an overview of the materials that will be needed.
Each individual page has more details and links on where you can purchase some of these materials.

Physical Materials:
> 1, 4x8 Sheet of Plywood. I used a piece of shop-grade maple ply.
> 2, 2x2 for the structural frame
> ~2 yards of red nylon strap fabric
> Some loose red fabric from a fabric store
> Latex tubing (Inner Diameter: 1/8", Outer: 1/4")
> Wood Screws ( 5/16, 3", 4" )
> 1 Rechargeable battery powered air pump (Coleman Rechargeable Quick-Pump)
> 1 unidirectional "Check Valve"
> A piece of a garden hose
> Liquid Latex & Red Pigment, or a large red balloon of some kind.

Electronics, Misc:
> 1, 20cm Stretch Sensor
> 1 red RCA cable, Male and female headers
> 1 10K Potentiometer with large sized knob
> 1 3-way toggle switch
> 2 Arduino Microcontrollers (Diecimille or newer)
> 2 9V battery clips with 5mm (center positive) male jacks.
> 2 xBee wireless modules
> 2 xBee shiels from LadyAda
> 1 FTDI cable for programming the xBees
> 1 LMC662, "rail-to-rail" OpAmp chip
> Misc Electronics components (see circuit diagrams for details).

Step 2: Build and Program Circuit. Hack into Air Pump

I like to start by getting the electronics working first, usually with a prototype of what I want to build (made from cheap exterior plywood, or even cardboard and hot-glue).

The electronics are divided into two parts. This part is the receiving end. It will receive a wireless signal from the wearable unit and use that signal to turn an air pump on for ~2 seconds and then turn it off.
Between the pump and balloon, is what's called a check valve, which lets air pass one direction but not the other.

The air pump is a Coleman Rechargeable "Quickpump". I like it because of the rechargeable battery, and the different sized nose attachments.

Open up the pump and rework the toggle switch, so that it's bridging between the battery and one terminal of the motor. The other terminal of the motor will run to the collector of the TIP120 transistor. To do this, you'll have to de-solder the black wire from the second motor terminal, and also de-solder the lead coming from the battery charger and going to the other end of the toggle switch. Be sure to common ground the motor's battery with the arduino's power supply.

Build the circuit in the diagram below. There is also a PDF attached for higher resolution.
Program the arduino with the code supplied in the text file. You'll need to install this library.

If you don't know how to work with Arduino, here are some references so you can learn:
> Main Arduino Website
> Freeduino -- Repository of Arduino knowledge and links
> NYU, ITP's in-house physical computing site with tutorials and references.

Step 3: Build the Sigh Collector main unit

For the sake of brevity, I will not detail every step in the process of building the main unit. Suffice it to say that it can be as simple or complex as you wish; anything from cardboard and hot glue to custom fabricated or more advanced materials.

I have designed mine this way, which isn't to say it's the only way it could be done. If you care to follow or elaborate on my instructions, see the diagram below. Again, a higher resolution PDF is attached. On the diagram, you will find exact measurements and specifications on how to build the unit pictured below.

As stated in Step 2, I built mine out of shop-grade Maple plywood. It has a nice grain and cuts well. I left the surface raw.

A couple design notes:
I decided to drive all the screws in from the inside so that you wouldn't see them from the exterior. It can be tricky to sneak a drill inside of the unit, so I recommend building it in sections. I angled the bottom edges of the 2x2 frame, so that they would look a little sleeker when visible.
The top piece with the mitered corners and circular opening is removable, for easy repair of inside parts. The pump and electronics will sit inside the box, on a shelf that is held up by two of the 2x2's on the inner frame (see diagram).

The reason I built it on a frame is so that the corners would stay square. Otherwise, plywood can tend to warp. This way, also, everything can be held together by screws and therefore broken down easily into pieces.

Step 4: Make the air bladder

I wanted a more organic, fleshy texture of my air bladder, so I cast it out of liquid latex. Liquid latex of many different sorts can be bought in a craft store, prop shop or easily on the internet. I mixed the latex with red pigment to color it, and painted it, in layers, onto the outside of a large balloon. The many layers built up to form a big, floppy fleshy balloon, with the texture I created with the brush.

A simple balloon, beach ball or even a garbage bag could replace. Check out this website for different types of large-sized balloons.

Step 5: Combine electronics with main unit. Install Check Valve and Pump

Place the air pump and circuit inside of the main unit, on the lower shelf. Now it's time to make a connection between the air pump, and the air bladder/balloon, which will sit on the surface.
We only want air to go one way, and not come out the other direction, so we use something called a "check valve". The basic principle is that a hinged door, rubber diaphragm or ball is displace by air going one way, but then prevents the air from going back.

I bought my check valve on McMaster Carr's website; More specifically it's called a PVC Swing-check valve. I'm using the 1" diameter one. This one was attractive to me because of it's extremely low "cracking pressure", or the pressure needed to displace the barrier. < 0.1 psi !!

I used a simple garden hose to run from the pump, to the check valve, then from the other side of the valve into the balloon. The fittings are coupled and sized properly, and I used some glue to further secure them, and prevent any air leaks...

Step 6: Build carrying case, Sew handle.

Sighing is monitored by a chest strap that you will wear. To hold the electronics and power supply, you must build a "carrying case". This will be mobile and will attach to the chest strap. You will carry this around with you while you perform your daily tasks and it will monitor your sighing activity. When a sigh is detected, the mobile unit will send a wireless signal to the main unit.

Again, you may follow the diagram I've provided and find measurements on how to build the carrying box. Or you may choose to make your own, unique version, or improve upon my own. I modeled mine after various kinds of medical, patient monitoring devices.

Notes:
I spliced an RCA cable in between the circuit and the sensor/chest strap (Steps 7 & 8) so that it can easily plug in and out of the box. I chose RCA cable because it's a simple way to have two stranded wires, packaged nicely with an easy to plug/unplug header. I slipped the RCA cable into a length of latex tubing, for aesthetic reasons.

Step 7: Build and Program circuit for sigh detection. Assemble electronics into carrying case.

Follow the circuit diagram below. A higher resolution PDF is also attached.
Program the Arduino with the provided code.

To monitor breathing, we will be making a chest strap that is outfitted with a stretch sensor. The expansion and contraction of the chest will provide us with data that we can use, in code, to extrapolate what normal breathing is, and therefore determine with a larger than usual inhalation (followed by large exhalation) is. A 10 or 20K potentiometer will be used to dial in a threshold value, which will represent how large of an inhalation is associated with a sigh.

I purchased my stretch sensor from Merlin Robotics, a company in the UK. They stock a variety of sizes. I'm using the 20cm sensor.
In my circuit, i'm amplifying the signal from the sensor with a resistor bridge and an OpAmp chip (see diagram). This is the method suggested by the manufacturer. You can find the datasheet on the internet. Note: I imagine a similar idea could be done with pressure sensor instead of a stretch sensor. You'd could attach the pressure point on the sensor to some kind of tubing and wrap that tubing around the chest.

Drill holes in the front face of the carrying case and attach the potentiometer, indicator LED, power switch and stretch sensor attachment (RCA, female) to it from the back before screwing the box back together.

I'm powering the Arduino with a 9V battery. I've got 2 of them wired in parallel so i'll get the same voltage, but double the amperage (it'll last longer).
circuit-sigh-send.pdf(500x500) 247 KB

Step 8: Cut and Sew chest strap and attach the stretch sensor.

The basic idea here, is that a fabric strap is wrapped around the chest by the lower ribs (where the most motion occurs). The stretch sensor bridges a small gap in the chest strap, the rest of which is not stretchy, so breathing, subsequently deforms the sensor as needed.

You'll have to measure the length of strap to your individual body type. I sewed an extra strip of fabric around the strap, so the wires can safely sit inside. In the front, where the stretch sensor connection is, I sewed a 'sleeve' of fabric that would loosely cover the sensor so it wouldn't get rubbed or damaged.

In the back of the chest strap, I made a simple shape (like on a backpack) for tightening and loosening the strap. I had the shape laser-cut out of clear acrylic (see image), but you can make it any way you are able to.

Step 9: A word on Wireless

One thing I haven't talked about yet, is how the wireless communication is being achieved. I am using xBee wireless modems. xBee's are an easy way to make a wireless point-to-point connection, or create a mesh network. To interface with my Arduino board, I used LadyAda's xBee adapter. It's inexpensive, easy to put together and there is a detailed instructional website explaining how to configure it.
Through a combination of this website, and a chapter on xBee radio's in the book "Making Things Talk" (Tom Igoe), I implemented, possibly what is the simplest use of these radios, which are actually quite powerful.

I got my adapters and xBees (+ the appropriate cable) from here.
Instructions on configuring the xBees are here.

The only thing i'm not going into is how to configure the xBees. I did it very easily (on a mac) by transcribing some code from Igoe's book that uses Processing to create a simple terminal for programming the xBee. That code is on page 198.

Step 10: Finished




Congrats! You're finished. You can now use your Sigh Collector to monitor your emotional health.

0 comments:

Post a Comment