Recap:
We are the drunk walking narc team. OurDuino detects drunk walking and does something about it.
Goal:
- _COLLECT PRESSURE VALUES from stepping, every 30 seconds every 3 minutes
 - _ANALYZE PATTERNS for degradation in pacing over time
 - _RESPOND with a flag if patterns are determined to be "drunk" (More on what this change will be later)
 
Strategy:
- _4 FORCE PRESSURE SENSORS, 2 per foot (1 in heel, 1 in ball)
We will be using the combined value, in order to accommodate for the variance in distributed weight across the foot. - _4 ANALOG PINS on Arduino, with conversions of the analog values to scalar values
 - "Phases[0-N]" MULTI-DIMENSIONAL ARRAYS ", one created every 3 minutes.
Each contains the following information: - "LeftInputs" ARRAY, with 60 cells, 1 every 500 ms. for over 30 seconds
 - "RightInputs" ARRAY, with 60 cells, 1 every 500 ms. for over 30 seconds
 - "Weigh" FUNCTION that analyzes each Phase array and returns a statistical weight for the pacing rate
 - "Compare" FUNCTION that compares the statistical weight from sober (early) phases to current phase
 
Algorithm Psuedocode:
LeftArray;[]
RightArray[];
PhaseArray[][];
void fillFeetArrays {
read in left sensor values;
store values in LeftArray;
read in right sensor values;
store values in RightArray;
}
void fillPhaseArray {
every 3 minutes:
while ( power != OFF ) {
int n = 0;
for (halfsecs = 0; halfsecs < 60; halfsecs++) {
fillFeetArrays;
store LeftArray and RightArray in PhaseArray[n][];
}
n++;
}
}
| psuedocode for filling the multidimensional arrays | 
Code:
/*
  AUTHORS: sarah churng; mallika simone
  SUMMARY: Measures the force exerted in walking.
  Reads in analog input via Force Pressure Sensors (FPS) from pins 
  A0 and A1, and maps the results to 2 respective ranges from 0 to 255.
  Stores these results to arrays LeftValues and RightValues,
  inside multidimensional arrays LeftFoot and RightFoot, respectively.
  CIRCUITS:
1* FPS connected to analog pin A0.
   Center pin of the potentiometer goes to the analog pin.
   side pins of the potentiometer go to +5V and ground
 * LED connected from digital pin 10 to ground
2* FPS connected to analog pin A1.
   Center pin of the potentiometer goes to the analog pin.
   side pins of the potentiometer go to +5V and ground
 * LED connected from digital pin 9 to ground
   USE AND POTENTIAL for the data collected:
 * PACING: as a function of the inputs over time
 * BALANCE: as a comparison between the two inputs' pressure resistances
 */
// ANALOG DATA: Left Foot
const int analogInPin1 = A0;                            // Force Pressure Sensor at A0
const int analogOutPin1 = 10;                           // LED at variable pin 10
int sensorValue1 = 0;                                   // value from variable sensor
int outputValue1 = 0;                                   // value from output to analog out
// ANALOG DATA: Right Foot
const int analogInPin2 = A1;                            // Force Pressure Sensor at A1
const int analogOutPin2 = 9;                            // LED at variable pin 9
int sensorValue2 = 0;                                   // value from variable sensor
int outputValue2 = 0;                                   // value from output to analog out
const int StepsPerPass = 10;
int stepCount = 0;
// ARRAYS
int LeftValues[StepsPerPass];
int RightValues[StepsPerPass];
// INITIALIZE serial communications at 9600 bps
void setup(){ 
  Serial.begin(9600);
}
// FILL ARRAYS with pressure values detected
void fillArrays(){
  for (stepCount = 0; stepCount < StepsPerPass; stepCount++){
    // READ: analog values
    sensorValue1 = analogRead(analogInPin1);              // Read in input from left foot
    outputValue1 = map(sensorValue1, 0, 1023, 0, 255);    // Map to range of analog 0 - 255
    analogWrite(analogOutPin1, outputValue1);             // Change the analog out value
    LeftValues[stepCount] = outputValue1;
    sensorValue2 = analogRead(analogInPin2);              // Read in input from right foot
    outputValue2 = map(sensorValue2, 0, 1023, 0, 255);    // Map to range of analog 0 - 255
    analogWrite(analogOutPin2, outputValue2);             // Change the analog out value
    RightValues[stepCount] = outputValue2;
    delay(500);
  }
}
void loop(){
  fillArrays();
  for (int n = 0; n < StepsPerPass; n++) {
    Serial.print("Left Foot = " );
    Serial.print(LeftValues[n]);
    Serial.print("\t\tRight Foot = " );
    Serial.println(RightValues[n]);
  }
  // Wait 3 minutes to create a new phase cycle
  delay(3000);
}
Next steps and things to think about:
- What's the response type? 
For the actual response to drunk walking, we are considering various social media and technology tools, to signal to friends of the wearer - How are people wearing this prototype?
The arduino and circuits probably have to be housed in a giant belt buckle, with wires running down each pant leg to the sensors connected in the shoe insoles. 
No comments:
Post a Comment