Upload
shawnleegabriel
View
106
Download
1
Embed Size (px)
DESCRIPTION
This sketch reads 4 piezo elements to detect a pressure of the foot. It writes piezo data to the serial port. This makes for a great research project for any person in the world or science fair project for junior high school students and senior high school students. It is done withe Arduino.
Citation preview
/* Open Source Foot Placement Detector
This sketch reads 4 piezo elements to detect a pressure of the foot.
It writes piezo data to the serial port. This makes for a great
research project for any person in the world or science fair project
for junior high school students and senior high school students.
The circuit:
* Sew each one of 4 piezo elements to the foot bottom of
* a sock. Solder and heat shrink the leads to on end
* of a CAT-5 or CAT-6 UTP cable about 6 foot in length.
* Use each pair for one piezo element:
* + connection of the piezo attached to analog in 0 with is the
* solid color in the twisted pair.
* - connection of the piezo attached to ground is the striped
* color in the twisted pair.
* The other end of the UTP cable is an RJ-45 plug.
*
* Connect the Solid green wire in the RJ45 receptacle
* to one side of a 1-megaohm resistor.
* Connect the Solid orange wire in the RJ45 receptacle
* to one side of a 1-megaohm resistor.
* Connect the Solid blue wire in the RJ45 receptacle
* to one side of a 1-megaohm resistor.
* Connect the Solid broun wire in the RJ45 receptacle
* to one side of a 1-megaohm resistor.
* All the striped wires in the RJ45 receptacle box are
* tied together and connected to other side of all
* four of the 1-megaohm resistors.
* Each one of the solid and striped colors in the
* RJ45 receptacle box s connected to the Arduino via
* a short piece of UTP cable.
* Solid Green of this cable goes to the analog pin 0
* Solid Orange of this cable goes to the analog pin 1
* Solid Blue of this cable goes to teh analog pin 2
* Solid Brown of this cable goes to the analog pin 3
* All of the striped colors of this cable go to the
* ground pin on Arduino.
The operation:
* 1. You wear the sock with the piezos on the bottom of you foot.
* 2. You can put another sock of that sock to protect the piezos.
* 3. Now you are ready to put on the shoes, that you want to test.
* You can even forget the shoes if you want to do a control
* test first.
* 4. Plug the cable into the RJ45 jack that is connected to the
* Arduino.
* 5. You turn on power to the Arduino and plug it into your
* Windows Box, Macintosh Box, or Linux Box that has the Arduino
* Terminal monitor program. Any serial port terminal program
* could also do at 9600bps. The Arduino software is needed
* for you to program your new Arduino with this program.
* 6. Open the Arduino Terminal monitor program.
* 7. Turn the switch to on when you want to acquire your test
* results. This can be right away or after you started
* walking or running.
* 8. You can turn the switch off anytime you are satisfied with
* your results.
This circuit is written by Shawn L. Gabriel
* created 11 April 2k10
* email [email protected]
This circuit is based on the followig tutorial
* http://www.arduino.cc/en/Tutorial/Knock
* created 25 Mar 2007
* by David Cuartielles <http://www.0j0.org>
* modified 30 Jun 2009
* by Tom Igoe
*/
// these constants won't change:
const int FootSensor1 = 0; // the piezo is connected to analog pin 0
const int FootSensor2 = 1; // the piezo is connected to analog pin 1
const int FootSensor3 = 2; // the piezo is connected to analog pin 2
const int FootSensor4 = 3; // the piezo is connected to analog pin 3
// Pulse In Pin
const int ReadPin = 9; // pin for counting pulses
// these variables will change:
int footsensorReading1 = 0; // variable to store the value read from
// the sensor pin
int footsensorReading2 = 0; // variable to store the value read from
// the sensor pin
int footsensorReading3 = 0; // variable to store the value read from
// the sensor pin
int footsensorReading4 = 0; // variable to store the value read from
// the sensor pin
void setup() {
Serial.begin(9600); // use the serial port
}
void loop() {
// read the sensors and store it in the variables for sensorReadings:
if (ReadPin == 0) {
footsensorReading1 = analogRead(FootSensor1);
footsensorReading2 = analogRead(FootSensor2);
footsensorReading3 = analogRead(FootSensor3);
footsensorReading4 = analogRead(FootSensor4);
Serial.print("sensorReading1 = ");
Serial.println(footsensorReading1);
delay(10); // delay to avoid overloading the serial port buffer
Serial.print("sensorReading2 = ");
Serial.println(footsensorReading2);
delay(10); // delay to avoid overloading the serial port buffer
Serial.print("sensorReading3 = ");
Serial.println(footsensorReading3);
delay(10); // delay to avoid overloading the serial port buffer
Serial.print("sensorReading4 = ");
Serial.println(footsensorReading4);
delay(10); // delay to avoid overloading the serial port buffer
Serial.println("============");
delay(10); // delay to avoid overloading the serial port buffer
}
delay(100); // delay to avoid overloading the serial port buffer
}