3.5mm headphone jack input

Hello I was wondering how I can use a 3.5mm headphone jack as an input so that I can play sound from a device connected to it to a speaker I also have connected.

Can you be a little more specific?

Of course you'll need a Y-Splitter (or something) to connect the speaker & Arduino at the same time. It's also possible to build pass-through connections into your Arduino gizmo.

A line-level into a powered speaker or a headphone signal is OK as long as you bias the input or otherwise protect it from the negative half of the AC audio signal. The Arduino can be damaged by negative voltages greater than +5V. If it's an amplifier output to a 4 or 8-Ohm speaker, you could damage the Arduino (depending on amplifier power).

[u]This post[/u] has a schematic for the standard bias circuit.

If you are planning on using FFT/FHT to analyze the frequency information you'll need to bias the circuit to "capture" the negative half of the waveform.

Here are some [u]protection circuits[/u]I'd recommend changing the resistor about 10K. Plus, add a higher value "pull down" resistor (100K or more) between the Arduino analog input and ground to prevent the input from "floating up".

With a higher power amplifier you may also need a [u]voltage divider[/u] along with the protection circuit because if the protection 'kicks in", the protection will distort the signal and your readings. The resistors can sum-up to about 10K. The actual values would depend on the amplifier output. (You probably don't have high power through a 3.5mm jack.)