Tuesday, April 24, 2007

Final Project - Power Laces

Against my better judgement, I decided to attempt my Power Laces shoe for my final project. I knew it would be very difficult but with the encouragement and enthusiasm from the class, I did my best to create a sneaker that automatically tightens around the wearers foot when they step in the shoe.

The system works like this: First, the wearer puts their foot in the shoe. A sensor in the heel sends a signal to an Arduino mini microcontroller and then the MC sends a signal to the motors, telling them to turn on. There are two wires going across the tongue of the shoe. Both wires are anchored on one end and attached to a motor shaft on the other. The motors begin to wind the wires and tighten the shoe around the foot. When the shoe reaches a certain predetermined tightness, a sensor underneath the tongue and is triggered and sends a signal to the MC. The controller then sends a High signal to both motor legs and prevents the motor from slipping. Now the shoes are tight on the wearers foot. To loosen the shoes, the wearer places the toe of one shoe behind the heel of the other. A magnet in the toe of each shoe closes a magnetic switch in the heel of of the opposite shoe. The microcontroller code is written in such a way that the number of winds it takes to tighten the shoe is recorded and then used to unwind the laces the same number of turns.

Here is the code:

//power laces

int heelswitchPin = 2; // heel switch input
int heelswitchState = 0; // the state of the heel switch
int toemotor1Pin = 3; // H-bridge1 leg 1
int toemotor2Pin = 4; // H-bridge1 leg 2
//int tonguemotor1Pin = 5; //H-bridge2 leg 1
//int tonguemotor2Pin = 6; //H-bridge2 leg 2
int speedPin = 9; // H-bridge enable pin
int sensorPin = 0; // Analog input pin that the sensor is attached to
int sensorValue = 0; // value read from the sensor
int magnetswitchPin = 8; //magnet switch input
int magnetswitchState = 0; //state of the magnet switch
long tightenInterval;
long loosenInterval;
long startTime;


void setup() {
// set the switches as an input:
pinMode(heelswitchPin, INPUT);
pinMode(magnetswitchPin, INPUT);
// initialize serial communications at 9600 bps:
Serial.begin(9600);

// set all the other pins you're using as outputs:
pinMode(toemotor1Pin, OUTPUT);
pinMode(toemotor2Pin, OUTPUT);
// pinMode(tonguemotor1Pin, OUTPUT);
//pinMode(tonguemotor2Pin, OUTPUT);
pinMode(speedPin, OUTPUT);


// set speedPin high so that motor can turn on:
digitalWrite(speedPin, HIGH);


}

void loop() {
// read the heel switch input:
heelswitchState = digitalRead(heelswitchPin);
magnetswitchState = digitalRead(magnetswitchPin);

// if the switch is high, motor will turn on one direction:
if (digitalRead(heelswitchPin) == HIGH) {
digitalWrite(toemotor1Pin, LOW); // set leg 1 of the H-bridge1 low
digitalWrite(toemotor2Pin, HIGH); // set leg 2 of the H-bridge1 high
startTime = millis();
// digitalWrite(tonguemotor1Pin, LOW); //set leg 1 of the H-Bridge2 low
//digitalWrite(tonguemotor2Pin, HIGH); //set leg 2 of the H-Bridge2 high
}

if (analogRead(sensorValue) == 80) {
digitalWrite(toemotor1Pin, HIGH); //set both motor legs to High
digitalWrite(toemotor2Pin, HIGH);
tightenInterval = millis() - startTime;
Serial.println(sensorValue); // print the sensor value back to the debugger pane
}


if (digitalRead(magnetswitchPin) == HIGH ) {

if (tightenInterval >0 ) {
digitalWrite(toemotor1Pin, HIGH); // set leg 1 of the H-bridge1 high
digitalWrite(toemotor2Pin, LOW); // set leg 2 of the H-bridge1 low
delay(tightenInterval);
}
digitalWrite(toemotor1Pin, HIGH); // set leg 1 of the H-bridge1 high
digitalWrite(toemotor2Pin, HIGH); // set leg 2 of the H-bridge1 low

tightenInterval=0;
}


}

This is the schematic for the Arduino circuit with the L293 H-Bridge chip:



Here is the breadboard circuit:





This is a video of the breadboard circuit in action:




Up until this point, everything was working as I had hoped. I neglected to make a video of the final breadboard circuit which includes the code that shuts off the motor after it is finished untying. It did however work just as it was supposed to. The next stage of construction involved making the circuit on a circuit board instead of a breadboard. It does after all have to be small enough to fit on a shoe. Unfortunately this is where the project went sour. I painstakingly recreated the circuit on a small piece of perfboard less than half the size of the original breadboard. In order to do this, I placed the H-bridge chip underneath the Arduino stamp. This made soldering extremely difficult and took close to 5 hours to do. My efforts were in vain however as the finished circuit did not function like the breadboard circuit did. There are so many solder joints and layers of wire that my debugging attempts were futile.

The following are photos of the finished (non-functional) shoe design:





Saturday, April 21, 2007

MIDTERM - THE DISCRETE NUDGE

This is a link to the wiki page for our midterm project:

http://thediscreetnudge.pbwiki.com/?doneLogin=42aec549034a46c1c49d403173dcb173b1681573

Here are some photos of the design process:

This is the original Arduino NG and breadboard prototype:


Miniaturized version on half-breadboard:


mini breadboard with reed switch:


The final circuit complete with indicator lights, battery, and vibrating motor:


The final circuit in it's final, ready to wear form:

Sunday, April 8, 2007

Lab 7 - MIDI Output

This lab featured my old friend, MIDI. The breadboard circuit was pretty straightforward but did not work at first. After a bit of troubleshooting I realized that pins 4 and 5 on the MIDI output jack were switched. After that realization, the lab was working as it should have and I started thinking about making an instrument. Earlier in the semester I attempted to make a drum trigger but was unsuccesful. This time, I used the code from the lab but instead of using a switch, I connected a trigger I made from a piezo element and a practice drum head. When struck, the piezo outputs enough voltage to bring a digital input high. With the Arduino, the high input is sent out to my computer as MIDI data which is running Ableton Live 4. When I hit the drum trigger, a sample of a drum is triggered in LIve. The triggering was pretty accurate with occasional hanging notes. For some reason it was more responsive after the first time I used it. The second time, in class, the triggering was not as tight and I couldn't reproduce the same rolls as I could earlier. I think with some software tweaks, better trigger response can be achieved.