PDA

View Full Version : Collecting data from a microphone



A.C. fishing
07-19-2006, 06:15 AM
I have a regular mic, and have never used one before. How should I collect data from it? I would like it to detect sound levels, something loud to something soft. I assume the mic bring up resistance when the noise is louder. Should I use an RCTIME circuit? Would a .1 faram capacitor work?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

Bean
07-19-2006, 06:32 AM
What type of microphone is it. "Regular" mic means nothing to me...
Does it have any writing on it ?
Could be: Piezo, condensor, moving coil, high-impedence, low-impedence, etc...
Bean.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com (http://www.hc4led.com)

Low power SD Data Logger www.sddatalogger.com (http://www.sddatalogger.com)

"Remember, you are unique, just like everyone else." Unknown.
·

A.C. fishing
07-19-2006, 06:56 AM
It has no writing, but I have a feeling it is piezo.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

A.C. fishing
07-20-2006, 11:25 PM
Bean- This is what I'm using
http://www.radioshack.com/product/index.jsp?productId=2103751&cp=2032058.2032230&cp=2032058&f=Taxonomy%2FRSK%2F2032230&categoryId=2032230&kwCatId=2032058&kw=microphone&parentPage=search

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

Bruce Bates
07-20-2006, 11:37 PM
A. C. Fishing -

If you're not familiar with it, you may want to look into using "TinyURL" for long links as you offered above. That service can be found here:
http://tinyurl.com/

Your long URL can be substituted with the following by using it:
http://tinyurl.com/q7jls

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->

Bean
07-21-2006, 01:21 AM
Okay now your talkin'...

That type of microphone will need a series resistor to a positive voltage.

Something like:


+5 ---\/\/\/--+--red wire black wire --- GND
2.2K |
|
audio out

Now the audio will be riding on a certain DC bias voltage, so you may want to run it thru a capacitor to remove the bias voltage.

Bean.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com (http://www.hc4led.com)

Low power SD Data Logger www.sddatalogger.com (http://www.sddatalogger.com)

"Remember, you are unique, just like everyone else." Unknown.


Post Edited (Bean (Hitt Consulting)) : 7/20/2006 5:25:07 PM GMT

A.C. fishing
07-21-2006, 03:56 AM
And then I just use an RCtime program?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

Bean
07-21-2006, 04:37 AM
What exactly are your trying to measure with the microphone ?

Bean.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com (http://www.hc4led.com)

Low power SD Data Logger www.sddatalogger.com (http://www.sddatalogger.com)

"Remember, you are unique, just like everyone else." Unknown.
·

A.C. fishing
07-22-2006, 01:05 AM
IT should be able to tell how loud something is.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

A.C. fishing
07-28-2006, 11:52 PM
Sorry, I'm not that good with schematics. What is GND?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

Bruce Bates
07-29-2006, 12:00 AM
A. C. Fishing -

GND is just an abbreviation for GROUND ("earth" in some quarters). AKA the negative terminal.

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->

A.C. fishing
07-30-2006, 06:59 AM
so what program should I use with this schematic? I tried various simple input programs, and I want to get an output that is more complex then the digital 1 or 0.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

A.C. fishing
08-01-2006, 05:56 AM
I have tried this RCtime program:


' {$STAMP BS2}
' {$PBASIC 2.5}
data1 VAR Word
sensorPin CON 1
counter VAR Word
FOR counter = 1 TO 10000
data1 = 0
HIGH sensorPin
PAUSE 2
RCTIME sensorPin,1,data1
iF data1 <> 0 THEN
DEBUG DEC data1,CR
ELSE
ENDIF
NEXT


I can't get any response from tapping or yelling into the mic. I'm using the schematic you suggested with a .01 faram capacitor on the RCtime program.· I would like exact·RCtime·numbers·showing, like 3445.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

A.C. fishing
08-09-2006, 09:31 AM
I also have a PC-board condenser Microphone Element from radioshack. I can get one's and zeros from this by tapping it, but not by yelling at it. I'm pretty sure my programs I'm using for these are wrong somehow. I have also tried some RCtime programs, which can give me some bianary output with the PC-board mic. I would like more specific out puts though

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

A.C. fishing
08-11-2006, 05:31 AM
I can't get the mic to pick up sounds and noise, only taps.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

Tricky Nekro
08-11-2006, 06:53 AM
Well if you want to use your mic you probably need a ADC...

which stands for analog to digital converter...

RCtime is a kind of ADC but quite limited in use...

You may need a serial one for easy use with BS2XX...

MAXIM semi offers a full variety of ADC... Go check for yourself...



Provas, Greece

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Rule your Destiny-
--Be Good. Be Bad. Be Provas--

A.C. fishing
08-11-2006, 07:04 AM
BS2XX? I don't think this module exists... Do you mean the BS2px? Also, what if I want my BS2 to be connected to the computer serially at the same time as the BS2? Then How could I use a serial module? And are you saying that they can't be used with a regular basic stamp?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

Tricky Nekro
08-11-2006, 07:42 AM
When I said BS2XX I mean the BS2 series including the BS2, BS2e, BS2px e.t.c.

ADC can inderface with almost any microcontrollers... Serially is only a way...

It can be serial asycronous, serial sycronous and parallel...

what convinience you the most is a serial asycronous interface cause you mess up with only one wire (or maybe two(flow control pin) and connecting all devices to the ground... Serial sycronous uses three wires and has·minimal crashdown factor contrasting to asycronous... Parallel is the less convinience as you may waste too many pins but is much faster than any other connection...

Better look for serial ADC... most of them are asycronous and you can get a very good 16bit resolution from some with less expense...

what ever else you need just post...

Provas, Greece

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Rule your Destiny-
--Be Good. Be Bad. Be Provas--

A.C. fishing
08-11-2006, 09:15 PM
An analog-to-digital converter (abbreviated ADC, A/D or A to D) is an electronic circuit that converts continuous signals to discrete digital numbers. The reverse operation is performed by a digital-to-analog converter (DAC).

Typically, an ADC is an electronic device that converts an input analog voltage to a digital number. The digital output may be using different coding schemes, such as binary and two's complement binary. However, some non-electronic or only partially electronic devices, such as shaft encoders, can also be considered as ADCs.

From Wikipedia. So doesn't a ADC take the analog voltage data I would like, and convert it to binary data, like 1's and 0's?
Do different modules come predefined, and say might convert all analog even numbers to 0, and odd numbers to 1? Or can you program it, or have the stamp send it a signal, which tells it what numbers are binary 1's, and which are 0's?
Please remember that I'm hopeless at terminology.
asycronous??
sycronous???
So I should hook up one of the serial ADC's to the BOE's SCB?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

A.C. fishing
08-11-2006, 09:28 PM
Doesn't the stamp already have one of those on each of its pins? Why else would it go to the trouble of making the raw data its getting into 1's and 0's?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

Tricky Nekro
08-12-2006, 12:18 AM
I don't know how to explan it to you but... You have the mic circuit that Bean gave you, right...

You say that if yell at it you get some reading... Now look...

You went to too deep water very very early... Yes ADC converts alanog signals to logic binary... This row of binary represents a number... In order to be able to get this row you must have a input on the ADC input pin... But you can't just connect the mic to the ADC cause you might get a very small number that won't exited some very very low limits.... You also need a circuit that amplifies your mic ANALOG readings... What's why preamplifiers are for... The get an analog signal and amplify it... The output of preamplifiers is also an analog signal but "stronger" that the first one... What I mean by this... Well imagine a·everyday·man... He can lift 5kilos... But after some exercise he can lift 100kilos... Now the exercise is the preamplifier... Without it the mic can give you some reading through the ADC but these numbers won't be great even if you yell at it... But with the amplifier by yelling you get a great number at the ADC reading as well as wispers(very·"low" noices)·can give reading... So you can make your BS2 hear more things, in other words you extend it's hearing range. But also preamplifiers enables you to adjust this ability... The output of the preablifier may be too high for the ADC to recognise so a range of noise isn't audiable by the stamp, it just gets peak signals... So with a variable resistor you can control it's sensitivity... So that yelling gives the greatest numbers and wispers give only some small ones...

With simple words you need to connect the mic first to a preamplifier then the preamplifier to the ADC and finally the ADC to the stamp...

If you connect the mic to the ADC without the amplifier you might neven get readings...

If you connect the mic to the stamp you get nothing...

And if you connect the mic with amplifier to the stamp you only get 1 or 0 but you can also burn the pin if the signal is too high...



What you want is able to be done but you need·much help (that's why I'm answearing)... You can do this... and I'll try to make a good circuit for you... Until then try to understand the basics and tell me what you did understand...



Provas, Greece

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Rule your Destiny-
--Be Good. Be Bad. Be Provas--

Tom Walker
08-12-2006, 03:05 AM
A.C.,
If I understand your question, then no, the Stamp does not have an ADC on each of its pins. Its pins will only respond to a "0" or a "1" as you put it. I agree with Provas that it sounds like you are trying to create a complex project without learning the underlying "simple" principles first. Have you gone thropugh the "What's a Microcontroller?" text (free download), yet? It provides good guidance and explanations of some of the functionality of the Stamp (including what it "sees" as a "0" or a "1"), as well as some good basic electronics theory and education.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...

Mike Green
08-12-2006, 04:40 AM
Another thing to remember: The output of the microphone (or the microphone and amplifier) doesn't give you an indication of loudness. You've seen pictures of audio waveforms I assume. If not, get a simple electronics text. The signal goes up and down around a central axis which is usually considered the ground. It's the peak values you're interested in for this application. Basically, what you want is the average absolute value of the signal. A capacitor in series with the microphone (or amplifier) will "ground justify" the signal so the effective zero value is the center of the waveform. A diode in series with that will give you the absolute value and another capacitor (connected between the output of the diode and ground) will "filter" or smooth (average) the signal. There are a few resistors thrown in to make timings and the matching of one part of the circuit to another work out. The result (with probably some simple amplifier for the microphone) will be a voltage that the Stamp can measure.

A.C. fishing
08-12-2006, 10:13 AM
All I was really expecting for this project was a simple schematic with a 220 resistor attached to a capacitor, and a mic, and the other side of the mic was attached to Ground. The capacitor would be attached to a stamp pin. I would run a few RCtime programs, trial and error, and find something that works. I didn't know I would need ADC's and parts I've never heard of. I've read Robotics with the Boe-bot, and scanned What's A Microcontroller. With Mike's schematic it appears I won't even need an
ADC.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·

A.C. fishing
08-12-2006, 10:16 AM
And... why doesn't Bean's simple schematic work? I've tried loads of programs and variations of it, but nothing really worked.
And uh-oh...
I said that I don't get any show of 1's when I yell.

-I can't get the mic to pick up sounds and noise, only taps.
-I can get one's and zeros from this by tapping it, but not by yelling at it

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



Somebody said...
-Never Underestimate the power of human stupidity.


·