# Best method to extract a particular frequency from a raw signal

Hello guys, i was wondering if you could help me find a method so that i can filter out a signal to obtain only one known frequency e.g 10 kHz. The signal is obtained from an antenna, i need to remove the excess components so that i can clearly compute the magnitude of the signal. I tried passing the signal through a bandpass filter, but there are still a lot of components present. Could you please guide me?

Edit:

i only need to know the magnitude of the frequency i am searching for, and i would be comparing that magnitude as it changes. Would FFT be the possible choice?

What is the actual frequency, or range of frequencies of interest? Do you intend to use only analog circuit components, or will a computer be involved?

Thank you for replying. I have 3 signals. which would be 33kHz, 8kHz and 50 Hz. 3 independent systems, none will be used simultaneously. I have to search for the signal within the raw signal.

What do you mean by the raw signal? What other frequency components are present. Whats the magnitude of the raw signal as a ratio of the signals you are trying to extract?

Its an amplified signal from an antenna, that is, there is a huge amount of noise, and other electromagnetic fields frequencies generated.

Is it possible to use DSP in this? like FFT or something? Can it be done on arduino?

One method could be to multiply with both sine and cosine components of the frequency in question. An AVR based arduino could probably do this up to about 10kHz or so for a single frequency.

nilton61:
One method could be to multiply with both sine and cosine components of the frequency in question.

I only have to detect the signal, which should be a sine wave or modified sine wave of frequency 33khz and keep comparing if the amplitude increases or decreases to a certain percentage. I though that designing an active bandpass filter would do the thing, but on an arduino based oscilloscope, there are still noise present even after going through the bandpass filter.

I’m not really interested in the signal itself. My concern would be whether the amplitude of that frequency increases or decreases. From the magnitude spectrum of the signal, would i be able to obtain and compare the amplitude of a 33kHz frequency on arduino?

i believe doing the FFT of the signal would give me the components present as well as their corresponding magnitudes in the signal. Would i be able to actually use only the frequency concerned and reject the other ones. And keep comparing the difference in those?

Is that feasible? Would i be able to do that on arduino?

I'm sorry, i believe the name of the topic should have been based on FFT rather.

I believe 30 kHz it too high for the Arduino's ADC.

All of these frequencies are low for picking-up with an antenna.

With an antenna, you'll probably need an amplifier, and it should be a highly-tuned narrow band amplifier.

50Hz is the power line frequency in Europe and very close to the 60Hz power line frequency in America. Power line radiation is going to dominate everything in that range picked-up by an antenna.

DVDdoug:
I believe 30 kHz it too high for the Arduino’s ADC.

What is the maximum frequency it would be able to capture? 10kHz? Would it work for 8kHz?

DVDdoug:
With an antenna, you’ll probably need an amplifier, and it should be a highly-tuned narrow band amplifier.

The signal from the antenna would indeed be passed through a filter and amplified before getting to the microcontroller. Is there any method of locating that frequency and getting its amplitude compared in real time?

The standard Arduino ADC can sample at about 9.6 kHz without special tricks. This limits the highest frequency that can be analyzed at about 4.8 kHz.

It is important to note that frequencies higher than about 4.8 kHz CANNOT BE PRESENT in the input, as they cause significant confusion for the analysis.

Therefore, a standard Arduino will not be useful for this project.

Whats the magnitude of the wanted signals relative to the unwanted? To have any hope of doing this you need to know what the dynamic range of all the incoming signals and noise is, and will most likley have to build separate amplifiers for each wanted frequency, with an extremely narrow bandpass filter tuned to each wanted frequency. You will have no hope of detecting 50hz if your local mains is 50 hz . Whats the source of the wanted signals?

mauried: Whats the magnitude of the wanted signals relative to the unwanted?

I don't really know that part, and think this would be changing all the time. But the signal itself would have been filtered through a bandpass filter. Therefore, this frequency should be the only frequency present along with other frequency components which should be very small.

