Let's Make Robots!

I need a basic swtich driven by an audio signal

So I have to drive a coil with about 9 to 12 volts. I have a trigger signal which is basically a sine wave coming out of a cell phone's headphone jack, which I believe should be around 1/2 a volt.


The question is can't I just drive this with a Transistor used as a swtich with a diod attached to the latch pin to cut out the reverse voltage from 1/2 the sine wave to get pulsed DC at high Voltage?

If so, anyone know some transistors I can use? Obviously they need to be rated for the voltage/amperage I'd be working at.


Second. How badly is the pulsed DC going to kill me with the coil due to impedance/back EMF?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Yet another possibility.

—and ignore the missing R1. I had a light activated relay I'd already drawn up, so I just changed the drawing to be sound activated putting in a capacitor instead of the resistor. :-)

Sorry for not replying for a while I've been busy with work travel lately.

I like this one since it's got parts I know I can get. I was having a little trouble finding one of the transistors you mentioned in the original ones.


One thing I don't understand however. I see a lot of designs like this where there is one pin called ac input. Yet I have two wires coming from my AC source. I could attach it to ground but I fear that there would be only C1 and R3 in the circuit between V+ and ground and I'd blow up my phone.


Do these circuits w/ only 1 pin for input get designed because you commonly have the output coming form some other more complex circuits which would only have one pin of output?

One thing I failed to mention is to be sure any relay you use takes a small enough current to activcate it that the 2N2222 will carry that much current. (Depending on the maker of the transistor, this can be from 600 milliamps up to a full amp.) Most small relays used with circuit boards nowadays take a fairly low current (a few milliamps) to operate. Example: I picked up a couple of reed relays I had laying here at my desk and read 160Ω on one and 300Ω on the other. In a 5 volt circuit, these would pass [5/160] or 31.25 mA for the first and [5/300] or  16.67 mA for the other.  How much current yours will take will depend on the resistance.reactance of the coil but most small crcuit board relays are reasonable.

Ok, now as to possible damage to the phone:  Capacitors pass alternating signals whether a.c., audio, radio or whatever. They do not pass direct current (like dc from a battery). Even if one wire from your phone output is hooked to a common ground, the other side of the circuit from the phone is connected through the capacitor (C1). The dc power must have a completed circuit (or loop from one wire to the other) before it can flow.

Tutorial: Capacitors have two wires coming out. These two wires do not connect to each other inside the capacitor. They are each connected to a piece of metal (these are typically foil, but because capacitors back in the early days were made from actual metal plates, they are still referred to as the "plates" of a capacitor) but those "plates" are separated by a non-conducting layer, (which can be air, glass, mylar, other plastics, etc.) so they can be very close but never touch. Because they do not actually touch, there is no direct connection, so dc (battery) current cannot pass through. Alternating current (whether audio, radio or what) can pass because the build up of charge on one plate (foil) induces a charge on the other plate (the other piece of foil) after a slight delay (about 90° out of phase). As the one side fluctuates up and down, the charge on the other side follows it, so the signal essentially seems to go through the capacitor. It does not actually go through, but for a fluctuating signal, the effect is the same.


If you like:  When I was learning electronics, I pictured the charge in circuits as little guys walking down paths (the wires). Walking into a capacitor was like they came to a drop off that they couldn't pass with cliff faces across from each other. They could spread out to the right of left along their cliff face, but then all they could do was yell across to guys lined up on the other side, "Go back, you can't come this way. Go on. Go that way." After a slight delay, the guys on the other side would get the message and start filing out the path leading away on the other side (the other wire out of the capacitor), building up a difference in charge on the two sides. The closer the two cliff faces to each other, the more they could affect the guys on the other side. If the polarity changed, then the second set of guys got turned around and marched back to their cliff face and yelled at the first guys to turn around and go back.

(and, yes I had a similar view for coils, with the little guys walking along a spiral walkway. If the coils were far apart they could only yell at the other guys on the next spiral to speed them on their way, or throw things at them as they got closer and even reach out and hit them when they got very close, so the closer the coils to each other the more effect from one to the next.)

Ok, so here is what I have now. I have added the cap. I have also added a trim pot as a current limiting resistor between the positive output of the rectifier circuit and the transistor for safety though from Telefox's comments about the voltage drop of the diodes it sounds like having a current limiting resistor is redundant?


I have also seen some of these designs with a resistor, almost always 1k, between the DC output of the bridge rectifier. What I don't know is: Is this there to represent the load or in addition to the load? Do I need one in this schematic?




I am going to go select some sample components from my parts bins and start playing with this right now.

Let's see if I can do this without letting the smoke out of anything.

As a general rule you should always have a current limiting resistor connecting the signal to the base of a transistor. Better to have that extra layer of protection even if you may not need it.

