I am trying to connect a stereo plug to Arduino that will light up an LED when sound(s) is coming in. I am not sure if I need to amplify the signal considering it is coming from computer speakers... Can I connect the stereo cable to an Arduino input?
Any help will be appreciated!
You probably want an audio transformer to isolate to circuit from the speakers. Connect that to an amplifier. You can then connect that to either the A/D on the arduino or use a comparator to connect to the Arduino.
Transformer -> Amp->Comparator -> Arduino
For the amp look at the LM324 amplifier. They are pretty simple to use and there is a lot of tutorials online.
I know at least one device that uses a simple DC blocking capacitor (0.1uF) plus a pot (5k, I think) to attenuate, and tied the resulting audio directly to a digital input pin (of a Motorola 68HC, not an ATmega). Look at X1 pin 5, C3, and R9 here.
I suspect you can get by without comparators and amps, especially since you're using a headphone/speaker out instead of a line out.
I recently tried to connect an audio line directly.
(I wanted to use the arduino as a led synthesizer.)
The analogue in couldnt really read much change in voltages directly.
I have yet to try it, but my next plan is to use a simple op amp and maybe a few band filters/attenuators.
If all you want to do is detect sound on, then a simple attenuator like kg4wsv suggested might work.
Thing is, there seems to be a current flowing through the line out permanently, so just measuring if there is any voltage won't do.
It's the frequency(or change in frequency) that I think you should be trying to isolate and detect.
Take what I say with a pinch of salt though (I don't know much), only I tried something similar