Shop OBEX P1 Docs P2 Docs Learn Events
BS2 as button?? — Parallax Forums

BS2 as button??

MubotMubot Posts: 13
edited 2009-09-17 02:34 in BASIC Stamp
hi... lemme see if i can ask this properly...

i have a circuit that has a play button (lil mini voice recorder)

how would i have that triggered by my bs2??

thanks for the help...

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-15 03:46
    The most general purpose way is to use a reed relay. To the BS2, it's just a relay coil. There are plenty of examples in the Stamp documentation including Nuts and Volts Column #6, figure 6.3. Although that figure shows a BS1 and +12V relay, the same circuit can be used with a BS2 and a +5V relay. The relay contacts are simply wired across the play button.

    RadioShack carries some 5V coil voltage reed relays that would work just fine. They also have the switching transistors, diodes, and resistors you'd need.

    www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol1/col/nv6.pdf

    Post Edited (Mike Green) : 9/15/2009 3:53:48 AM GMT
  • MubotMubot Posts: 13
    edited 2009-09-15 04:09
    thanks dude... thats the answer i expected....

    what about something like a 4066 chip...would that work.....i think they work something like ....send a digital out to the chips control pin...and that will make make an analog type switch connection?

    or am i totally wrong with that !??!?


    thanks again
  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-15 05:31
    A relay provides a set of isolated contacts. It doesn't matter how the play button is connected or what it is connected to, the relay contacts will provide the same thing. An optoisolator will also provide the electrical isolation, but you don't know what's connected to the play button or the voltages involved so an optoisolator may not work and there's a polarity to an optoisolator. It won't work if the output is connected backwards. An analog switch looks like it ought to work, but it's not isolated. Again, whether it can work depends on what's inside the recorder and how the play button works. A reed relay avoids all that.
  • MubotMubot Posts: 13
    edited 2009-09-15 13:08
    thanks for the explanation... and the lesson [noparse]:)[/noparse]

    VERY much appreciated!
  • ercoerco Posts: 20,256
    edited 2009-09-15 16:27
    Reed relays are usually low-current devices and some (like the Radio Shack 5-volt unit with a 250-ohm coil) can actually be driven directly by a Stamp pin. That's 20 mA, right at the Stamp's limit, but it works fine if you're only driving one or two reed relays from as many pins BUT YOU MUST USE A FLYBACK DIODE or you can blow up your Stamp with an inductive spike. Blow it up real good.

    Note that this will not work with a BS1 Project Board or BS2 Homework board. They have series protection resistors on all their pins.

    I know I'm in the minority here, suggesting this direct connection to the stamp. I have used such a circuit a lot and it works reliably if you hook it up right. If you get it wrong, you can·smoke at least one Stamp pin. I like it because it's·the minimum parts solution and fastest. For beginners, fewer parts & connections is a good thing IF they get it right·the first time!


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-15 19:38
    I've also used the "direct connection" method and it works fine. You just have to be careful to check the relay's coil current (on the package or in the datasheet) to make sure it's 20mA or less.
  • ercoerco Posts: 20,256
    edited 2009-09-15 19:55
    God bless you, Mike Green! I feared you might be the first scoffer at my direct connection post. It's every Forum poster's dream to have Mike Green give them a thumbs up. I can hold my head high now! Yes, I'm serious!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-15 20:06
    Serious? Anyway, there are some nice reed relays I got from DigiKey that have a 3V coil rating at 12mA and there are many that have a 5V coil rating at 10mA. The 3V relays work like a charm with the Propeller.
  • ercoerco Posts: 20,256
    edited 2009-09-15 22:18
    My favorite relay is the Aromat/NAIS TF2-5V/ATF209: 300-ohm coil, DIP packaging (plugs in DIP socket), and DPDT contacts. This ultra-sensitive relay has a polarized coil and draws 17 mA at 5V, which the Stamp easily handles. About 30% of these relays will even function with the Stamp Project/Homework boards which have 220-ohm series resistors. That's just under 10 mA. Occasionally available in bulk on Ebay for under $1 each. Just two relays and two diodes make an H-Bridge with dynamic braking, perfect for small bots.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • iDaveiDave Posts: 252
    edited 2009-09-16 02:57
    This is why I come visit this forum everyday. The daily ingestion on useful info! Thanks guys. Bookmarked & saved!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A complex design is the sign of an inferior designer."
  • ercoerco Posts: 20,256
    edited 2009-09-16 17:22
    iDave: If you're into H-bridges, check·the post· at ·http://forums.parallax.com/showthread.php?p=749676

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • dev/nulldev/null Posts: 381
    edited 2009-09-16 17:41
    I did a similar thing, and tested both NPN and PNP transistors (they cost $0.03 so it didnt matter if one blew) until it worked. Final solution was a NPN (2N3906) on the plus side of the button, collector to positive (which suggests a high impedance output from that direction).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • iDaveiDave Posts: 252
    edited 2009-09-17 02:34
    Thanks erco..I did check it out. I want to do something with this cheapo wall-e toy I got off ebay. It looks good but all it can do is wave it's arms and head around(interactive wall-e its called i think). I want to put some dc motors in there! And i want it to be speedy. So speed control will be important. I believe using pwm would be best way to do this, but your ideas in the thread u suggested may have merit. Maybe 3 different speeds? But that may be too cumbersome as it would mean even one more relays & use of stamp pins and i may be limited in space inside the casing. Hmmmm. Sorry Mubot if we took your thread in different direction

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A complex design is the sign of an inferior designer."
Sign In or Register to comment.