mauried: To have any hope of doing this you need to know what the dynamic range of all the incoming signals and noise is, and will most likley have to build separate amplifiers for each wanted frequency, with an extremely narrow bandpass filter tuned to each wanted frequency.

This is actually my goal, i have 3 working frequencies, namely 50Hz, 8kHZ and 33.3kHz. There would be only one frequency working at a time from a selector. As you said, i designed their respective bandpass filter and would be using them to reject the other signal present.

I needed to compare the amplitude coming from the device as it moves. that is comparing the magnitude of a particular frequency, e.g 33.3kHz. The signal would be passed through a bandpass filter and most other frequency should have been rejected and then amplified. The amplitude of the signal would then need to be processed.

The method i innitially thought was calculating its RMS in real time and keep on comparing these values, however, my biggest concern was that i had 3 of these systems acting in parallel and would calculating RMS of 3 signals in real time be a problem for an ARDUINO MEGA??

Then i came to know about FFT, and now i am looking for a method to get a more accurate result if possible. And something that is more reliable and puts less burden on the microcontroller.

You need to know roughly what the voltages are of the wanted signals coming from the antenna. Are they microvolt, millivolt or volts, and the signal to noise ratios of the wanted signals to the unwanted ones. Without these numbers , you wont be able to design effective filters.

Yes an FFT is the way to do this, but as was said before the frequency range is not so high on a standard Arduino. On the Due however I should think this is just about possible.

However just like the bandpass filter an FFT has a band width as well and you will get a certain degree of noise as well. That is because noise contains all frequencies so if you filter out just say 33.3KHz there will be your wanted signal and also the 33.3KHz contents of the noise. These will add together to give you a changing signal at the required frequency.

The resolution or band width you can get out of an FFT is determined by the sample rate you can achieve, so the higher the sample rate the finer the bandwidth. Therefore for best results you need to sample much more than just twice the rate of your highest frequency.

There is a hardware technique for doing such things known as a "lock in amplifier", google for more information on that but it is complex and expensive to implement.

mauried: Are they microvolt, millivolt or volts, and the signal to noise ratios of the wanted signals to the unwanted ones.

I believe the input from the antenna itself is in millivolts. and i would confirm that the next time i run to the lab. i used filterpro to design the bandpass filters with a maximum gain of 1000V/V. the first one i tested was allowing too many other components, i redesigned it to a narrower bandwidth and will be testing that tomorrow at latest. I will probably then get a better idea of what needs to be done.

Grumpy_Mike:
Yes an FFT is the way to do this, but as was said before the frequency range is not so high on a standard Arduino. On the Due however I should think this is just about possible.

I was going to do that on a Arduino MEGA, if it is possible to use the same on a Due, i might try that. Do you have any relevant programming method for the FFT? I tried googling it, the FFT programming i got is not clear. I saw projects like Spectrum Analyser, which seemed to suit my purpose.

Grumpy_Mike:
However just like the bandpass filter an FFT has a band width as well and you will get a certain degree of noise as well. That is because noise contains all frequencies so if you filter out just say 33.3KHz there will be your wanted signal and also the 33.3KHz contents of the noise. These will add together to give you a changing signal at the required frequency.

I was going to compare it with itself, and i would be using the increase or decrease of the amplitude, to do a function. I believe the error from the should minus out on itself.

I just thought of a new approach, as i said i was only interested in the amplitude of the signal frequency and not the signal, if i can really locate the signal and amplify it by external circuitry, i could try and add an appropriate capacitor to make it constant, a rectified signal. then the high frequency would not be an issue. Now it seems that the system would depend mostly on how effective the bandpass filter is. Would that possibly work?

Sure. You could also use a phase locked loop like this: http://www.ti.com.cn/cn/lit/ds/symlink/lm567.pdf

The problem is at a phased locked loop is good frequency modulation not amplitude.

To the OP, the problem is that it you can't tell what variation in amplitude is from the signal and what from the noise. Yes you can use an FFT on a due, it will be an order of magnitude better than the Mega.