Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing to a headphone jack... — Parallax Forums

Interfacing to a headphone jack...

DavidMilDavidMil Posts: 3
edited 2009-11-23 20:22 in BASIC Stamp
I need help creating a simple circuit that will allow a BS2pe processor to receive a high input from the headphone jack on my laptop when the laptop starts playing music.· The program·will ignore the input for a specific time once the line goes high,·so it's just a matter of waiting for·a high input.· I·connected a multi meter to the·jack and only saw about 800mv max, but I realize that's probably not a very accurate reading.· Any help would be appriciated.

Thanks,
David·

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-11-23 01:13
    The bs2 will not be able to do this by itself you will need something to do signal processing and that will be the part that senses the music playing. 800mv is about right for a audio output but it will fluctuate depending on the level of music and it's type.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • DavidMilDavidMil Posts: 3
    edited 2009-11-23 04:41
    I was thinking about something like a transistor with the headphone jack tied to the base through a resistor.· Once the base voltage 'turns the transistor on' the first time to send a high to the input pin on the processor it won't matter to the program what happens to the transistor for a set amount of time; until the program forces the input low and waits for the transistor to·'turn on' again.·
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-11-23 04:56
    800mv may or may not get it that way.· You'll get much better results with a comparator, then you can use a pot to adj a trigger point even at a very low voltage.· Look for a LM339.
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2009-11-23 06:53
    DavidMil,

    In order to make a bipolar transistor turn 'on', the B-E junction needs to see about 550mV before it starts to conduct in it's linear mode. Since the nature of your signal is audio and likely to be 800mV peak-to-peak it could very well be +/-400mV ... IOW below the transistor threshold of 550mV. You can however bias the transistor input in a way that even a very small signal well below 550mV is enough to turn the transistor 'on'. The attached circuit allows you to adjust this bias so that the SCR (made from the NPN and PNP transistor) will trigger and latch the output from about 300mV to 700mV.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
    912 x 616 - 153K
  • DavidMilDavidMil Posts: 3
    edited 2009-11-23 07:15
    Thank you Beau, that's perfect!
    And thank you all for your suggestions.

    David
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-11-23 15:02
    Gee, I thought the Stamp was supposed to be part of the solution.· Well, whatever.

    Bet the next post will be about "How do I unlatch the latch?"·

    [noparse][[/noparse]I know how.]
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2009-11-23 15:48
    PJ Allen,

    I know you know this, but perhaps I should have added more detail (tongue in cheek - grin)

    Sending a HIGH signal from the Stamp to the RESET pin will cause the latch to become unlatched.
    When latched, the OUT pin goes LOW, which can be read from the Stamp.
    Adjusting the 10K Pot allows you to adjust the latching threshold between 300mV to 700mV.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • ercoerco Posts: 20,256
    edited 2009-11-23 20:22
    In my very early days as a CW ham (using morse code), I built an automatic keyer to send a full minute of CQ CQ CQ de WA4CIK CQ... .

    I recorded my code from a code practice oscillator into an audio cassette recorder. Then played it back at high volume out the headphone jack, through an audio transformer then rectified the audio signal with a bridge rectifier & cap, and used that to drive a relay directly, which keyed my transmitter. It worked great.

    When it works, brute force rocks !

    David, you could probably do something similar with an audio transformer to get higher than 800 mV.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
Sign In or Register to comment.