A micro capturing sound will not easily deliver a pure sinus since you will get a mixture of different frequencies. Amplifying the signal up to limitation will give an approximation but will jitter due to the other frequencies.
I suggets you to spend some thoughts into signal-conditioning (Input with a C,level shifting with R,Amplifying with 1 or more PGAs, band pass filtering etc). The usual method with a timer / counter (depending on the frequency to analyze) will give the first result. Since this will be distorted by noise the next step could (should) be some calculations (averaging) to math-out jitter and / or noise.
Some questions -
1) What is the range of frequencies coming from phone ?
2) How long is the frequency transmited to PSOC ?
3) Frequency you want to measure -
a Accuracy ?
b Range ?
c Resolution ?
4) What causes the phone to have only 10 mV to the PSOC ? Eg, what
comprises the signal path ? Is the phone speaker the generator, a seperate
mic on PSOC the transducer for the frequency ?
5) Tolerable latency of the measurment ?
6) Overall function of the design ? General terms.
The range of frequencies would be from 500hz to 2kHz. The reason the phone only generates 10mV is because that is the signal coming from a 3.5mm cord jack.
I would have to amplify this voltage with a PGA/buffer in order to get an appropriate signal?
What would be an appropriate gain?
Do you know the operating range for the PSoC analog voltage inputs?
Do you know how I would modify the AN2283 program for measuring frequency in order to measure a generated sin wave from my phone?
I tried modifying the program for measuring frequency and put in a PGA and still was not getting a read at all the result was "underrange" because the f=0 meaning it was not working. Would I have to use an ADC? From what I know I can just use the comparator to measure analog frequencies correct?
Thanks so much for your help!
Several possibilities –
1) PGA followed by comparator. Experiment with G of PGA, but I would start around
10, then feed that to comparator. Comparator out goes to counter or timer to do the measurement.
2) If you have a lot of noise use a BP filter in front of PGA. Since BW is large might want to use 4 pole solution.
3) Use the module and device datasheet to get at CM in range for analog signals.
4) To measure freq supply a counter enable with a timer gate. If you want 1 Hz resolution, then gate = 1 sec, 10 Hz gate = 100 mS……Then supply counter input with Fx. Note they are down counters, so when gate is low, counter not enabled, load max value into counter (8 bit counter max = 255, 16 bit = 65535) then when gate goes high it will count down from there. When gate goes low read counter, subtract from max value, and that is the number of Hz (1 sec gate) Fx is.
5) Basic counter ap notes attached.
Here is a very basic freq cntr, 24 bit, 1 Hz gate = 1 Hz resolution, you can alter
as needed. Note no signal conditioning done, assumed logic levels from
Many notes in main.c file as to how it operates. Also you can eliminate the
test counter I sued to test the F cntr.
BasicFreqCntr.Archive14.zip 1.1 MB
If you need a filter something like below, you would have to optimize to get equal
response at Hi and Low BW limits. -