F to V Dsp: mimicking frequency to voltage converter

Mr dsp

New member
Joined
Sep 9, 2008
Messages
4
Hope this isn't too off topic. In electronics theres an IC called a Frequency to Voltage converter. You put a square wave in one end and it outputs a voltage proportional to the input frequency out the other. Note how this is different from an FFT.

I have a text file with data representing a square wave whos freq. varies. Is there a way to mimick the F/V IC with say a spreadsheet function? Or something I could program? Right now I'm clueless even to what this might be called. Any references-pointers appreciated.
 
Re: F to V Dsp

Hi Mr. DSP:

I have no experience with integrated circuits, but the conversion you speak of sounds like a function to me.

Can you give a few examples of your data, along with the corresponding values that you would expect a formula to produce?

~ Mark :)
 
Re: F to V Dsp

Hi,
My square wave values are integers from a 10-bit Analog to Digital converter, so that would be a 0 to 1023 decimal range. So the data would look something like:

1023
1023
1023
1024
0
0
0
0
1023
1023
1023
0
0
0

If you look at this sequence as if it were my text file full of integers from the AtoD, you'd see the 1023 value represent the "Hi" of the square wave, and the zeros representing the "Lo" state. You'd also note that in this small sample of two "Hi's" and two "Lo's" that the frequency is dropping. My text file is just a long series of these square waves represented as decimal numbers, with the frequency shifting up or down.
I was going to use a spreadsheet to run the data through a low pass filter to remove the square wave harmonics to yeild a pure (hopefully) sinewave, and then try to FFT those to get a frequency readout that somehow can be stretched out along the input data.
 
Re: F to V Dsp

Mr dsp said:
Hi,
My square wave values are integers from a 10-bit Analog to Digital converter, so that would be a 0 to 1023 decimal range. So the data would look something like:

1023
1023
1023
1024 ? Is this a typographical error?
0
0
0
0
1023
1023
1023
0
0
0

If you look at this sequence as if it were my text file full of integers from the AtoD ? Analog-to-Digital ?


... note that in this small sample ... that the frequency is dropping. ? Is this shown by the fact that the first "High" has 4 values and the second "High" has 3 values?

I was going to ... remove the square wave harmonics to yeild a pure sinewave ? Does this mean that you plan to strip out the zeros?

Hi DSP:

I'm willing to continue considering your situation, but you may prefer to allocate the time that you will need to invest teaching me about electronics toward seeking out an electronics bulletin board instead. It's your choice.

For example, I do not understand "a 10-bit Analog to Digital converter, so that would be a 0 to 1023 decimal range."

I need to understand the following.

What are the units on the value 1023? In other words, where does this number come from? What does it represent?

I'm guessing that these "readings" in your file are taken at equally-spaced intervals of time (like milliseconds), similar to the following.

0.01 ms, 1023
0.02 ms, 1023
0.03 ms, 1023
0.04 ms, 1023
0.05 ms, 0
0.06 ms, 0
0.07 ms, 0
0.08 ms, 0
0.09 ms, 1023
0.10 ms, 1023
0.11 ms, 1023
0.12 ms, 0
0.13 ms, 0
0.14 ms, 0
0.15 ms, 1023
0.16 ms, 1023
...

Is this correct?

Please show me what the output would look like for this first section of data after accomplishing your goal.

What are the units on the output values?

Also, it seems to me that, if you strip out the zeros before applying the conversion, you will loose those time "gaps". That information won't be reflected in your output. Is that correct?

~ Mark :)
 
Re: F to V Dsp

Hello,

----------__________--------________------______----____--__

Above is an oscilloscope view of a square wave, each character representing a sample taken at a certain rate (say 100 samples per second, 100 HZ). So the sample rate stays the same. The square wave is a voltage, the top of the waveform represents a voltage like 5V, and the lower portion represents ground 0V. The AtoD takes the analog voltage and samples it at our 100 HZ rate and yeilds a binary vale that if converted to decimal, has the top, 5V portions of the waveform given a value of 1023. And the lower portions a value of zero. In our case of the square wave, there are no intermediate values, as the input voltage swings from hi to lo.
If you look at the waveform above, you''ll note that the frequency is rising, as the waves get closer together. Its as if someone had a signal generator and was increasing the frequency of the square waves.
What I'd like is if you could imagine a graph with a trace starting at the bottom left of the graph and rising smoothly up towards the top right of the graph. So as the frequency of the square wave rises or falls, you'd get a line that rises or falls with it. Kind of hard to draw with characters.
Yeah, an electronics forum is another resource, but I want to take my square wave samples in their software form and convert them to a proportional trace. In electronics you would use a F to V converter IC for this kind of thing.
 
Hi,
Just wanted to note that anyone who knows what I've been talking about and faces the same problem should try data smoothing (in a spreadsheet of the data for example) of one kind or another (moving windows left or right for example). With a big enough moving window you get an effect where the square waves, if higher frequency and thus bunched up, produce a higher ampl. trace at that point in the data. Lower freq. square waves are more spaced out, and the smoothed data yeilds a lower ampl. trace at that point in the data. So the effect of the smoothing (with a big enough window) is not unlike an F/V converter effect. Still working on this but this may be a place for others to start. Good luck.
 
Top