Hi forum.
I should preface this post by saying I'm new to coding...new to the Arduino (started a couple of weeks ago)...and new to posting on forums.
I've been trying to make this thing that makes an LED increase its brightness dependent on the 'intensity' of a breath [then dim at a constant rate until its breathed on again but that's another part I'm not concerned with yet]...like breathing on hot coals.
I've written some code that handles the RGB/brightness part of the equation but now I'm having a hard time with the breathing input.
What's the best way to capture that breathing "data"?
I've tried:
-
a piezo wired up like this:
http://leucos.lstilde.org/wp/2009/06/piezo-transducer-signal-conditioning/ -
an electret microphone (the panasonic wm-61a) wired up like this:
http://www.chris3000.com/archive/breath-sensor/ -
a temperature sensor (TMP36):
Temperature sensor tutorial - Using the TMP36 / LM35
This is the code I used just to see if I was getting any input.
#define LED 13
#define MIC 1
#define POT 2
int val = 0;
int thresh = 0;
void setup() {
pinMode(LED, OUTPUT);
pinMode(MIC, OUTPUT);
pinMode(POT, INPUT);
}
void loop() {
thresh = analogRead(POT);
val = analogRead(0);
if (val > thresh) {
digitalWrite(LED, HIGH);
digitalWrite(MIC, HIGH);
}
delay(10);
digitalWrite(LED, LOW);
digitalWrite(MIC, LOW);
}
With the piezo I got something if I tapped/thumped it, but nothing at all from breathing. Even loudly. I had originally tested a piezo because of this:
http://www.dtic.upf.edu/~jlozano/interfaces/blow_sensor.html
I didn't test it with the schematic he has posted, but when using a piezo with some signal conditioning, it didn't seem fit for purpose.
With the microphone I got nothing at all happening. I'm assuming this is because the microphone wasn't getting enough power to produce audio. I just had the mic capsule plugged directly into the breadboard and wired up with 5v only.
The temperature sensor seemed to work OK in that if I breathed on it, the values went up, but they didn't go down quickly enough, and I assume would sort of get 'stuck' after a certain point of breathing on it as my breath wouldn't get it any hotter.
I briefly looked at something like the Yamaha MIDI breath sensor:
http://www.dv247.com/computer-hardware/yamaha-bc3a-breath-controller-headset--2970
But I don't need (or want) to have my lips sealed around the sensor the whole time. But simply to breath/exhale on it.
So what's the best way to get breath data into the Arduino?
(Thank you for reading)