Maker Pro
Maker Pro

Audio interface to microcontroller?

Texton

Jul 27, 2012
14
Joined
Jul 27, 2012
Messages
14
HI All.

I am building a audio interface for my microcontroller, PSoC5. Problem is audio is transmitted through mini jacks in the range -2V to +2V and my PSoC5's ADC can only measure 0-5V.

So I have to raise the -2 to +2V to my ADC range, but how? further more I assume that some kind of AC coupling is nessesary?

Next I need to output the audio to a mini jack again - same problem but the other way around using the microcontrollers DAC?

I come up with some suggestions, but I dont know if it's right, so pls help :)

Here is my suggestion:
https://dl.dropbox.com/u/1737568/20120830_182558.jpg

And here is the problem described in picture:
https://dl.dropbox.com/u/1737568/20120830_183146.jpg
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,615
Joined
Nov 17, 2011
Messages
12,615
Suggestion 1 will not work. The PSoC will still see +-2V.
A serious solution would use an amplifier (e.g. OpAmp) to decouple the input from the PSoC. But a simple alternative could do the job as well:
attachment.php

Input (green) is -2V ... +2 V
output (blue) is 0.4V ... 4.4 V. By reducing R1 to 3.2kOhm you can adjust it to 0V... +4V
 

Attachments

  • bla.gif
    bla.gif
    15.6 KB · Views: 662

Texton

Jul 27, 2012
14
Joined
Jul 27, 2012
Messages
14
Ok, that seems like a good solution. Actually my intentions was to put a internal OPAMP (in the PSoC) to buffer the Vdd/2 reference. Would that make my suggestion work?. Or how would you use the OPAMP?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,615
Joined
Nov 17, 2011
Messages
12,615
You can use the OpAmp with my circuit. Set it to a unity gain buffer.

I simulate with LTSPICE.
 

Texton

Jul 27, 2012
14
Joined
Jul 27, 2012
Messages
14
Okay ill try that. What about the output?.. My ADC range is 0 to 4V, so could I just make a 2V reference and then put it direct on to the mini jack with the reference as ground?..
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
You had the right idea initially. Use a series capacitor from the input jack to the ADC, and a resistor from the ADC input to a 2.5V reference voltage to centre the ADC input at half scale.

For the output, all you need is a series capacitor between the DAC output and the jack connector. You can also add a resistor from the jack connector to ground, so the output is forced to straddle 0V. Depending on what load you're using, this may not be necessary, but at least it will prevent the thump you would hear when you plug in the output device.

The only mistakes on your first diagram are that the ground terminals of the jacks should be connected to 0V not to 2.5V. It is standard for the earth sides of input and output connectors to be connected to the 0V rail of the circuit.

. . . . . . C
v----------| |--------------->ADC
==--- . . . . . |
. . . | . . . . . ---/\/\/---< +2.5V
. . 0V . . . . . . . R

. . . . . . . . . . C
DAC >-----------| |----------------------v
. . . . . . . . . . . . . . | . . . . . . ---=
. . . . . . . . . . . . . . .---\/\/\/---|
. . . . . . . . . . . . . . . . . R. . .|
. . . . . . . . . . . . . . . . . . . . 0V

With a 4V p-p signal you will only see 4/5ths of the ADC input range used. You can use an op-amp with a gain of 5/4 to fix this but you'll need a higher supply voltage or an op-amp with a rail-to-rail output. The normal way to handle this would be to reduce the input range of the ADC.

Please excuse the ASCII art :-/
 
Top