CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Getting analog input from a microphone and FFT transform.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
oxo



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

PostPosted: Thu Sep 26, 2013 7:24 am     Reply with quote

Yep. I'm guessing some kind of ultrasonic receiver, although 18khz is a little low.
Ttelmah



Joined: 11 Mar 2010
Posts: 19541

View user's profile Send private message

PostPosted: Thu Sep 26, 2013 7:34 am     Reply with quote

Agreed.

Start at the beginning. The microphone is not likely to produce enough output to drive the ADC of the PIC directly, and at the very least needs level shifting. So you are going to need some form of signal processing in front of the PIC.
As OXO says, if this is simple tone detection, then make this a sine to square converter, and use te PIC CCP, to measure the time between edges.

However PLL's are not expensive. Every medium to fast PIC, produced for the last few years, has one inbuilt for it's master clock. The point about the PLL, is it directly decodes the frequency changes to a voltage, which directly reflects the frequency shift. 100* easier to work with. The cost of the PLL, is tiny compared to the cost of the amount of RAM needed for DSP decoding of the direct data stream, and is do-able, rather than probably being close to impossible. A standard TV these days probably contains a dozen PLL's. FM radio's all use them, etc. etc.. A basic PLL frequency decoder, is a few cents. An LM567 for example is about $0.1, in small quantities, and if you monitor the voltage on pin 1, instead of just looking at the square wave output, you have a direct indication of the frequency changes in your signal. Buy these in bulk, and they are about $0.01!....

Now assuming you need to actually do something with the decoded stream, this is now at a much lower frequency, so can be handled by a much more basic PIC. You have saved more than the cost of the PLL...

The DSP idea, is definately in 'sledgehammer/nut' territory, and has potential costs to go with this.

Best Wishes
ranii



Joined: 11 Sep 2013
Posts: 16

View user's profile Send private message

PostPosted: Fri Sep 27, 2013 9:41 am     Reply with quote

zero crossing is for children (no offend but thats true .)
When i said one signal at a time i mean 1 main signal , if there will be some noise-the zero crossing is worth nothing. an fft is a must at the mathematical aspect. or some kind of auto-corrolation function if you know them .

Its not ultrasonic but a part of a more sophisticated technology .

For the one who said dtmf is at low f's , thats true, but not everything has to be like what you already know. dtmf and fsk are more likely the same, and frequencies can be changed as you wish .

So ,Ttelmah you talked about pll, do you have one in mind for these f's that is not expensive ? because what i have seen is not cheap for mass .
(of course there will be pre amp-i wrote that in my first post )
ranii



Joined: 11 Sep 2013
Posts: 16

View user's profile Send private message

PostPosted: Fri Sep 27, 2013 9:44 am     Reply with quote

lm567 by the way, does not have 200hz resolution and can't be tuned a head for a few frequencies . (i must be tuned to f1 f2 f3 f4.. than looking for each to come) .
ranii



Joined: 11 Sep 2013
Posts: 16

View user's profile Send private message

PostPosted: Fri Sep 27, 2013 9:45 am     Reply with quote

the internal pll - i did not heard about that , so if its exist- why people still performing an fft, or at least trying to do that ?

and how the internal pll has the enough space for all the samples ? something is missing to me with that ..
oxo



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

PostPosted: Fri Sep 27, 2013 1:44 pm     Reply with quote

So make your own pll. 18 kHz is not very high, and you might learn something about electronics.
Ttelmah



Joined: 11 Mar 2010
Posts: 19541

View user's profile Send private message

PostPosted: Fri Sep 27, 2013 2:10 pm     Reply with quote

ranii wrote:
lm567 by the way, does not have 200hz resolution and can't be tuned a head for a few frequencies . (i must be tuned to f1 f2 f3 f4.. than looking for each to come) .


Not true. You are looking at the 'whole' LM567, which uses a comparator on the PLL filter output, to look for a particular frequency transition. I was suggesting using the PLL component of this (since it is dirt cheap), and then reading the voltage on the filter capacitor, and processing this. Hence my pin1 comment.
Doing this gives you a cheap PLL core, who's output you can feed to either your own comparators, or into an ADC.
I have actually built a trellis decoder, using this a couple of op-amps and a PIC.

Best Wishes
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Sep 27, 2013 3:57 pm     Reply with quote

ranii wrote:
lm567 by the way, does not have 200hz resolution and can't be tuned a head for a few frequencies . (i must be tuned to f1 f2 f3 f4.. than looking for each to come) .
You are still fuzzy about the requirements for your project. Apparently it is important for your system to respond rapidly to frequency changes. How quick a response do you need? This will have large impact in the possible solutions.

The number of units you plan to produce and the targeted price range also will have a large impact on the design. For a large quantity of products it pays of to spent a month longer in design if you can save a dollar or two.

So far, the most flexible solution seems to be a digital processor with FFT algorithm as you can make firmware upgrades even after release. Given the frequency of 18kHz I don't think a PIC18 could handle it. I would have a look at processors with DSP instructions, for example the 32-bit ARM-M4 core based processors.
Just for a rough price estimate to know the ball park we are playing in:
- The universal PIC18F46K22 costs about US$2.50 @ 1000 pcs.
- TM4C1230D5PM with ARM M4 core, 64k Flash and 24k RAM, max 80MHz, costs about $2.35 @ 1000 pcs.
- LPC4072 with ARM M4 core, 64k Flash and 24k RAM, max. 120MHz, costs about $4.00 @ 1000 pcs.

Other possible solutions, as discussed, are based around an analogue PLL circuit. Either build your own circuit or extend one of the many existing FSK/QPSK decoders.
Depending on the number of frequencies and desired flexibility this will fit your needs. Or not. We can't tell from your rudimentary specifications.

Solution direction number 3 would use one of those special chips that mix analogue and digital circuits. System-on-Chip (SoC)
Xilinx
Cypress- PSoC
I would bet my money here for a large volume product. At least worth a shot to ask your question on these forums.

Please remember: if the only tool you have is a hammer, then every problem looks like a nail.
Here on this forum many suggestions will go in the direction of using a Microchip product. Not because it is the best solution, but because we are most familiar with these products.
matheuslps



Joined: 29 Sep 2010
Posts: 73
Location: Brazil

View user's profile Send private message MSN Messenger

PostPosted: Tue Nov 19, 2013 11:19 am     Reply with quote

hum.....

In my routine of studies, I generally read a lot of forums to learn something new...

Normally I do not enter someone's topic and start my own question but since this is a recent topic and I do not know why and how I found this topic but the subject discussed here is interesting.

If I understand right, according to some members on the latest replies, I can use a PLL chip like the CD4046 (74HC4046) to measure frequency?

Example: Is it possible to insert a sound signal, after I shift it up to make it "monopole" (ranging around 2.5V for example), in the PLL chip and measure the frequency(ies)?

I was not searching about this subject but this can be so interesting that yesterday I take a couple of hours to study how a PLL chip works.

I always tried to learn a simple way to measure the frequencies from a sound file in real life but always ended on the FFT field. I said real life because I can use MatLab to do this, but this is not an embedded way to this. Always the same: DsPic.... float point arithmetic..... ect.... And even tried to follow the FFT example of CCS with a DsPIC33.....

For now, the best and simpler way that I found to accomplish this task is using a CI called MSGEQ7:

https://www.sparkfun.com/products/10468

Datasheet: https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf



So, more ideas about this?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group