Shop OBEX P1 Docs P2 Docs Learn Events
Pulling high or low — Parallax Forums

Pulling high or low

pcrobotpcrobot Posts: 103
edited 2006-09-16 20:44 in BASIC Stamp
Hello,

I'm dealing with a door sensor that has two wires. I'm wireing it like a standard 4-pin pushbutton. One wire goes to P3 and Vss, the other wire goes to Vdd. But when I Debug the state of the sensor it's floating, not accurate. How can I pull it either high or low to get accurate results?

Thanks!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.x3beta.forumup.com

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-09-13 19:43
    Hello,

    ·· Can you draw a simple schematic of what you have?· It sounds like you may be shorting you power supply lines as well...As for a simple push button schematic, if you look in the Editor Help File under the BUTTON command there are examples of both active-low and active-high connections.· I hope this helps.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-09-14 01:22
    Download the book Whats a Microcontroller? it discusses this in detail, not positive on the chapter but i refer to it everytime i need to wire up a push button switch

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Learn somthing about everything, and Everthing about somthing-
  • pcrobotpcrobot Posts: 103
    edited 2006-09-14 19:56
    Here's the schematic. Just picture a pushbutton-like sensor with 2 wires (instead of four like the standard pushbutton)

    Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.x3beta.forumup.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-09-14 20:01
    Hello,

    ·· Your posted schematic actually answers that question.· In your original post you never mentioned the resistors that are in that schematic.· In any event if you connect like that (active high), you will get a 0 when the button is not pushed, and a 1 when it is.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Mike GreenMike Green Posts: 23,101
    edited 2006-09-14 20:04
    If what you actually have is the same as the schematic, it should work great. When you close the pushbutton the pin should go solidly high and when you release it, the pull down resistor should pull it solidly low. Given that it doesn't behave the way you're expecting it, the actual wiring may be different from the schematic. With the circuit you've shown, the Stamp pin would not appear to float. Try disconnecting the sensor from the resistors and verify that the input pin goes low. Short the point where the resistors would connect - to Vdd and verify that the input pin goes high.

    What kind of sensor is it? Is it a magnetic reed assembly?
  • pcrobotpcrobot Posts: 103
    edited 2006-09-16 01:24
    It's a magnetic sensor, I'm not sure what the technical term is...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.x3beta.forumup.com
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-16 03:38
    If it's a mechanical switch, which pulls closed when a magnet comes close, then yes that's a mechanical reed relay. And your circuit should have worked. Now, if it's some 'active' circuit (like a hall effect sensor) then you'll need something else.
  • pcrobotpcrobot Posts: 103
    edited 2006-09-16 11:35
    If it was an active circuit what would you suggest?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.x3beta.forumup.com
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-16 20:44
    Finding out if it's an active sensor. Then going to the manufacturer's web-site and downloading the documentation for it. Then implementing a practical interface between it and the BS2, in accordance with the manufacturer's specification sheet.
Sign In or Register to comment.