5

I've got kind of a weird project in mind. I want my project to be able to connect to the headphones jack of an MP3 player.

The mp3 player will either be playing a constant tone or not playing anything at all. When it is not playing anything, I want to light a green LED. When a tone is playing, I want to light a red LED.

Is enough power generated through a headphones jack to cause a transistor to switch? Would it be easier to just use an AVR (ATtiny or something) to listen for analog input?

JYelton
  • 34,119
  • 33
  • 145
  • 265
synic
  • 97
  • 1
  • 8

1 Answers1

5

Try this circuit

schematic

simulate this circuit – Schematic created using CircuitLab

The circuit is a voltage doubler feeding into a BJT driver for the red LED. The voltage at R1 should be about Vin (p-p) less a few hundred mV for the Schottky diodes, so an input voltage of ~500mV RMS should be enough to drive the red LED. When the red LED is off, the voltage at the anode of D4 rises until the green LED turns on. When the input signal disappears, C1 is rapidly discharged by the base current of Q1.

Edit: Below is an optional preamplifier since the input seems to be less than the 500mV RMS required to operate the detector. I've also increased the capacitors in the above schematic to 10uF & 100uF given the new information that the frequency is only 55Hz.

schematic

simulate this circuit

Spehro Pefhany
  • 397,265
  • 22
  • 337
  • 893
  • I'm having a bit of a hard time figuring out what kind of diode to use for D1 and D2 - Google is turning up a sot23 SMD 2 diode package. What type of diode am I looking for on those? – synic Feb 25 '14 at 04:50
  • 1
    Yes, it's a common dual. If you want individual through-hole parts, 1N5818 diodes should do. – Spehro Pefhany Feb 25 '14 at 04:54
  • I think that a bit of an explanation should be provided here... Who turns off the bjt for example? – Vladimir Cravero Feb 25 '14 at 20:40
  • 1
    @VladimirCravero Base current of (LED current)/hFE discharges the capacitor when there is no input signal present. It's a small cap, so the discharge is fast even if the LED is barely visible. – Spehro Pefhany Feb 25 '14 at 20:50
  • Well, my radio shack doesn't have any schottky diodes, so I have ordered some. I'm gonna mark this as answered. Thanks! – synic Feb 25 '14 at 21:27
  • 1
    @synic It should work with 1N4148s too, but at a higher minimum volume level. – Spehro Pefhany Feb 25 '14 at 21:29
  • @SpehroPefhany k - I will give it a try. This will work with 1uF tantalum caps, correct? Sorry, i'm fairly new to all of this (if you can't tell). – synic Feb 25 '14 at 22:48
  • 1
    Ceramic caps would be the most compact. If you use tantalums, the - end goes to the input for the left one, and the - goes to GND for the right one. – Spehro Pefhany Feb 25 '14 at 23:30
  • Ive got this set up on a breadboard with tantalum caps and 1n4148s, and only the green LED is lit, even if I play a 440hz tone through the headphone jack. I'm not sure what Ive done wrong. I'm fairly sure I've got everything wired correctly. The input is the right channel on my headphones. – synic Feb 25 '14 at 23:44
  • 1
    Might need more signal. What's the voltage on an AC voltmeter at the input. – Spehro Pefhany Feb 25 '14 at 23:50
  • .227 volts. That's with the volume all the way up – synic Feb 26 '14 at 00:12
  • http://imgur.com/RG6Mdff - that's the breadboard. I know you can't see everything from there, but maybe I've done something obvious. – synic Feb 26 '14 at 00:20
  • 1
    That's not quite enough voltage, even with the Schottky diodes. If you don't have a small audio transformer kicking around the best thing would be to amplify it a bit with another transistor. – Spehro Pefhany Feb 26 '14 at 01:07
  • Can i replace schottky trap with a transistor amp? – synic Feb 26 '14 at 02:32
  • 1
    @synic see above edit. Should work fine with 1N4148s with the transistor preamp. – Spehro Pefhany Feb 26 '14 at 02:33
  • Awesome. I wish i could upvote your answer a few more times. You've helped me quite a bit. – synic Feb 26 '14 at 02:45
  • Ok, I've got the preamp, and it works! However, the red LED never quite goes out, no matter what. It's always varying levels of dim. Giving the preamp signal makes the red led glow brightly and the green LED turn off, but no signal leaves the green bright and the red still on – synic Feb 26 '14 at 06:05
  • @SpehroPefhany yep I know how the circuit works but a bit of explanation for people who don't quite understand electronics would be good – Vladimir Cravero Feb 27 '14 at 09:13
  • 1
    @synic Try a 100K or so from the base to ground of the transistor driving the LED. Maybe your C2 capacitor is leaky. – Spehro Pefhany Feb 27 '14 at 09:43
  • The 100k resistor works! I swapped out the 10uF cap just to see, and I had the same results (without the 100k) – synic Feb 27 '14 at 14:11