Electronic – How to give analog input from 3.5 mm jack to FPGA (Spartan 3e)


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:

  1. The ADC is (I presume) 0 to 5 V. Your audio will be much less than this.
  2. The ADC accepts positive signals only. Your audio is AC (alternating current). The polarity alternates between + and - with an average value of zero.

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.


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

  • Takes a reading.
  • Subtracts to bias value (half ADC max).
  • Get the absolute value of the result (remove the - sign, if present).
  • Average these over some number of cycles since sometimes you'll sample on a peak and sometimes when the audio signal is crossing zero volts.
Related Topic