Introduction: Arduino Due Guitar ADC Input and DAC Output Mixer

About: http://www.reverbnation.com/bizarre

This is the sequel to my other instructable which provides a circuit to input signals generated by a guitar into the arduino due ADC.

[Updated 26 Jan 2014 - the diagram has changed... see notes below.]

This instructable describes hardware that provides two functions.

1) Take raw guitar input and bias the signal up so that it can be recognised buy the due ADC (which only recognises voltages between 0V and 3.3V).

2) Take the output of the arduino due DAC and mix it with the original guitar signal.

The hardware forms the basis of my guitar effect project. I have a guitar instrumental called "8th July, 1947" which features an alien guitar effect that I'm trying to recreate outside of Logic pro.

http://www.reverbnation.com/bizarre

This instructable only describes the hardware. I will write another instructable on how to program the DAC and ADC for low latency audio processing.

Step 1: Design

I am not an electrical audio engineer with vast experience of audio amplifiers. However, I'm in this modern age and there's loads of help available via the interweb. I used this interweb thing and an android circuit simulation app called EveryCircuit. After several months of error, I ended up with the design above.

As I occasionally like to mindlessly shred my guitar, one of the design criteria was that the raw guitar signal should pass through the circuit with as little interference from phase shifting capacitors and noise generating resistors as possible. Moving the virtual pots in the simulation shows that this is the case with this circuit.

The circuit is built from four op amps. I used the opa2132p. That device contains two opamps in an 8 pin dil package. In the diagram above:

Green: is the guitar input signal.
Blue: is the DAC input signal from the due.
Red: is the mixed output.
Orange: is the signal to be fed into the ADC on the Due

Op amp 1 (bottom left): The purpose of this opamp is to buffer the guitar input. It is essentially just a voltage follower. The op amp is power pins are 5V and -5V. Its output is consumed by the mixing circuit (top right) and the ADC biasing circuit (bottom right).

Op amp 2 (bottom right): This one takes the buffered guitar input from op amp 1 and gives it a suitable bias to feed into the arduino due ADC. The bias is achieved by providing a fixed voltage on the + input (ignore the 1.9V on the diagram - in practise this is 1.65V which is precisely half way between 0V and 3.3V). The signal is supplied to the negative input via a 4.7uF decoupling capacitor and a 10Kohm pot which can be used to add some gain to the signal so that it fills the ADC 0-3.3V range. The output is also fed back via the pot to prevent the op amp from saturating. This amplifier is powered with 5V and 0V on its supply rails.

The output of this op amp is between 0 and 5V. So I've used a 22K, 22K +68K voltage divider to reduce it to 3.3V.

[Update: 26 Jan 2014: I've added a Low Pass Filter 16KHz consisting of a 1Kohm and 10nF. This is because I'm sampling the signal at 32768Hz. Nyquist says that frequencies above 32768/2 can masquerade as frequencies below that value. This filter cuts that aliasing back. BTW its also why audio programs run at 44KHz... when human hearing only goes to 20KHz.]

The switch and the 274Kohm resistor is a very crude simulation of the arduino due ADC input impedance. According to the data sheet the impedance of the ADC increases if you lower the ADC sampling rate. For audio processing speeds it will be bigger than 274Kohm. Turning the switch on doesn't show any worrying voltage drop.

Op amp 3 (DAC input): Is just another voltage follower. Power is 5V and 0V. The output signal is reduced by a 4.7K and 6.8K voltage divider to reduce the signal to guitar like levels. Its output is AC decoupled and fed into the mixer opamp (top right).

Op amp 4 (mixer): Is a voltage adder. Its inputs come from the ADC opamp and the DAC opa via to 10K pots. One side of each of those pots is grounded and they provide a way of mixing the raw guitar and the effected signal from the DAC. The wipers carry the signal to two 100Kohm resistors. These provide a virtual earth at the + input.

[Update 26 Jan 2014: I've lowered the 100K resistor in the adder to 33K. Give a bit more volume for the effect.]

The output is fed back via some 1K resistors which provide a gain of 2.

Power for this op amp needs to be 5V and -5V.

Like the other output opamp, I've put in a 1Mohm resistor via,a switch to model (badly) the input impedance of a guitar amp.

The final component is a low pass filter consisting of a 1K and 10nF capacitor. This smooths out the jagged step like voltages supplied by the DAC. Step like voltages like this feature harmonic components that are much higher frequency than the 16KHz roll off that this filter provides.

Step 2: Breadboarding

I found it best to build the above and get it working with some breadboard as there are quite a lot of connections to get wrong.

WARNING: be very careful with your arduino pins . Always check that they have the correct voltage ranges and current limiting resistors are present or you could loose a pin. I use a small oscilloscope for this. There a a whole bunch of cheap TTL level scopes available now. I have DSG nano with the BenF firmware.

I won't be responsible if you break your due.

My circuit connects to the DAC1 pin and the A0 pins on the due.

To generate the -5V supply please see my other instructable.

Step 3: Veroboarding

I drew a veroboard design on some squared paper (see image above). Once done, you can solder all of the parts on to a piece of veroboard.

The veroboard is the straight line stuff and I cut a line down the middle to make the connections similar to breadboard

With a few odd connectors, I managed to create some mounting plugs to attach the jack plugs, power supply and ADC and DAC input wires.

Step 4: Testing

Unfortunately, as I write this, I don't have a guitar to test. To get around this I cobbled together a small pot and connected it to a laptop playing Steel Panther. The scope image above is probably from their romantic love ballad "Stripper Girl". Despite the picture, which seems to have been bad luck, the output is within a few mV of 0V with a peak-peak voltage of about 1V.

Nevertheless, the output voltages seem about right and it hasn't destroyed a stereo that I'm using.

Goodbye for now.