Help - circuit to activate a relay from ~50mv audio signal

Discussion in 'The Projects Forum' started by haloway13, Nov 5, 2011.

  1. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Looking to build a simple circuit to activate a 5v, 20ma relay from the output of an mp3 player (50mv pk to pk) when playing.

    I have mixed a track that will do a 440 hz audio signal for about 3 seconds every 10 mins for about 1 hr.

    Thank you,
    Tim
     
  2. #12

    Expert

    Nov 30, 2010
    16,283
    6,796
    Perhaps something like this?
     
  3. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Awesome! What would be the details to that so I could build it?
     
  4. #12

    Expert

    Nov 30, 2010
    16,283
    6,796
    This is based on www.mouser.com part number 755-BA10393 for 65 cents.
    The 1k pot on the left is a threshold adjustment so you can dial out a noise level. The 1 meg pot on the right gives a hold time adjustment. Minimum is about 2 seconds. Max might be 200 seconds.
    The 100 ohms in series with the relay might not be necessary if the relay coil can survive 7 volts. The battery will get weaker with use. The comparator will lose about 2 volts inside its driver section.
    Then there are the usual glitch stoppers...10uf and a .1uf capacitor across the supply terminals of the chip would be good.

    The timer capacitor is up to you because you didn't say anything about how long it should hold in the "on" condition.

    I don't "simulate" so I invite others to fine tune this if they want to.

    You're welcome.
     
    Last edited: Nov 7, 2011
  5. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Thank you so much for your help! It looks fairly straight forward.

    I am wondering if you could give me an example circuit that would work with a TL082 (Which is very accessible to me)

    Thank you.
     
  6. #12

    Expert

    Nov 30, 2010
    16,283
    6,796
    You can plug a TL082 right into this circuit but:

    One of the problems with a TL082 is the 15 mv (max possible) input offset voltage specification. You might build an input voltage zeroing circuit. You might be lucky and the offset is in the right direction to "dial it out" with the circuit I designed. (It goes to 60 millivolts, but only in one direction.) You might be lucky and have a chip with very low offset voltage.

    The TL082 is not guaranteed to work with input voltages within 4 volts of ground.

    The TL082 doesn't have enough output current to run your relay.

    so...no.

    An hour or more of my time or your 65 cents plus shipping.
    Maybe somebody else is feeling less pressed for time right now.
     
    Last edited: Nov 7, 2011
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Hate to give you the bad news, #12 - but the BA10393 has the same specs as the LM393, which is a 2-channel version of the LM339, and which has a 16mA sink current limit; but I really don't like even hitting 6mA with them - 3.5mA-4mA is my preferred limit.

    Also, these are open-collector comparators, which means they can sink current, but not source it. Since the left-hand comparator output has no current source, the output will never rise above ~0.2v or so, and the 2nd channel won't ever see a valid input for its' inverting input - which means the circuit won't work as you have drawn it.

    The TL082 CAN sink enough current. Unfortunately, it can't get within 3v of the negative rail, so it's out.

    But, with just a little help your circuit can be patched up.

    The 47k resistor below the 1k pot on the left should have been 4.7k.
    The 100uF cap was too large, so was the 1M pot. Dropped the 100uF cap to 10uF, the 1MEG to 500k. Added a PNP transistor & base limiting, base return resistors to source current to the relay. Fixed the noninverting reference input for U1b; you had it grounded.

    Now the minimum on-time (once C2 has charged) is ~1/2 second.

    See the attached.
     
    #12 and haloway13 like this.
  8. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Thank you so much for the analysis!

    Is spice a free program that I could DL and play with the circuit myself?

    Tim
     
  9. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Sure ... but you'll need some extra components that don't come with LTSpice by default.

    I've attached the .asc file. I'll have to look around and see what else you will need.
    [eta]
    Don't think I'll send the rest tonight, I'm getting tired.

    [eta]
    OK, added a bunch more files.
    All of the extracted files go in some subdirectory of:
    C:\Program Files\LTC\LTSpice4\

    pot.zip:
    pot.sub - goes in lib\sub
    pot.asy - goes in lib

    relays.zip:
    all .asy files go in lib
    the .sub file goes in lib\sub

    lm317.zip:
    lm317.asy - goes in lib\sym\powerproducts
    lm317.sub - goes in lib\sub

    comparators.zip:
    all .asy files go in lib\sym\comparators
    .sub/.lib files go in lib\sub

    lm555.zip:
    all .asy files go in lib\sym\misc
    Remaining .sub/.lib files go in lib\sub
     
    Last edited: Nov 8, 2011
  11. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    I was able to get the comparator figured out myself. Appear to be missing the varistors and the relay.

    I will give this all a shot myself for educational purposes.

    Thank you for all your help!

    Tim
     
  12. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Er, the potentiometer and relay.
     
  13. #12

    Expert

    Nov 30, 2010
    16,283
    6,796
    Mouser should have told me this was an equal to familiar old numbers :(
    but it came up as a "one of a kind","having no equal", "the only thing that fits my needs", and then you have to read to page 16 to find out its an open collector device.

    For the BA10393, Page 6, Fig. 6 shows 1.6 to 2 volts loss at 20 ma of sink current. I was depending on that to run a 5 volt relay off a 9 volt battery.

    For the TL082, Page 10, figure 9 shows the TL082 losing 6 1/2 volts with a 350 ohm load.

    But then Haloway13 did not say what voltage was available or how much time he wanted in the hold circuit, so I guessed.

    Anyway (wookie), thanks for catching that and thanks for demonstrating how to get around the open collector problem. I've been up to my armpits in alligators for more than a week. Autumn and all that...too much work right now.
     
    Last edited: Nov 8, 2011
  14. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    I am sure I am going to end up with egg on my face with this question... It has been way too long since I did anything with op amp circuits...

    I have looked at the details of the attachment and am curious as to the signal being used for input. It is not clear to me that the if the audio in goes to 0, that the circuit will reset.

    Would it be better if I just use fixed value resistors instead of the pots?

    Thank you for all your help!

    Tim
     
  15. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Holding the relay should be very roughly 1/2 s after the audio is not present. Not really important.

    I plan on using a 9v transistor battery for power.


    My specific application is that I need an interval timer that does this:

    1 hour long total duration, 10 minute interval notification.

    I am going to use an mp3 player with an audio track that has 0mv output except for when I want the relay to activate (~50 mv ac @ 440 hz)(Or whatever freq I need for best response). The relay will drive a loud piezo buzzer off the same 9v supply.

    I hope none of this additional detail throws a monkey wrench into the solution provided. :)

    Thank you!
    Tim

    P.S. Audacity is what I will use to generate the mp3 track.
     
  16. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    #12: no harm, no foul. :) If I had a nickel for every mistake I'd made on here, I'd have ... a good pile of nickels. ;)

    haloway13/Tim:
    If there is no audio input, or only very low-level audio input for awhile, the relay will drop out (contacts will open).

    If you use fixed resistors, you will have no means of adjusting the sound threshold level, nor the duration the relay stays engaged after the sound stops.

    I have uploaded more symbols and .subcircuit libraries as .zip files to reply #10. If you download them and follow the instructions I've added to that post, you should be able to run the simulation.

    If you have saved the .asc file after loading it into LTSpice, you will need to download it again, as the references to the symbols you didn't have will no longer appear.
     
  17. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    Thank you so much! I am very impressed with the forum and allaboutcircuits.com.
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Oh, I forgot -

    Once you load the simulation and all the parts are in there,
    right-click on V2, and set the parameters as follows
    DC offset[V]: 0
    Amplitude[V]: 50m
    Freq[Hz]: 440
    Tdelay: 0.2
    Theta[1/s]: 0
    Phi[deg]: 0
    Ncycles: 1320 (this is 3 x 440Hz for 3 seconds)
    Then click OK. Save the simulation.
     
  19. haloway13

    Thread Starter Member

    Oct 24, 2011
    37
    0
    I tried looking briefly on the internet... it appears that the 1N4001 is not included with the default library.
    *SRC=1N4001;DI_1N4001;Diodes;Si; 50.0V 1.00A 3.00us Diodes, Inc. diode .MODEL DI_1N4001 D ( IS=76.9p RS=42.0m BV=50.0 IBV=5.00u + CJO=39.8p M=0.333 N=1.45 TT=4.32u )I found this, but no idea on how to incorporate it.

    Tim
     
  20. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Download the attached file.

    Make sure you have exited LTSpice.

    Look in C:\Program Files\LTC\LTSpice4\lib\cmp
    Rename "standard.dio" to "standard.dio.bak"
    un-zip standard.dio.zip into C:\Program Files\LTC\LTSpice4\lib\cmp
    Re-start LTSpice

    You should now have a bunch more diodes.
    If you don't, then you didn't extract standard.dio to the right place, or it was damaged.
     
Loading...