I need a circuit that fires a relay when it detects audio pulses from one channel of an mp3 player. I'm going to record audio pulses in sync with the music to control a motor for mouth movement.

Its been 20 years since I've done this kind of stuff, so I need some help with this design.
This is what I'm thinking so far:

audio controlled relay circuit http://www.excellerate.com/images/acr.jpg

The idea is to convert the AC audio to a DC level with D1 , use C1 to smooth it out. Set R1 so the transistor is just below switching on.

Does this look like it will work? If so, what would be a reasonable value for C1? Does it have to be electrolytic, or can it be ceramic?

Clarification - I'm mostly interested in knowing: - will my design work? - suggestions for improvement?

  • \$\begingroup\$ So for your stereo player, you'll just mix music/whatever onto (arbitrarily) the left channel and have the right just be a series of loud sine pulses? \$\endgroup\$
    – Nick T
    Commented Oct 2, 2010 at 4:14
  • \$\begingroup\$ Yes exactly right. \$\endgroup\$
    – PeteShack
    Commented Oct 2, 2010 at 13:44
  • \$\begingroup\$ Hey Pete - could you give us an idea about the kind and size of motor or actuator you intend to use? also could you comment a little on the mechanics - maybe just mention how you'd like the resulting thing to move? - I just thought it might help people answer your question fully. \$\endgroup\$
    – Jim
    Commented Oct 2, 2010 at 15:14
  • 1
    \$\begingroup\$ You probably have to find the value of C1 experimentally. It probably depends on the output impedance of your MP3 player. Look at that point on a scope if you can. \$\endgroup\$
    – endolith
    Commented Oct 2, 2010 at 15:38
  • \$\begingroup\$ The problem you will run into is that there will be input signal levels that will put the 3904 into linear operation. To control a relay you want the transistor to drop either all the supply voltage or (very nearly) none of it. Intermediate states will just waste power cooking your transistor and won't necessarily pull the relay in. \$\endgroup\$
    – JustJeff
    Commented Oct 5, 2010 at 1:43

4 Answers 4


Okay, I have some feedback, and mine is mostly directed at your circuit.

First, I see two discrete stages.

Stage 1: Averaging

Your first stage is the capacitor/diode circuit. This is your averaging circuit. This is missing a very important component, a resistor. right now, if you ignore the loading from the rest of the circuit, this will effectively be a peak detector. as the input is connected with a current independent .7V drop to the capacitor. With addition of a series resistor with the diode you will find that you can make this system have a time constant to get an averaged value out of your system. You will need to tweak this value to give you a resistance in the range of what you are wanting.

Stage 2: Gain

Your second stage is the amplifier circuit, or driving circuit. This is made up of a basic biasing resistor and the BJT. This gives the bias you need to then superimpose a small signal(welcome back to school, it is small signal model all over again). The issue I see is that you have your capacitor directly tied into the BJT gate. This BJT looks like a diode when you look into the base. A diode to ground. This means that it will really pull current when you try to pass .7 V but that your capacitor has almost no load below this voltage. This means that your input in the current circuit drives it directly in your current circuit. This is bad.

If you place a resistance between the averaging circuit and the driving circuit you can control how much the voltage change on the capacitor affects the driving current. This will give a more controlled load on the RC averaging circuit, and allow it to just impose a small increase in current through the base so that your averaging circuit helps drive without over-driving the input and allowing the averaged signal to slowly affect your system. Make sure the isolation is large enough compared to your averaging resistance to not affect load your averaging circuit to the point it is just showing the peak.


I will draw this new schematic up if it will help.

Choosing Resitance

Editing this in because it seems I did not give good feedback on how to pick values.

Averaging Resistance

First, Vin from the audio minus .7 volts(diode drop) divided by R needs to be less than the maximum current your audio device can supply. This is worst case where the capacitor is charged to 0V.

Averaging Capacitance

Now, your averaging resistance times your capacitance needs to equal 1 over the frequency you want to have as a maximum. This means, if you want it to "update" 20 times a second you need RC to equal 1/20.

Isolation Resistance

This is a more complex choice. If you would like 5 V to be your full drive from audio, and this relates to needing 10mA from the BJT then you need to pick an isolation resistance that will give you 100uA(hfe=100) when you have 5V-.7V/Isolation.

