I am working on a voice transmission project by using Spartan 3e. My code works just fine. My problem is that I give analogue input to adc side by using a potentiometer and see the changes (as digital) on leds ( digital output is assigned to leds). Here is the problem,I cut a headphone into two and connected 3.5mm jack side to my phone to play music. There are 3 cables which are golden, blue and red. Golden one is connected to "GND" pin , Red one goes to "Va" pin (at adc input). I didnt touch the blue one.
When I play music,I see no change on leds despite the fact that I did see by using potentiometer. What am I missing ? Do I have to setup an external circuit before giving the analog signal to Va input ?
Thanks in advance.
Best Answer
Two problems:
At a minimum you need to rectify your signal and ensure that the ADC input on your micro only sees positive signals between zero and the maximum rated input voltage. If you put a diode in circuit (banded end pointing towards the ADC) it might start to work but with the low voltages you will only get low numbers out of your ADC.
For a better job look up precision rectifier circuits. You'll want one that will give you some gain - 5 to 10 would probably do the trick.
[Edit]
I had a look at the data sheet and I understand that the ADC is biased at half V-max. You should connect up as shown here:
simulate this circuit – Schematic created using CircuitLab
Without the capacitor your audio signal will be +/- with respect to 0 V. Adding the capacitor and resistors will bias it towards 1.65 V, same as the internal reference.
In your software you'll have to run a loop that