Hi, After a long time having the perfect DAC for arduino and analog synths taking to much time for my brain I decided to test my toughs on breadboard and calculations.
There are a lot of cheap dual 8,10,12 bit DACs out there they are kind of low end but there is a trick that has been missed in a lot of builds I have seen. As an example take the easy obtainable DAC MCP4802/4812/4822 family.
In my case the MCP4812.
It is dual channel, internal voltage reference, 10-bit, SPI, Rail to Rail, and have a DAC Latch pin to change both DAC’s at the same time.
Well here is the nice part. Two DAC’s in parallel gives the double amount of bits if combined. Aka in my case 20bit for less than 2€. I will not include the OP AMP as that should be used as an buffer anyway.
Combining the DAC outputs to a inverting summing OP AMP and get the right gain on the second Inverting OP AMP will give me the range over 0-8 (almost 9) Volt at a resolution of 1/4 cent of pitch ! If my calculations is correct
Look at this and give me feedback if I’m into something or did something wrong in my calculations. The Iron is hot and the code is on the arduino nano.
One Cent is: 1 Octave / 12 notes / 100 cents
Gives in 1V/Octave one cent is 1/1200 of 1V = 0.0008333333V (8.333333e-4)
To ease math and only use unsigned int we could use 960 steps that would give us
120 steps / Octave and 10 steps for each note. We are actually reducing the resolution on DAC A to match 1 volt / octave and 12 notes in a octave (8*12 in 10 cent steps).
That is done by trim the total output gain to 8.00V ( Gain x 2.0833) at value 960 on DAC A. This will get the following tables:
//Octave-Volt = 0, 1, 2, 3, 4, 5, 6, 7, 8
octaveTable = { 0, 120, 240, 360, 480, 600, 720, 840, 960 };
// Note = A, A#, B, C, C#, D, D#, E, F, F#, G, G#
noteTable = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110 };
The reference voltage internaly on the MCP4812 DAC is 2.048V
Internal gain at 2x that gives 4.096V/1024 = 4 mV
0.0V to 1023/1024 * 2.048V when gain setting = 1x.(2mV)
0.0V to 1023/1024 * 4.096V when gain setting = 2x.(4mV)
With an additional gain of 2,0833x (960 x 4V / 1000) we will jumped to
2.083 x 4.096V / 1024 = 8,33 mV per step and that’s the magic number for 10 cent.
By reducing each note by 1 step we will always be around max 10 cents of.
This gives that the fine adjust on DAC B must be in the range of at least 20 cents.
20 cent is 1/1200 x 20 = 0,01666V
Using 1x gain on DAC B gives range 2.046/1024 = 1mV. Reducing to 1/200 in to sum OP AMP will give:
2.0833 x 0.0005mV per step at output and 0.0010416666V/step = 1/4 cent of tune.
A range of 2.0833 x 0.0005mV x 1023 = 0-1,066 Volt.
We do not like low voltages as they tend to get a lot of noise from other circuits.
The above calculations gives us the resolution needed and a range over one octave. If we offset the course DAC A into half octaves we will need to gain back that half in the fine DAC B and raising the voltage to around 1 V out from DAC and 0.5V to sum OP AMP in the above tables.
Later we could use a voltage divider to feed back the 0-8V to the NANO ADC and check the 0-4 volt range at 10 bit for easy calibrations.
Where am I wrong ?
// Agge