Midterm-Don't touch me
After our first discussion of the project, Ayal and me decide to do something related to the light and sound. And since the theme is Halloween, we came up the idea to make a pumpkin which have light and sound. And we can trigger the sound and light through the vibration sensor. The following is our meeting note and idea summary.
But the problem is will the vibration will influence each other when we press or knock it? Can it been touched through the thickness of the pumpkin?
We doing some simple test through the paper, It works, then we got one pumpkin and Ayal curve it.
I'm responsible to doing the sound parts.I figure out that there are two way to do the sample sound. One way is put a SD card in side the uno board, another is to put the sound in to P5 sketch and connect p5 sketch to the vibration sensors which is mapping on the pumpkin.
I tried with the simple circuit. Just use analog read for one side of the sensor, another side to the resistor and to the ground. Then code it in Arudrio and p5 make it works.
(code for arduino)
// Variables will change: int buttonPushCounter = 0; // counter for the number of button presses int button1State = 0; int button2State = 0; int lastButtonState = 0; // previous state of the button
// the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); }
// the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue1 = analogRead(A0); int sensorValue2 = analogRead(A1);
//CHEEK SENSOR
if (sensorValue1 > 120) { button1State = 1; } else { button1State = 0; }
//NOSE SENSOR if (sensorValue2 > 40) { button2State = 1; } else { button2State = 0; }
// Serial.print(b1); // Serial.print(','); //Serial.println(sensorValue2); Serial.print(button1State); Serial.print(","); Serial.println(button2State); delay(100); // delay in between reads for stability }
After I run the signal in the right way, I do an poster on the sketch and then mapping the sensor on the pumpkin.
code for P5js
http://alpha.editor.p5js.org/techlu/sketches/r18D9H3pb
And I use the sampling sound to put it into p5 to make it works like a touchable scary pumpkin.
(password pcomp)
Thanks all good job from Ayal and the help on coding from Siman and Coji.