Hey everyone! I'm thinking about attempting to take on a project that involves a microphone and headphones. First of all, I'm looking at this microphone... Basically, I need to know that if it would be possible with code to read the frequency that the microphone detects. Also, what's the best way to connect headphones to an Arduino? On adafruit I've found a few different parts, I'm just not sure which ones I'd need...
PaulS:
The incorrect assumption in this statement is that the microphone will read one frequency. It will NOT.
No microphone will. That is not what a microphone does.
Ok so I'm assuming that the microphone emits pulses of electricity. Is there any way to find out the frequency of a sound or no? I'd basically be trying to do the same thing that this app does... Tell me how many hz a sound is... Is that possible or no? Thanks!
PaulS:
How are you going to get the data INTO the Arduino? You keep saying microphone. Wrong answer.
Not sure what you mean... In my initial post I put a link to a microphone, I'm just wondering if I could find out what the frequency of a sound is with this microphone, essentially do what a tuner does, I play a note on the piano, or guitar or something, and it tells me how many hz that sound is. Maybe this microphone can't do this? Maybe it can only tell me how loud a sound is? Here's the link to the microphone:
Ok so I've actually done some searching online and I think I've figured out how to read the frequencies, but I'm still wondering how to generate a tone and play it through headphones...
Use blink without delay to make a tone. Basically this:
// put this in loop
if (toneEnabled == 1){
currentMicros = micros();
elapsedMicros = currentMicros - previousMicros;
if (elapsedMicros >=halfPeriod){
previousMicros = previousMicros = halfPeriod;
// change output from high to low, or low to high
// example: D2 = PORT D bit 2
PIND = PIND | 0b00000100;
}
}
CrossRoads:
Use blink without delay to make a tone. Basically this:
// put this in loop
if (toneEnabled == 1){
currentMicros = micros();
elapsedMicros = currentMicros - previousMicros;
if (elapsedMicros >=halfPeriod){
previousMicros = previousMicros = halfPeriod;
// change output from high to low, or low to high
// example: D2 = PORT D bit 2
PIND = PIND | 0b00000100;
}
}
Ok cool! This is more of a wiring question (sorry!) but do I just hook headphones up to the Arduino as I would a speaker? Will they need any amplification or no? And will this work to hook them up to the board?
Speakers are low impedance - generally 8 ohm, sometimes 4 ohm. Impedance is similar to resistance.
Arduino output can't drive that low of an impedance directly, an output needs to see 125 to 150 ohm.
Similarly, a headphone is low impedance, perhaps 32 ohm.
Both would need a series resistance to avoid burning up the Arduino output.
Connecting to some form of amplifier would provide a louder output.
The connector gives you something to plug headphone into, but does not solve the low impedance problem.
CrossRoads:
Speakers are low impedance - generally 8 ohm, sometimes 4 ohm. Impedance is similar to resistance.
Arduino output can't drive that low of an impedance directly, an output needs to see 125 to 150 ohm.
Similarly, a headphone is low impedance, perhaps 32 ohm.
Both would need a series resistance to avoid burning up the Arduino output.
Connecting to some form of amplifier would provide a louder output.
The connector gives you something to plug headphone into, but does not solve the low impedance problem.
Would something like this work?
I believe that they're using a 10k ohm resistor... I'm assuming the black wire is ground? Maybe they just didn't color code their jumper wires...