This gets messy if you end up loading your circuit too much and then will need a preamp stage that reduces the load that your averaging circuit sees.

Extra Information

Second, if you find you are discharging the capacitor too quickly, use a darlington pair as your transistor instead. Easy to take care of by just hooking up two of those transistors together.

Third, if you are having problems where your averaged current is staying a bit too low and you come back and post it here I can draw a schematic of how to level shift your input.

Let me know if there is anything I was not clear on.

  • \$\begingroup\$ be cautious, if you spec to be at max current for your device, try to not stay there long. \$\endgroup\$
    – Kortuk
    Commented Oct 4, 2010 at 16:39
  • \$\begingroup\$ why not just use a FET for the transistor? ditch all the biasing effort, not to mention reducing loading and current draw. You can adjust for the needed 'on' voltage for the FET with the level and duty cycle of your input. If you find the forward voltage drop for the averaging diode is too high look at using a schottky, it'll have a very low forward drop and i doubt reverse leakage will be an issue in this application. \$\endgroup\$
    – Mark
    Commented Oct 5, 2010 at 0:53
  • \$\begingroup\$ He brought a schematic using a standard diode and a BJT. I did not see any significant gain to switching things like diodes. Normally when someone shows me a schematic with a BJT they are more comfortable with a BJT. You have to bias a FET properly also, but you are correct that it takes almost no gate current, removing a large part of the load problem. This does mean you then need a discharge path for your cap, but then you do have control over it. \$\endgroup\$
    – Kortuk
    Commented Oct 5, 2010 at 15:04
  • \$\begingroup\$ I Think there are a million ways to do this, I just tried to make minor edits to the original with the direction of functionality. \$\endgroup\$
    – Kortuk
    Commented Oct 5, 2010 at 15:04

If I understand you correctly, you are essentially using an audio output to create a digital signal. You have a pulse of some constant voltage for about 250ms and then 0 voltage for the rest of the time.

With the placement of C1 and R1, the rate at which the voltage can go high is a function of the size of R1 and the rate at which the voltage can go low is a function of the size of C1.

Both of these are completely dependent on how you are wanting your circuit to act. If you are wanting the mouth motor to be activated for longer then the pulse then you will want a larger capacitor (uF or larger range). If you are wanting the mouth motor to only be activated for the exact length of your pulse, you will want a smaller capacitor (nF) or maybe not even one at all.

As for type of capacitor. I believe you will always have a positive voltage across your capacitor so the type of capacitor used is not a big factor. If you need a larger capacitor you will find that an electrolytic will be cheaper while other sizes you might want to look at ceramic for some of their performance benefits.

  • \$\begingroup\$ Kortuk does provide some essential information for that circuit, make sure you check out his post. \$\endgroup\$
    – Kellenjb
    Commented Oct 4, 2010 at 15:58

R.E Caps Electrolytic or ceramic? -

It depends on what value is required (sorry I can't help you with that, I'm not familiar with the circuit in question) If you need a large value you'll probably want an electrolytic, the larger the value the more expensive and harder it is to find in a ceramic package.

Ceramics in general have a longer life span than the electrolytics, but they're quite brittle and don't like being bashed about excessively.

Hope that helps.

your project sounds like fun, I'm super curious to see what the mouth-face bit looks like!

Good luck :)

  • \$\begingroup\$ Thanks. I guess I'm more interested in what's a reasonable value - .1 mfd, 10 mfd, 100mfd? If it helps, the audio pulses will be fairly quick, like maybe around 250ms \$\endgroup\$
    – PeteShack
    Commented Oct 2, 2010 at 13:51
  • \$\begingroup\$ To be honest I wouldn't like to guess, I've not used any relays before and I just don't know enough about your circuit, there'll be an equation for it somewhere I'm sure...hopefully someone else will have the answer for ya, we'll just have to shout louder.......CHIPHACKERS!!!!! oops forgot...it's not Chiphacker anymore...what are we called now? \$\endgroup\$
    – Jim
    Commented Oct 2, 2010 at 15:05

A completely different approach could be to feed your audio signal into the PWM input of a servo. You could then use one of the audio channels to do some fairly sophisticated motion.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.