This is my first design, a 4-Bit stereo DAC with LM386 amplifier. I'm using it to interface with my FPGA eval board which doesn't have any audio connector. My board uses a 2x6 'PMOD' connector. My purpose is to create a stereo synthesizer which outputs square, triangle, sawtooth, and arbitrary 4-bit samples. Since each PMOD has 8 data pins, this works out great for 2 channels.
*All parts are ones I currently own.
*FPGA outputs are 3.3V logic.
Pins 1 and 2 on the connector are VCC pins on the PMOD connector and are left floating as they are unused. Pins 3 and 4 are ground pins on the PMOD connector. Pins 5,7,9,11 are LSB to MSB data pins for right channel. Pins 6,8,10,12 are LSB to MSB data pins for left channel.
I'm using an R-2R DAC for simplicity and availability of components. Since my resistors are 1% tolerance and this is just a 4-bit DAC, small inaccuracies shouldn't cause much trouble.
68 Ohm resistor before LM386 because the maximum recommended input voltage is 400mV. When all bits are high, the output voltage is ~3.10V. Output impedance of R-2R DAC is equal to R. Using a voltage divider, 3.10(68/510+68) = ~360mV. It will run at a constant output with external speakers controlling the volume.
Using standard gain of 20, therefore pins 1,7,8 are floating.
Both amplifiers working with single 9V battery as power source.
47nF capacitor and 10 ohm resistor as snubber circuit to prevent high frequency oscillations.
220uF capacitor to remove any DC component from output.