# Linear Logrithmic voltage to Frequency

1. Nov 19, 2013

### MM2758

hi everyone

My first post here and I'm hoping someone might be able to help me. Unfortunately my Math skills are pretty bad having not had much of an education some 45 years ago. But hey i'm trying to change that …better late than never.

I'm trying to keep this short you can skip the next bit if you want

I have designed and electrical circuit (also learning) to help rectify the scaling drift on 1970's synthesizers.
These synthesizers were controlled on the principal of sending a voltage to them to control the pitch. The standard being 1 volt per octave. So each note up would be an increase of 0.083 volts. The system I have designed rectifies for when components and circuits were not so accurate and some synthesizers might be lets say 1.023 volts per octave. This is commonly referred to as the "scaling is out". Anyway I have a system that works fine. Basically it sends out an increasing voltage (using a Digital to Analog Converter DAC) and measures the audio frequency from the synthesizer till it finds a predetermined frequency (55 hz) it then stores the value from the DAC. It then keeps on increasing the voltage till it finds a DAC value for another predetermined frequency (1760 hz). and then stores its value. With these 2 values its a pretty simple linear calculation to rescale the voltages. and then using a system called MIDI have the circuit redefine a new voltage based on the new scale thus putting the synthesizer in tune.

I'm trying to improve and speed up the calibration time by instead of increasing the voltage , send out a voltage via the DAC lets say DAC = 18000 = 2.69v and then take a frequency reading which on the attached example chart is 143.35 hz
Then do the same again lets say DAC = 27000 = 4.06v and then take a frequency reading which on the attached example chart is 371.50 hz

What i want to be able to do is have a equation that will calculate for example what value on the DAC is required to get a frequency reading of lets say 100 hz , using only the two sample values i have collected DAC = 18000 = 143.35hz and DAC = 27000 = 371.50hz. I know the frequency is logarithmic compared to the DAC value. And I know that for this synthesizer each 1000 increase in the DAC equates to a frequency rise of about 11.172 % , but for the life of me I have no idea or direction on how to work out the DAC value for a specified frequency, and i'm hoping some one might spare the time to point me in the right direction.

If you got this far thanks for reading

I have attached the chart

thank you

ps sorry my english is pretty bad as well

#### Attached Files:

• ###### chart.jpg
File size:
52.3 KB
Views:
107
2. Nov 19, 2013

### Staff: Mentor

Welcome to the PF.

Check your PMs -- send me an e-mail with the source Excel file so I can take a quick look at it.

BTW, is the function from DAC code to voltage output pretty precise? Do you already have an equation for that part of the conversion?

3. Nov 20, 2013

### Staff: Mentor

I got the Excel file. The output voltage appears pretty linear with DAC code, and the frequency is exponential with DAC code. So taking the log(Freq) gives a pretty linear relationship with the DAC code.

I'll try to spend a little time this afternoon figuring out the equation that relates the DAC code to the frequency -- it should be a pretty simple equation.

4. Nov 21, 2013

### Staff: Mentor

So the DAC output is pretty linear with a zero offset (the top graph in the attachment), so the equation is simply:

$$V_{out} = \frac{6.65V}{44000} * CODE$$

Where CODE is the DAC Value.

And the log of the frequency output is linear with the DAC CODE (the bottom graph), with a non-zero frequency when the DAC CODE = 0. Since the plot is linear, it can be expressed in the format y = mx + b, where m is the slope of the line, and b is the "y-intercept" of the line.

So in terms of your variables:

$$log(Freq) = f(CODE) = m * CODE + b$$

$$log(Freq) = f(CODE) = \frac{P_{1y}-P_{2y}}{P_{1x}-P_{2x}} * CODE + b$$

Where P_1x = 44000, P_2x = 9000

And P_1y = log(Freq_P1), P_2y = log(Freq_P2)

I'll need to get back to you with the y-intercept formula, unless somebody else wants to post it, or you can figure it out. I need to get back to my regular work for a bit...

Hope this is helping.

#### Attached Files:

• ###### DAC to Freq Plots.pdf
File size:
338.5 KB
Views:
42
5. Nov 22, 2013

### MM2758

6. Nov 22, 2013

### Staff: Mentor

BTW, if you output zero volts from your DAC (DAC CODE = 0), does that give you the y-intercept frequency? That is, does the linear CODE-to-log(Freq) relationship hold all the way to 0V? That may be the easiest way for you to get the value of b for the equation.

If log(Freq) is not linear all the way down to 0V, then we still need to calculate b.

7. Nov 22, 2013

### MM2758

yes the relationship holds all the way to 0v as the circuit inside the synth is linear.

getting on well here got it working in the arduino just crunching the data and testing various scenarios .............thank you

8. Nov 22, 2013

Sweet!