Shop OBEX P1 Docs P2 Docs Learn Events
Measuring Relay Debounce Time — Parallax Forums

Measuring Relay Debounce Time

KoyJaKoyJa Posts: 17
edited 2005-08-21 23:12 in BASIC Stamp
STAMP BS2P
REV 1.4
Relay Coto 2200-2301


ahaaa The Boss at my primary Job finally is going to let "The Network Admin" (Me) Do a STAMP project for work.
It appears we got a bunch of Bad relays recently .... with the 1 ms debounce time out of spec. I have been
looking through the BS Mauual and it looks like the COUNT command may do the trick .... here's my logic for how to implement
this :

1. SET P2 HIGH HIGH 2
the stamp to a 2n2222A which drives the coil
turning on the relay (Relay Closed). Output
of relay goes to PIN 3 Stamp (Pullup Resistor)
2. Set COUNT for 1 second to PIN 3 Stamp COUNT 3,1000,MyVar

Multipl MyVar * 1.20us Visual Basic APP

P2 HIGH 1 sec
|*****************************|

RELAY Bouncing
/\/\/\/\/***********************|

I would reach the 65535 threshold of MyVar if the Debounce
times was ~75ms. Im not sure what the pulse width of the bounce
is however Im thinking it doesnt mattter. Im Basicall just waiting for
it to end and making sure MyVar*1.2us <1ms. Am I in the general
Ballpark?

Thanks

mikey

Koy Ja !

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-21 16:14
    Mike,

    ·· I see four things in your message that flag me.· One is connecting the transistor.· You need a resistor between the base and the Stamp I/O pin controlling it, but you didn't mention it.· Also, when you talk about the output of the Relay going into the Stamp I/O pin, you mention a pull-up resistor.· Does this mean the other relay contact is going to ground?· It should be.· You can follow the example in the help file for the button command on a circuit to connect this properly.

    ·· On the code side, you mention something about a VB App?· I'm not sure what that relates to, but you cannot directly multiply times a decimal number.· There are functions within the BASIC Stamp that can get around this though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-08-21 16:50
    It seems to me that job is best done with a high-speed 'scope -- I don't think the contact bounce pulses will be long enough for the BASIC Stamp to "see."

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-21 19:50
    And then there's what Jon added...· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • KoyJaKoyJa Posts: 17
    edited 2005-08-21 23:12
    Sorry I forgot to mention the complete setup .... Luckily I have it already built into
    "The Never Ending Project" As you can see from the Photo (and I didnt mention [noparse]:)[/noparse]
    There is a current limiting res going into the Base of the Transistor. One side of the
    switch is going to 499K pullup(5V) and the other side to ground ... I needed to modify
    the gnd portion but was easily done because it went to an RCA connector wich I just
    cut into the cable and connected to ground. The VB app I was mentioning would convert
    the 0-65K MyVar to timing since Im not to familair (YET!) with doing Floating point math
    with the STAMP.

    I then did what Jon suggested and hooked up the Fluke 123 ScopeMeter .... As usual
    you guys are correct ! The Pulses are only ~200ns and the Peak start at only 1V ...
    I believe the STAMP needs 1.4 Volts to detect. I could use a window comparator
    to to give me crisp 0 and 5V transistions but then I would still have the timing issue
    to worry about. As you know the Min Pulse width for the BS2P40 Im using for debug
    is 1.20us ..... I cannot find the spec for MPW for your newest part BS2PX. I dont think
    it will be in the range of 100ns i would need.

    Here's a pic of the Debounce on the scope.

    Thanks again Guys

    mikey

    Koy Ja !
    2560 x 1920 - 362K
    2560 x 1920 - 195K
Sign In or Register to comment.