Open bernstagon opened 9 years ago
Guys this is what we will be using and I'm purchasing tonight. They are incredibly cheap and are have good support from the Arduino page; meaning, it comes with an open source code, that we can manipulate. Super excited.
I've attached the link
https://www.arduino.cc/en/Tutorial/Knock http://www.adafruit.com/products/1740?gclid=CjwKEAjwkK6wBRCcoK_tiOT-zFASJAC7RAriUiuKgPG8kPb57IBylcK6CueEX2s2-ZEEQkdqs0VnVxoCc_fw_wcB
Brendan, my though process for why this could be useful for one of the prototypes is because this sensors will act similar to a vibration sensor and will be capable of sensing hits from a larger surface compared to a regular pressure sensor, where, we are limited to the surface area.
In the code below, the incoming piezo data is compared to a threshold value set by the user. Try raising or lowering this value to increase your sensor's overall sensitivity.
/* Knock Sensor
This sketch reads a piezo element to detect a knocking sound. It reads an analog pin and compares the result to a set threshold. If the result is greater than the threshold, it writes "knock" to the serial port, and toggles the LED on pin 13.
The circuit: * + connection of the piezo attached to analog in 0 * - connection of the piezo attached to ground * 1-megohm resistor attached from analog in 0 to ground
http://www.arduino.cc/en/Tutorial/Knock
created 25 Mar 2007 by David Cuartielles http://www.0j0.org modified 30 Aug 2011 by Tom Igoe
This example code is in the public domain.
*/
// these constants won't change: const int ledPin = 13; // led connected to digital pin 13 const int knockSensor = A0; // the piezo is connected to analog pin 0 const int threshold = 100; // threshold value to decide when the detected sound is a knock or not
// these variables will change: int sensorReading = 0; // variable to store the value read from the sensor pin int ledState = LOW; // variable used to store the last LED status, to toggle the light
void setup() { pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT Serial.begin(9600); // use the serial port }
void loop() { // read the sensor and store it in the variable sensorReading: sensorReading = analogRead(knockSensor);
// if the sensor reading is greater than the threshold: if (sensorReading >= threshold) { // toggle the status of the ledPin: ledState = !ledState; // update the LED pin itself: digitalWrite(ledPin, ledState); // send the string "Knock!" back to the computer, followed by newline Serial.println("Knock!"); } delay(100); // delay to avoid overloading the serial port buffer }
https://www.youtube.com/watch?v=PNQ8R1Ptvs4
For the future prototypes we will be using these lights, they are cheaper, in the sense that they look less fancy than the adafruit ones, there will be less libraries, there is a good tutorial for it them though. Will be buying them. The cool thing is they are each individually addressable which means we will not have to cut and solder.
https://github.com/pololu/pololu-led-strip-arduino
Where we will be getting our libraries for the new lights
As far as I am aware, the difficult parts of the job will be: -1: designing a comfy outfit that works well with the sensors, and -2: working with the sensors (perhaps there are nice libraries--but they aren't needed). This should be less difficult.
I just wrote the basic pseudocode logic for one version of a game, and, while incomplete, I already know what to do with everything but the sensors. So I don't think this will be hard.