\\ ==== ==== [[start:classes:principlesofdesign:arduinogames:air_guitar|Air Guitar Home]] ====Sensor Testing==== ===Flex Sensor=== ==How It Works== The strip is made out of a special material that changes resistance when flexed. In this way, the sensor is a variable resistor that can be wired in voltage divider for use with Arduino. ==Applications in Air Guitar Glove== This sensor could potentially be used to detect finger bending. ==Our Setup== We taped a flex sensor to one of our fingers and wired it in a voltage divider. The Arduino was programmed to power an LED when the voltage input from the sensor was above a certain threshold.\\ {{:start:classes:principlesofdesign:arduinogames:circuitry.png?nolink%500}} ==Conclusions== The sensor worked as expected. We noticed noise in the input voltage but this is acceptable because we do not intend to measure how much a finger is bent, only if it is bent or not. Multiple sources told us that these sensors are unreliable and easily fatigued so we decided to not use them, despite their favorable performance in our test. ===Ball Switch=== ==How It Works== This one-dimensional tilt sensor contains a small metallic ball that moves from one end of the cylinder to the other, depending on the orientation of the senosr. If the ball is on one side, it closes a switch and completes a circuit. When the ball is on the other side the switch is open. ==Applications in Air Guitar Glove== A tilt sensor is needed to detect strumming motions. ==Our Setup== We sent a voltage through the sensor to an Arduino input and programmed the Arduino to power an LED when the voltage inputted was above a certain threshold. We then taped the sensor to the back of our hand and moved the hand in a strumming motion. See the video here: [[http://www.youtube.com/watch?v=fFaYB_hAYXA&context=C488cb0eADvjVQa1PpcFMfNkvprHHO8LK6ylLunc2yF7CF_PtNJpc=]] ==Conclusions== We found the voltage changes from this sensor to be inconsistent and delayed. We decided to purchase a four-way tilt sensor to see if it would give us better results. ===Rotary Potentiometer=== ==How It Works== A rotary potentiometer is a device that outputs a signal voltage proportional to the displacement angle of the shaft. For more information, consult wikipedia. ==Applications in Air Guitar Glove== A small rotary potentiometer mounted above the knuckle and attached to some kind of linkage could be used to detect finger bending. ==Our Setup== We used a bent straw as an arm that rotates the shaft of the potentiometer. We then connected the potentiometers three pins to the Arduino and watched the voltage change when the arm was rotated.\\ {{:start:classes:principlesofdesign:arduinogames:0321121555.jpg?nolink%500}} {{:start:classes:principlesofdesign:arduinogames:0321121556.jpg?nolinkn%500}} ==Conclusions== This setup worked as expected and the voltage reading was extremely stable. ====Sample Code==== /* AnalogReadSerial Reads an analog input on pin 0, prints the result to the serial monitor This example code is in the public domain. */ void setup() { Serial.begin(9600); } void loop() { int sensorValue = analogRead(A0); Serial.println(sensorValue, DEC); delay(10); if(sensorValue > 700){ digitalWrite(13, HIGH); } else { digitalWrite(13, LOW); } }