Speaker or line-out jack...

Hello everyone.
I have a bit of a stupid question here, but I can't figure out the answer myself.
I want my circuit to have both a speaker and a line out jack, but like in most devices I want the speaker to not work while there's something plugged to the jack.
How can I do that?
This project has nothing to with Arduino, if that helps.

It's pretty easy if you have an audio jack like this one, basically there are switches on the contacts in addition to the normal signal. Once you know when something is plugged in to the Line In there are a quite a few different ways to stop the signal from going to the headphones. It can be done using hardware, or if you have some sort of microcontroller/computer involved software as well.

The attached link takes you to an image which shows a mono version of such a device. You will see an open contact with the jack inserted. http://upload.wikimedia.org/wikipedia/commons/a/af/Jack-plug--socket-switch.jpg

LM4863 IC switching off speaker, when headphones plugged in. http://octopart.com/partsearch#search/requestData&q=lm4863

S "switch Jack", as has been pointed out already. The Idea about the IC is no good... that device only mutes the speakers when headphones are plugged in, albeit without a switch jack... it was apparent that he didn't understand your Post. Use the switch jack to switch off the audio to the power amp when the line output is in use. If you place the jack before the Vol control then your line out won't be affected by the volume setting which is normal for a line out. In fact that's why it's called "Line Out".

Doc

Thanks for all of the replies!
What I have is a standard mono "mini-jack", which has no contacts. I was wondering if I could make something up just with that. I have a basic knowledge of electronics and can't find a good solution.
Thinking it out, I understand that if there's no external device connected, the signal will just skip that part of the circuit and go to the speaker, however I'm not that sure it will happen the other way when connecting something to the mini jack port.

Quick one word answer NO. you have 4 wires that need to go to the jack... not counting the ground. Line out, the unswitched output and the connection to the volume controls that you are switching with the jack. You could of course use a DPDT mini toggle switch. That would take care of the audio switching necessary... But it won't happen when you insert the plug... You could use the mono jack to activate a relay... but that meqans that if you loose the plug (Shorting plug to "switch on the relay...) But If you lost it... No Switch. Here is an inexpensive one from a place I spend money at (Lots of Money, they have Lots of inexpensive Goodies)
20PCs 3F07 Dual Channel Audio Socket 3.5mm – ElectroDragon... The Part is PCB mounted only But it is $0.21... Most all of what they sell is in that class.

Doc

To OP: what you need is "continuity sensor". IC I've linked above, is good example how to do such things, not "working manual" like on instructables. Continuity testing usually works by passing a small amount of current throw a load, if nothing connected than no current and voltage goes up. If load connected, voltage drops to zero, or close. Details depends on voltage level, resistance of load, would define if you need filtering out AC using caps, or if you need logic "timer", schmidt trigger , comparator etc. How you gonna switch speaker off, using relay or just "mute" sound?BTW, arduino could greatly simplify design, sending "mute" command via IR remote control, if thee is any

Docedison:
Quick one word answer NO. you have 4 wires that need to go to the jack... not counting the ground. Line out, the unswitched output and the connection to the volume controls that you are switching with the jack. You could of course use a DPDT mini toggle switch. That would take care of the audio switching necessary... But it won't happen when you insert the plug... You could use the mono jack to activate a relay... but that meqans that if you loose the plug (Shorting plug to "switch on the relay...) But If you lost it... No Switch. Here is an inexpensive one from a place I spend money at (Lots of Money, they have Lots of inexpensive Goodies)
20PCs 3F07 Dual Channel Audio Socket 3.5mm – ElectroDragon... The Part is PCB mounted only But it is $0.21... Most all of what they sell is in that class.

Doc

Well there are just 2 wires. I need no volume control, as that would be in the output.
What I have is something looking like this:

On the main view, isn't there an easier solution than adding IC's or relays?...
To Magician, I am not using Arduino on this project. Otherwise it'd be much easier, of course.