The resistor across the bridge rectifier outputs is probably just there to show where the load is connected, don't worry about adding it in.

Continuing from Salvage's suggestion, Q3 in your diagram is an NPN transistor, but it is on the "high side" of the coil (closer to V+). When acting as a switch it's usually best to put an NPN on the "low side" of the load (closer to GND), either that or switch to a PNP and put it on the high side. Probably just moving the coil between the NPN's collector and +9V would be best.

The suppression diode Salvage mentioned is usually connected in "reverse parallel" with the coil, which means that the diode is connected to the circuit at the same points as the coil, but the diode is pointing in the reverse direction. Another common name for this sort of diode is a flyback diode - the Wiki page explains the concept quite well.
As for what sort of diode to use, I'd just recommend a common 1N4001, 1N4007, or something else from that family.

I'm familiar with using a flyback diode but for some reason my brain was broken and I wasn't able to envision where it went. I use them with motors.Thanks for the Schooling.


Why does it matter what side of the coil the transistor is on?

Looks good?

I think I'm going to have to buy some diodes. I went through mine yesterday and I have no Zeners at all, nor do I have the 4ks you mention. I have a whole pile of Zener diodes which is ironic because I didn't have any the last time I was digging around for diodes. ^_^


Thanks for the education all of you.

"Why does it matter what side of the coil the transistor is on?"

The collector-emitter current (which feeds the coil) is related to the base-emitter current, and the base-emitter current is related to the voltage across the base resistor, VR1.
When the voltage stored by C2 is greater than the voltage at the base of Q3, current will flow into the base, turning Q3 on. Q3's base voltage is always going to be a few hundred mV above Q's emitter voltage - if the emitter voltage goes up, so does the base voltage.

If Q3's emitter is connected to GND, it will be fixed at 0V, and therefore the base voltage will be only slightly above 0V, making it fairly easy to turn Q3 on.
In the earlier circuit, the emitter voltage will rise and fall depending on the voltage drop across the coil, L3. The higher the voltage drop across L3, the higher Q3's base voltage gets, and the harder it is to turn Q3 on. This makes the circuit behaviour a lot more complicated =)

BTW in the diagram you've attached above, Q3 is upside-down. The emitter (pin with arrow pointing out) should connect to GND.

That looks good, but I bet you will need some amplification of the microphone input signal. That could be done by adding another resistor-transistor amp to it.

Since you said the relay would pull over an amp, I altered the drawing a bit from the original version. A 2N3906 is a common transistor ($2 US per 100 quantity @ Polida) and the 2SA968/2SC2238 are priced at $1.40 US for 2 of them. The 180Ω resistor might have to be a bit smaller if there is not enough drive current for the power transistor. but it will depend on the actual current draw of the relay coil.

There are a lot of small relays that would not drain nearly that much current.

Another note: The op-amp (the big triangle labeled 741) can be any general purpose op-amp.  On top of that, it could be a transistor amp also.  It you want, I could throw something else together, circuitwise, if you let me know just what you have already to work with.

Oh and the question about the back-EMF: I doubt it will kill you, but it can kill the electronic parts.

Good luck.


Ok, I made another adjustment to the circuit, here is another way that should work properly.

Ok, I think most of this is starting to sink in. This has been very educational.

First which way are the caps connected? You're using the non-biased capacitor symbol and that's too much for my wee little brain. ^_^

What is prevenint the +12v from destroying my phone? That .1mf cap? For that matter is the 10k ohm resistor between points C and A dropping the current to the point where it isn't triggering the first 2n2222? Then when we get current from the audio signal it's enough to turn it on?


To change the circuit to 9v(which is the coil rating on the relay I have) I know that I will need to recalculate resistance values but what do I do with the capacitors? How do you calculate what caps you need?


I managed to find a datasheet for a 2SC2238 but it says it's an NPN. You used what I thought was the PNP symbol in the diagrams or is there something else I'm missing?


Yes, the .1 µF capacitor is preventing the 12 volts from feeding into the phone.

The capacitor values are fine as is, if you change the voltage to 9 volts.

As far as the capacitors, you came up with the answer yourself. Some places in a circuit, generally at low voltages and small cap values, the direction of the capacitor doesn't matter. The places where it matters are usually high voltage and/or high cap values. where the stored charge is great enough that it will start to discharge to the air, so they often use a polarized cap to minimize this. That was the idea, anyway.

As to the 2N2222, (Questions like these may be answered by checking the data sheet for the part in question.) So if you take a look at the spec sheet/(data sheet) you will see that drop out occurs down around 10 nanoamps of collector current or 20 nanoamps of base current. A nanoamp is .000000001 amps. Twenty nA would then be 0.00000002 amps. The 10 KΩ resistor will allow up to .0012 amps (12 volts/10000ohms), which is WAY above the minimum needed to make the 2N2222 work. (60,000 times enough).