Introduction: Foot Tap Amplifier

Tap v. i. [imp. & p. p. {Tapped} p. pr. & vb. n. {Tapping}]
1. To strike lightly especially with a slight sound
2. To give a light blow with.
3. To bring about by repeated light blows.


These instructions are for a system that monitors nervous foot-tapping. Inspired by “Restless Leg Syndrome”, this system addresses the uncontrollable urge to relieve bodily stress by shaking the legs and/or tapping the feet.

The projects is in two components: The wearable component consists of a leg-brace which detects acceleration caused by tapping and shaking. Additional electronics are housed in a tethered carrying case, which can be rested on the back of a chair. When a tap is detected, a wireless signal is transmitted to a nearby stationary unit, which strikes a cinder block once with a chisel. Over time, the nervous tapping of the individual is externalized and visualized by the gradual reduction of the concrete.

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: Materials

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.
> 1, 12"x12" piece of 1/8" acrylic (frosted white)
> 1, 5x8" piece of 1/4" acrylic (frosted white)
> A small piece of 1/4" birch (~8x10")
> One cinder block from Home Depot
> "Dasco Pro: 3-Piece Marking Kit" from home depot (for the chisel)
> 4, 2x2 beams for the structural frame
> ~2 yards of red nylon strap fabric (2")
> ~3 yards of red nylon strap fabric (1")
> Latex tubing (Inner Diameter: 1/8", Outer: 1/4")
> Wood Screws ( 5/16, 3", 4" )
> 1 1/4" diameter steel rod (about 14" length)
> 1 Cam Roller (McMaster Carr)

Electronics, Misc:
> 1 accelerometer (I bought it with a breakout board, from Sparkfun)
> 1 telephone cable, several male telephone cable headers, One crimping tool
> 1 female telephone cable jack
> A little perf-board
> 1 10K Potentiometer with large sized knob
> 1 single pole - double-throw switch
> 2 LEDs (red and green)
> 2 Arduino Microcontrollers (Uno)
> 2 9V batteries with battery clips.
> 2 xBee wireless modules
> 2 xBee shiels from LadyAda
> 1 FTDI cable for programming the xBees
> 1 DC gearhead motor from Jameco (Part# 253500)
> 1 large sized roller switch (to be used as a limit switch)
> 1 12V power supply
> Misc Electronics components (see circuit diagrams for details). 

Step 2: Solder Accelerometer, Put Together Leg-Brace

To start, let's get the electronics working on the table. I'm checking for foot tapping using an accelerometer, which can be found pretty cheaply these days. I'm using a 3-axis accelerometer (x, y, and z directions), but only really checking acceleration of the leg in the x and y direction. I got mine from Sparkfun because it comes on a breakout board and is very easy to solder and get started with. It's fitted with the ADXL335 accelerometer, made by Analog Devices. 

First I soldered the accelerometer (not directly of course, but through a socket) onto a small piece of perf board, and taped it to my leg (for testing), I ran four wires up to my desk and read it into the Arduino Uno. The rest is described in Step 4. 

 Note: I'm sending 4 wires from my leg, to the table. A telephone cable is a convenient bundle of 4 wires, so I appropriated one; Snipped it and crimped it to the right length, and used that. 

I hid the accelerometer board inside a small wooden box. For aesthetic and conceptual purposes, I designed the leg-attachment to look like a brace-- something you might wear if you are injured. That is my choice, because I want this system to look vaguely medical. You are welcome to do whatever you like. 
I had the leg brace form laser-cut out of 1/4" white acrylic. After it was cut, I heated it up with a heat gun and gently bent it into a curve (See before/after image). I sewed a few nylon straps through the laser-cut slits, so I could tightly strap the whole brace to my leg. The wooden box with the accelerometer inside is screwed to the plastic strap. 

Step 3: Build Carrying Case, Sew Straps

The next step is to create a housing for the arduino and breadboard. This could be small and out-of-mind/sight, but we are making a decision to engage in a slightly cumbersome system, so why not ham it up? Carrying cases remind me of home medical-monitoring equipment. The one I made is about lunchbox size and features a red strap for travel, as well as two rear hooks, so you can rest it on the back of any chair. 

Be sure to make the front face removable. We will need to drill & dremel various openings in it, so knobs, indicator lights and a power switch can be embedded in it. 

Step 4: Build and Program the Circuit for the Sending Unit, Mount in Box

  The four wires coming up from the accelerometer on your foot-unit  are connected to Vcc, Ground, X and Y signal from the breakout board. Vcc gets 3.3V from the Arduino (Don't give it 5V!! It's too much!) and the X and Y signals go into Analog In pins on your Arduino.
   In the code (below) I'm adding the X and Y signal together, since a shaking leg usually contains both horizontal and vertical acceleration. After some easing, mapping and constraining of the input values, I have clean rising and falling values to observe. I set a potentiometer to a threshold variable. The instant the accelerometer value drops below that threshold, a "foot tap" is registered and a positive signal is sent out wirelessly through the xBee (described later). Also, a red LED blinks once to indicate that the signal was sent. 

The Arduino needs to be free and untethered, so we'll power it using 2 9V batteries. The batteries are wired up in parallel, so they can deliver twice the current, but remain at 9V (Wiring them in series would do the opposite). Connect + to the Arduino Pin labled "Vin", and Ground to GND. I spliced a SPDT switch in between the power signal from the battery and V-in, so I could turn the arduino on/off manually. I also ran a green led (with 470Kohm resistor) out of the main power supply and into the front face, to indicate to us that power is flowing. 

I crimped a male telephone cable header onto the incoming wire from the leg piece. On the front face of the carrying case, I embedded a female telephone jack, so that you can separate the carrying case from the leg strap. While doing this, be careful to keep the wire color-scheme consistent, so you know exactly which wire is coming from the accelerometer and going into your Arduino. There are multiple points along the way where these can get mixed up, so keep careful track of what's connected to what!

Build the circuit in the attached PDF diagram. 
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 5: Build a Box for the Chiseling Machine

Ok, so we have the foot-tap "Sending Unit" complete. A foot tap is registered and a wireless signal is sent out into the ether. So now we need to design and build the unit that will read this signal, and translate it into a chisel-hit. We'll first start with the mechanism, and then we'll add the electronics. 

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 attached diagram. In the diagram, you will find exact measurements and specifications on how to build the unit pictured below.

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 the side pieces 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. 
The piece with the mitered corners and and cinder block is removable, for easy repair of inside parts, and to reduce weight with transporting. The electronics can be hidden anywhere inside that you see fit. 

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 6: Install the Hammer Arm, Cam and Cam-roller

The trickiest part in my version wasn't the construction of the outer frame, but rather, the careful positioning of the hammer arm, cam and motor. 

To get the chiseling motion, I went back to a mechanism that I know and i'm comfortable with: the DaVinci cam-hammer. See this video for reference. The idea is as follows: The cam is mounted on the motor shaft. When the signal is received by the xBee, the motor is switched on. It rotates, lifting and dropping the hammer. After one full rotation, it hits a carefully positioned "limit switch", which sends a signal to turn the motor off. 

To reduce wood-on-wood friction, I bought this track-roller from McMaster Carr. It has a 7/8" diameter, and a width of 1/2" which nicely fits our hammer arm. The cam and hammer-arm are thickened by gluing two together. The track-roller has a nice threaded end that screws easily into a pre-drilled hold in the side of the hammer-arm. Now the cam can run along this roller with very little friction, instead of the hammer-arm itself. Nice!

Depending on your construction, you'll have to figure out how to best position the cam in relation to the arm/roller. I didn't have to glue the cam to the motor, because the motor shaft has a hole in the middle of it. I drilled out a small hole in the side of the cam and ran a screw through the inside of the cam, that would go through the hole in the motor shaft. That way, the two are mechanically linked. 

Note: There's a bug in my instructables that won't let me save any more picture notes. Once I get this sorted out, I'll add pic notes for the rest of my images. Sorry for this. 

Step 7: Install the Limit Switch

The limit switch is an important part of the mechanism. It signifies that one turn of the DC motor has been completed. Finding the right place for it is a little tricky. When the motor shuts off, it will "coast" another few centimeters before stopping completely. Because of this, the mechanism needs to hit the limit switch slightly before one complete revolution. It's not perfectly robust, but it works well for our purposes. Because of this coasting, the limit switch is also released (as opposed to being held down indefinitely). This occurrence makes our code a lot simpler. 

I installed my limit switch behind the hammer arm, against the back wall of the unit. When the arm pivots backward, it hits the switch. Just then, as the motor is coasting to a stop, the arm falls back down releasing the switch (and chiseling the concrete). 

I'm using a roller switch from radioshack. A smarter and longer term solution would be a no-contact one. Instead of a physical switch, which can be damaged over time, one could, for example, attach a magnet to side of the rotating cam. When the magnet passes by a reed switch or hall-effect sensor (senses magnetic fields), the same result would be achieved without any physical contact. 

Step 8: Build and Program the Circuit for the Chiseling Unit

This is the circuit for the "Receiving Unit". When a wireless signal is sent from the sending unit (indicating a foot tap), the motor is switched on (by the arduino) and off again (by the limit switch in the previous step). The result is one chisel-hit to the cinder block below. 

The motor is being controlled through the digital pins of the arduino, and a TIP120 transistor. Check out the attached circuit diagram and code for more details. The motor is receiving external power from a 12V supply. Don't forget to "common ground" your arduino with your external supply!

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!

Congratulations! You're finished. You are now ready to use your Foot Tap Amplifier to monitor your emotional health