I stand corrected and I apologize for misleading you, I ASSUMED you meant stereo audio. A single circuit switch jack will do what you want to do for a monaural source. The suggestions about sensing when something is plugged in won't work as the sense signal... becomes part of the audio signal too. This idea has no merit...
From Magician: "Continuity testing usually works by passing a small amount of current throw 'through' a load"...
The "Load" is the Audio Amplifier input, not a place where you would want anything but Audio.
Re-read the post from me that begins "Quick one word answer NO. You have 4 2 wires that need to go to the jack...
The connection methods would be the same however, just two wires less. Trying to use the speaker audio presents another issue as what "Switches" off the speakers when the Line In plug is inserted?.

Doc

Docedison:
I stand corrected and I apologize for misleading you, I ASSUMED you meant stereo audio. A single circuit switch jack will do what you want to do for a monaural source. The suggestions about sensing when something is plugged in won't work as the sense signal... becomes part of the audio signal too. This idea has no merit...
From Magician: "Continuity testing usually works by passing a small amount of current throw 'through' a load"...
The "Load" is the Audio Amplifier input, not a place where you would want anything but Audio.
Re-read the post from me that begins "Quick one word answer NO. You have 4 2 wires that need to go to the jack...
The connection methods would be the same however, just two wires less. Trying to use the speaker audio presents another issue as what "Switches" off the speakers when the Line In plug is inserted?.

Doc

Thank you for your answer! I was a bit confused too.
So by what I understand I need a circuit switch jack like the one you linked before but for mono audio? Problem is I have already used a jack input I had here, which just has the 3 pins (power, signal, ground).
I of course thinked of the normal switch, but that's exactly what I want to avoid...
My problem is precisely the question you ask. The speaker should be switched off, or at least make the current avoid it.

Actually a power type jack like the arduino uses for it's external power input will perform what you are asking for. If you look closely at such a jack you will notice it has one center pin solder connection and two 'ground' solder connection. One of those ground connections wire to the devices ground circuit, the other would wire to the speakers ground connection. When a plug is inserted the hot center and a ground is avalible for the external line-out device you want to have the audio signal. At the same time inserting the plug caused the speaker ground contact to open up and removed from the internal circuit ground, thus the speaker gets no signal.

That makes sense?

Lefty

Lefty.. there is a small issue there... what happens if some genius plugs a real AC adapter into the connector... some times it is best to start with the right hardware to begin. That was why I kept hammering the switched 'low level' audio. someone suggested putting some current through the jack so it could be "sensed", the major issue with that is in "Sensing" when the speaker was plugged in... the sense current would need to be an appreciable part of the main audio signal. I am of the opinion that it is usually bad work to try to save a few pennies or Worse... Time by these types of "Methods". In the time we have spent trying to solve the issue he could have the right installed and on to the next job.

Doc

Docedison:
Lefty.. there is a small issue there... what happens if some genius plugs a real AC adapter into the connector... some times it is best to start with the right hardware to begin. That was why I kept hammering the switched 'low level' audio. someone suggested putting some current through the jack so it could be "sensed", the major issue with that is in "Sensing" when the speaker was plugged in... the sense current would need to be an appreciable part of the main audio signal. I am of the opinion that it is usually bad work to try to save a few pennies or Worse... Time by these types of "Methods". In the time we have spent trying to solve the issue he could have the right installed and on to the next job.

Doc

Certainly something to take into consideration. I was more trying explain that some circuit jacks contain switch contacts in addition to the signal they route into or out of the jack. Such switch contacts can be very useful as in the case of a headphone jack that not only routes sound to the headsets, but just by the act of plugging in can be made to disconnect an otherwise active speaker that wires to totally different speaker connections on the same device. Switched jacks can be quite complex, but can solve many otherwise tricky problems.

Lefty

Yeah, I caught that the first time through. However it doesn't fit with his original goals, to provide a line output function that could be switched by plugging something into a newly made lone out jack.

Doc