Pages: [1]   Go Down
Author Topic: breath sensor to control LED brightness  (Read 2331 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

1. a piezo wired up like this:

http://leucos.lstilde.org/wp/2009/06/piezo-transducer-signal-conditioning/

2. an electret microphone (the panasonic wm-61a) wired up like this:

http://www.chris3000.com/archive/breath-sensor/

3. a temperature sensor (TMP36):
http://www.ladyada.net/learn/sensors/tmp36.html

This is the code I used just to see if I was getting any input.

Code:
#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/%7Ejlozano/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)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 437
Posts: 23718
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Go with the condensor mic  - only wire it up correctly.

"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. "

I use them to record music, but wired up like this, feeding an amplifier, for output centered around ground. You'll probably want to have the output go across two 100K resisters (+5V-100k-100K-Gnd, connect mic & arduino to the middle junction) for steady 2.5V output that can go 0-5V.
(I should try that - heading off to a fencing tournament soon tho).
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 437
Posts: 23718
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This one.
http://www.radioshack.com/product/index.jsp?productId=2062216&numProdsPerPage=60#tabsetBasic
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12430
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I like the balloon at the end of the tube ...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The capsule you linked to appears to be a three conductor type. Mine is two conductors.

And with your setup, you have the capsule wired up to a 9v. So you're saying take the actual audio output from a working condensor setup, and run that into the 100k/100k setup you described?

Go with the condensor mic  - only wire it up correctly.

"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. "

I use them to record music, but wired up like this, feeding an amplifier, for output centered around ground. You'll probably want to have the output go across two 100K resisters (+5V-100k-100K-Gnd, connect mic & arduino to the middle junction) for steady 2.5V output that can go 0-5V.
(I should try that - heading off to a fencing tournament soon tho).

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also, would that mean that my input values will be between 500ish and 0/1000? So I would only have half of the resolution (though not terribly important in this setup).

That's if I'm understanding you right.
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have to amplify signal from the mic, at least 100x.
Look at sparkfun web site, they have electret mic breadboard with OPA on it.
Other option I could think, is temperature sensor that initially worm up by nearby resistor,
so when you blow on it, it getting colder. Depends on "initial" temperature (100 - 150 C degree)
it could be very sensitive.

Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 437
Posts: 23718
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh yeah, I forgot about the spark fun mic/amp. Go with that one.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you goal is to have the brightness depend on how hard you blow on the sensor, and you don't mind having to put your lips around a tube, to blow into it effectively, a good answer would be...

http://shop.moderndevice.com/products/pressure-sensor-mpxv

$25 for a device that you wire to 5v, GND and an analog input. To quote from site....

The currently stocked MPXV700xDP sensors are five volt sensors and the outputs float at 2.5 volts, with no pressure on the input. Suction will cause the sensor to output lower voltages, pressure will cause it to output higher voltages.
Logged

Maryland, USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi forum.

So what's the best way to get breath data into the Arduino?


Hey Guyton,
    I am facing the same problem and I am curious to find what was your "final" solution.
Can you post it, with a schematic for the breath-data-into-Arduino portion if possible (I am also a newbie.....)

Thanks!

Logged

There are three kind of people in the world: Those who can count, and those who can't

Pages: [1]   Go Up
Jump to: