Shop OBEX P1 Docs P2 Docs Learn Events
Need help initiating bs2 using signal — Parallax Forums

Need help initiating bs2 using signal

flcrackerflcracker Posts: 5
edited 2009-10-06 13:23 in BASIC Stamp
Hi
great forum! I am a new user and am begining to use the Homework Board.· I want to use the signal output from the speaker of an alarm clock to begin a program with the bs2. I guess it would be a subroutine.· im totally in the dark with this.· looking for someone to spell it out for me, for now, as i need to have this written tonight. (i posted this in similar thread).· this is the 'non science fair' part of my daughters science fair project.

Any and all help would greatly be appreciated!!

Comments

  • flcrackerflcracker Posts: 5
    edited 2009-10-06 02:23
    Sorry about the all CAPS thing. Didnt realize they were on.
  • NWUpgradesNWUpgrades Posts: 292
    edited 2009-10-06 04:38
    Not sure I understand what you are asking. As far as I know, a speaker does not supply an output. If you clarify what exactly you are trying to do, someone may be able to help.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-06 05:56
    You need an external circuit to take the signal from the alarm clock speaker and produce a logic high/low signal that the Stamp can process. You will need an audio transformer (like this one: www.radioshack.com/product/index.jsp?productId=2103254&tab=features). The side with the two wires gets connected across the alarm clock speaker. The outer wires on the side with the 3 wires has one wire connected to ground, the other wire connected to the end of a 1N914 diode (or equivalent - www.radioshack.com/search/index.jsp?kwCatId=&kw=signal%20diode&origkw=signal%20diode&sr=1) without a band and the banded end of the diode connected to the positive side of an electrolytic capacitor (maybe 1uF - www.radioshack.com/product/index.jsp?productId=2062392) with the negative side connected to ground. You put a 1K resistor between the positive end of the capacitor and a Stamp I/O pin. The result is a signal that should go HIGH when the alarm sounds. You might put a 100K resistor across the electrolytic capacitor so the signal will quickly go LOW when the alarm stops.

    Your program would check the I/O pin and wait until the I/O pin is HIGH (1) before continuing.

    Like: "WaitFor: IF IN1 <> 1 THEN GOTO WaitFor
  • dev/nulldev/null Posts: 381
    edited 2009-10-06 09:15
    Like this?

    attachment.php?attachmentid=64248

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
    605 x 246 - 5K
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-06 13:23
    Thank you. That's what I had in mind. The transformer provides isolation and increases the voltage available. The diode and capacitor convert the AC to DC and filter it. The 100K resistor makes sure the capacitor will discharge quickly when the alarm stops, and the 1K resistor protects the Stamp I/O pin from excess voltage.

    Because it's hard to estimate the output voltage, you might change the 1K resistor to 10K.
Sign In or Register to comment.