Pages: 1 2 3 [4] 5   Go Down
Author Topic: Read a freqency from an analog pin  (Read 3252 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Values are fictive. I want to separe 2 frequences. (frequences from microphone)  smiley-eek

If you can't be bothered to answer our simple questions, then I can't be bothered to help you.

I have asked for simple, straight forward, information, which you have repeatedly failed to give us.

Unless you do so there is NOTHING we can do for you!
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

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

OK. So, i have a microphone connected to analog 0. When i speak, the microphone get a frequence.If this frequence is bigger than a "constant value", a led is on. If frequence is less than a " constant value" , another led is on. That is all.

"constant value"= a frequence, wich i write in the code.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Frequency and volume are two completely different things. Is frequency really what you want?

HOW IS THE DAMNED MICROPHONE CONNECTED?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26312
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So, i have a microphone connected to analog 0.
I asked quite a long time ago what amplification do you have between the microphone and the analog pin.
If the answer is "none", then we are all really just wasting our time, and I will lock the thread.

Start answering questions.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

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

I have transistor for amp.
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Rather than attempting a project that is way beyond your skill levels, try to break the project into doable pieces and do them one at a time, starting with the simpler ones (like turn on / off an led).

In your case, those would be something for you to think of:

1) write code to turn on / off an led;
2) write code to turn on / off an led depending on a value comparison
3) write code to measure frequency;
4) design hardware to process the microphone signal so it can be measured by your arduino.
5) put them all together.

You have to start somewhere and it is best that you start where you can draw upon your skills.
Logged

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

I know how to turn on/ off a led. I don't know how to use frequency reading.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I know how to turn on/ off a led.
Then you should know how to use Serial.print() to print some data. You should know how to write code properly. You should know how to post that code. You should know how to post the output from your application. You should have at least the vaguest clue about debugging.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Trying to infer what you want from your unintelligible ramblings, I think what you want is:

1. Attach a microphone to the Arduino.
You will require an amplifier to boost the signal to a level the Arduino can sense.  You should look in to op-amp microphone pre-amplifiers.  There are plenty of resources on the web for them.

2. Find the frequency of the signal.
There will be many many frequencies present in the signal, not just one.  You will need to sample a clip of audio from the microphone and do a Fast Fourier Transform on it.  This will give you a list of frequencies present in the signal and their amplitudes.

3. Light an LED depending on the frequency.
You can use the list of frequencies provided by the FFT to find the frequency that has the greatest amplitude.  This is the peak frequency, and can be used to make decisions, like is it above or below a threshold?  Is there no clear peak frequency?  Etc.

So, you have some reading to go and do:

1. Read up on attaching a microphone to an Arduino using a pre-amp circuit.
2. Read up on Fast Fourier Transforms, and find some Arduino code to do it (hint, look for fix_fft).
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26312
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

and
3) Have a clear sense of scale. Measuring a 1Hz signal with a microphone is unrealistic, as is measuring a 1MHz signal.

Quote
I have transistor for amp.
I will employ my psychic powers to endeavour to draw your schematic.
Or, you could save me the considerable mental effort and post it.
« Last Edit: November 15, 2012, 09:21:29 am by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Sr. Member
****
Karma: 3
Posts: 250
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here a nice link to give a understanding of sound and they have a nice link to a real good preamp
http://courses.oliviarobinson.com/wt/node/79

Never could figure wHy we need a crystal ball now I NO
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Never could figure wHy we need a crystal ball now I NO
Did you get one when you joined the forum? I'm still waiting on mind. The psychic keeps saying "any day now".
Logged

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

Now it works!  smiley
Thank you for answers! You are the best!  smiley
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

...

If he's learned all that so fast, he's either a genius (which somehow I doubt), or what he is trying to do is completely different to what he is saying he is trying to do.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Offline Offline
Sr. Member
****
Karma: 3
Posts: 250
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Na some one here used a magic wand with there crystal ball
Logged

Pages: 1 2 3 [4] 5   Go Up
Jump to: