Detect a line audio signal with a PIC ADC

Thread Starter

LewisMF

Joined Nov 15, 2014
100
Hi All,

I wasn't really sure in which section to post this thread, so I just decided to post it in the general electronics chat :)

I'm currently designing a very simple audio multiplexor where I have two inputs and one output - or viceversa.
The idea is that one of the audio inputs will have priority over the other one, so that when there is an audio signal on the priority input, this signal is passed to the output.

This is my little setup:
Sin título.png

The other side of R1 is going to a digital output on my PIC, I tested this and it works fine.

Now, the second part is configuring an ADC of the PIC to be able to measure a signal on the audio input 1. The problem is that the audio source output level that will be used on this input is around 775mV, and being audio I assume it might also have some negative voltage.

So the big question is: What would be the best way to measure this? Pass it through an OP amp and amplify it to a range between 0-5V for the ADC to meeasure it?

Please note that this signal doesn't need to be processed or quantified in any way, all I need to detect is that there is an audio signal on the input to switch it to the output.

All answers are very much apreciated! :)
 

Thread Starter

LewisMF

Joined Nov 15, 2014
100
You may find this app note could help. It has active rectifiers and adding gain as well as the rectifier function maybe a way for you to go.
http://ww1.microchip.com/downloads/en/AppNotes/01353A.pdf
But as you are not really after precision, a simple amp followed by a diode rectifier will be an easier way for you I think.
Hi Dendad,

Thank you for your reply.

With a simple amp followed by a diode rectifier, what do you mean? Could yu provide a quick and simple circuit?

Thanks in advanced for your help, it's very much appreciated.

Kind regards!
 

BobTPH

Joined Jun 5, 2013
3,104
10K resistor from ADC input to ground. 10K resistor from ADC input to +5V. 100nF capacitor from audio in to ADC input.

Now, with no signal, you will read a steady 2.5V or about 512 counts. With audio input of 0.5V it will range + or - 100 counts from the initial 512. This should be enough to detect it.

Bob
 

Thread Starter

LewisMF

Joined Nov 15, 2014
100
10K resistor from ADC input to ground. 10K resistor from ADC input to +5V. 100nF capacitor from audio in to ADC input.

Now, with no signal, you will read a steady 2.5V or about 512 counts. With audio input of 0.5V it will range + or - 100 counts from the initial 512. This should be enough to detect it.

Bob
Hi Bob, thanks for your reply.

Would this be the setup you explained? :
Sin título2.png

Best regards!!:)
 

BobTPH

Joined Jun 5, 2013
3,104
Yep. I simulated this and with a 0.5V audio signal, the ADC should see voltages of a little less to 3V to a little more than 2V.

Of course, the signal is changing rapidly, so you need to sample frequently (say 100 times) over a period of say 1/10 of a second and take the peak reading. If the peaks are within, say 10 counts of 512, there is no signal, if not, there is a signal.

Bob
 

Thread Starter

LewisMF

Joined Nov 15, 2014
100
Yep. I simulated this and with a 0.5V audio signal, the ADC should see voltages of a little less to 3V to a little more than 2V.

Of course, the signal is changing rapidly, so you need to sample frequently (say 100 times) over a period of say 1/10 of a second and take the peak reading. If the peaks are within, say 10 counts of 512, there is no signal, if not, there is a signal.

Bob
Thanks Bob!!

What frecuency did you simulate the audio signal with?

I'm using Labcenter electronics simulator and I'm going to simulate the audio signal with a function generator.
 
Top