Question:
Analog to digital conversion question?
XanX
2010-01-04 03:32:25 UTC
Im working on a project and need to get analog frequency values into a microcontroller. The MC has an ADC on it, but if I understand correctly I need to first convert the frequencies of the signal so that my max frequency, say 8kHz is converted to a 5V output, and lowest frequency is 0V, with everything linearly scaled between, am I understanding that right? . Ive never done an analog to digital conversion. Would a frequency to voltage IC be the way to go? Anyone done something similar? Frequencys Im working with are between 100Hz and 8kHz. Any advice would be appreciated.
Three answers:
billrussell42
2010-01-04 04:25:39 UTC
I gather that you want to measure the frequency that is between 8 kHz and 100 Hz.



Note that zero frequency or ones close t zero are impossible to measure without taking a lot of time. So pick a lower limit, say 100 Hz.



A frequency to voltage conversion then voltage to digital is one method.



Another is to directly measure the frequency. If you convert the signal (via a comparator) to a fixed amplitude square wave, and then to a fixed width pulse train, you can use a counter to count the number of pulses in a fixed interval, say, 1 second. You may be able to do this with the microcontroller itself. What type is it?



.
Ecko
2010-01-04 04:32:25 UTC
The ADC provides an output number proportional to voltage. It can in principal measure AC signals by taking regular samples. The AC signals can be organised into a time series defining the signal in the memory, then analysed by a fourier transform to extract the frequency spectrum of that signal. This method is more universal as it allows several frequencies to be present at once. There are certain limitations, such as sampling rate must exceed the highest frequency, a minimum of twice the highest frequency (more in practice) and that may be more than your microprocessor or ADC can handle. A Digital Signal Processor (DSP) is a specialised microprocessor that can work for faster sampling. There needs to be an anti-aliasing filter to eliminate any signals above the highest frequency of interest before sampling. The sound card on your PC works this way when recording from a microphone etc..



The method you suggest may be used in some cases - converting the frequency to a voltage then sampling the voltage with the ADC. This allows measurement of frequencies outside the sampling range for example. It takes the load off the microprocessor. The downside is that the waveform (shape) of the signal is lost, so not recorded, and only one frequency can be present at any instant. It can record the envelope (that is the frequency variations), and is therefore related to an FM demodulator. Applications that comes to mind include a tachometer, measuring speed of rotation, wind speed using a propeller, and frequency demodulation..
emactan
2010-01-04 04:11:45 UTC
Firstly what's the peak to peak voltage of your signal? If your ADC is running at 5VDC then it has to be within that range. Is your signal already riding on DC? If not then you'll have to shift the signal up since your MCU's ADC is working on a single supply. The signal's negative peak should be >= zero VDC.



You say your maximum input signal frequency is 8kHz. Because of the error known as "aliasing" you'll have to sample the signal at > 2*8khz (every 62.5microseconds or less).



If possible incorporate a second order low pass filter (using an op amp) between your signal source and the ADC


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...