I'd really love some feedback from you guys with this one.
In a system I am designing for a car, I have an amplifier that needs to receive input from an iPod and from a car radio/head unit (alternately, not simultaneously). If there's music playing from the iPod, this will trip a relay and switch the source from car radio to iPod.
So basically, I think I'll have a relay (or two actually, left and right channel) with the car radio on the NC circuit, and the iPod on the NO circuit. To switch the relay, I was thinking that the positive on the iPod RCA output can connect to the base of a transistor, and this transistor which will energise the relay when anything comes down the line from the iPod...and wollah, inputs automatically switched.
The first problem I can see is that, the transistor/relay won't be constantly being energised by the iPod...for instance, between songs or in silent parts of the song. So then I thought, instead of energising the relay directly off the iPod, I'll use the transistor to siwtch an input of the Arduino and perhaps if there's input for more than 1 second, I'll 'latch' the relay...and wait for 5 seconds of no silence before switching back?
These are my initial thoughts. Care to share some thoughts of your own?
theres an even easier way. use a rectifier to change the AC audio signal to a pulsing DC signal. pass that signal into a capacitor, then connect the capacitor with a resistor to the transistor. the capacitor will hold a charge for a few seconds while the signal dips low, and after a few seconds it will drain and the relay will shut off again. another option would be to just directly connect a large capacitor in parallel with the relay.
@weirdo557: Thanks for the response. I'll have to look into your ideas there. I'm not an 'electronics guru' by any stretch of the imagination. It sounds easy and logical though!
@MikMo: You raise a valid point there. I had thought about that and was going to wait and see what happens when I try it and cross that bridge when I come to it.
The other part of the project is a carputer, so I have another option, which is to run the RCA from the iPod into the Line In of the sound card in the carputer and from there into the amp. I was hoping for it to be able to work though without needing the carputer running!
One popular method to switch between two low level analog signals is to use an inexpensive CD4066 CMOS Quad Bilateral Switch IC. One chip could handle two seperate stereo inputs, or you can use several chips to switch as many inputs as you require.
Here is the data sheet, and some searching around you should be able to find a complete circuit diagram using them just like you want. They have been popular for decades for this kind of application and work well.
Just doing a little more research into the CD4066 IC. This thing is amazing, for me at least! Thanks for the hot tip.
I am having a little bit of trouble understanding the data sheet though, so I'm hoping you can clarify a couple of things. This is the sheet I am looking at: http://www.farnell.com/datasheets/67081.pdf
From my research I understand that if I run the IC at a higher voltage, I'll have less resistance through the switch, which will mean higher quality output (probably indeterminable by the naked ear!). At any rate, I'll try and run it straight off 12-14V.
What voltage do I need to switch Control A, B, C and D? Looking at the "Control Inputs" section of the DC Electrical Characteristics table, I'm not sure what the difference between a low level input and high level input is (although it seems somewhat obvious).
If I'm right in assuming that a LOW level input, is referring to something with a low power output, like an iPod? And so therefore this input can be switched with voltage as low as ~3V? Or, is this low/high stuff referring to a minimum/maximum for the switch in general...meaning I can use anything from ~3V to ~7V?
Can I switch these directly with an output pin from the Arduino? Or do I need other magical circuitry inline?
Does "VSS = 0V unless otherwise specified" mean that VSS is just connected to GND?
Hope asking all of these questions hasn't been frustrating or annoying for you. I'm adding them to my next purchase order from Farnell anyway, so I'll get to test it out the hard way at any rate...would still love your input just in case I need to order other stuff before I bother.
Well it is a rather unique chip in that it truely combines analog and digital functions. However wiring it up and figuring out the requirements for VCC, Vss and on/off control voltages can be a little hard to get one's head around.
If you are going to pass a pure AC voltage through the switch then the VCC needs to be say +6 and Vss -6v as the input signal has both a positive and negitive swings, and a negitive voltage could not pass through the switch if it's Vss was ground. However if you first pass the signal through a series capacitor then you can use a single polarity Vcc and Vss can be ground. It's best to breadboard a circuit to make sure it operates as you wish or copy usages from published circuits.
This chip is used in many unique applications such as sample and hold circuits, switching different resistors around an op-amp to provide a digitally controlled gain amplifier and many other unique tasks.
So you really have to define (voltage wise) what your input signal to be switched is before determining supply and control voltages for the switch.
As far as lower resistance at higher voltage equalling higher quality, that is not really the case. These switches do not really pass a lot of current, and are designed to drive (wire to) high impedenace inputs like say a audio preamplifier input which may have an input impedeance of 20,000 ohms. The fact that the switch adds 100 ohms to the signal path is not going to be a factor at all.
It's best decription is that it is 4 element bilateral switch. Bilateral meaning: From the linked document.
Bilateral switch = There are two meanings:
– Signals can be passed in either direction (A to B, or B to A) through the switch. This is a real unique property for an active component.
– Switch can be used in analog or digital applications.
Examples are CD4066B, CD74HCT4066, CD74HC4066, SN74HC4066, SN74LV4066A, and
SN74LVC1G66 switches.
The following TI document goes into much better detail on what it can do and how it works:
Wow. That's pretty much blowing me away. I have little experience with electronics so it's wrecking my brain just trying to get it all into my head, let alone understanding it.
Using my multimeter, I'm getting ~3.5mVAC per channel from my iPod.
Is it possible for me to use something simpler? I found this Fairchild IC, the NC7SZ66. It looks like a really basic switch...may or may not be applicable but looks easy as: http://www.farnell.com/datasheets/66854.pdf
Could I just run four of them instead?
Sorry for not being about to keep up to speed with what you were talking about!
Using my multimeter, I'm getting ~3.5mVAC per channel from my iPod.
That sounds like too low of a reading for a signal that is designed to drive ear plugs, are you sure your meter can accuratly measure AC voltages at that frequency? I would expect a volt of so, but I don't own a MP3 player to tell you what is normal. You really need to be playing a pure sine wave at a frequency you know your meter can read well, like 60hz. Normal music is such a mixture of amplitudes and frequencies that only a oscilliscope can really show you the peak to peak voltage value of a audio signal. Maybe you can download a mp3 to it of a low frequency tone and then measure the ipod outout with your meter.
Is it possible for me to use something simpler? I found this Fairchild IC, the NC7SZ66. It looks like a really basic switch...may or may not be applicable but looks easy as: http://www.farnell.com/datasheets/66854.pdf
Could I just run four of them instead?
From the data sheet it looks like the same requirements are required for directly hooking an AC signal through it, either + and - power rails or capacitance coupled. The data sheet shows the signal input going from VCC to Vss and the spec says input can not go below -.5v of Vss. So same kind of power/bias requirements as 4066 I think.
The simplest way to digitally switch audio signals or other incompatable voltage/current is with a small relay. There are very small 5vdc coil that use less then 20ma and have SPDT or even DPDT contacts.
I bought about 10 of the following little jewels to play with a year or so ago. It's a bipolar latching relay. The coil takes 5vdc and draws under 20ma or so. You switch it between the two positions by the polarity of the volage to the coil. So if you drive the coil with two Arduino digital output pins, a low and a high would set the relay and a high and low would reset the relay. If you made both output high or low the relay would stay in it's last position and consume ZERO power!. It has double pole double throw contacts rated max 250VAC and two amps, although I would most likely never switch such a high voltage with such a small relay as the pin spacing is not what one really should use at that kind of voltage. Anyway here is a link to these relays. I had used it in one project as a automatic power off switch where the program could pulse the relay off and remove all power to the board under software command. A simple push switch was used to power back up and the program would latch the power back to the board, simple and consumed zero power except when actually switching. It's my favortie relay for microcontroller projects. Cool huh?
Yep, that's pretty sweet. Originally I thought of using a relay, but was warned about noise that might be added to the signal. I can't imagine it picking up too much noise in a relatively bare PCB, with such a small magnet and low voltage passing it. Do you think that it's something I need to concern about?
Edit: I just tested the iPod again with my multimeter. The peak max was almost 850mV, so there's the 1V you were thinking about. It's only an iPod shuffle so I can't imagine it being crazy powerful.
Farnell isn't the cheapest but I'll have them tomorrow without a doubt if I place my order before 6PM. They still work out cheaper than your little gem's off eBay (freight factor).
Not too concerned about it being latching. Don't mind the idea of it defaulting to the iPod by default unless it's told otherwise. I think after all this, I'll go with your idea of a little relay and be done with it. If it sucks, I'll just go back to old school until I figure out the other kerfuffle.
Well if it was my project I would first try using relays, much less to go wrong. You then only have to figure out how you want to control the relays, manually with a switch or some kind of automatic mode. There are circuits called sound operated relays. They generally use microphone inputs but can have audio directly wired to their inputs via a high value resistor divider. They generally are designed to have a fast on mode with a slow (delayed) release (sometimes adjustable) so that it doesn't switch off during short pauses or even gaps between songs. The circuit then drives your relay coil on or off.
It is usually better with these kinds of projects to build and test in stages. First build the stereo switching relays and just use an on/off switch to control the relays. That will prove out that all the signal levels are compatable, no ground loop hum, and find out if there are any switching contact spikes that are noticable or not. Stage 2 can be where you come up with some kind of automatic audio switching control that senses when the Ipod is outputing music and switches the relays on.