Shop OBEX P1 Docs P2 Docs Learn Events
Alarm Style Input -- Ideas Needed — Parallax Forums

Alarm Style Input -- Ideas Needed

G McMurryG McMurry Posts: 134
edited 2011-01-19 01:07 in BASIC Stamp
I want to use a Basic Stamp to sense a remote contact closure. Easy enough you say....? However, I need to know if there is a fault... For example: A simple normally closed contact to ground with a pullup can easily sense a switch being open or closed. What if someone cuts the wire between the Stamp input and the contact closure?

How can I pole the switch in a way that I can tell if it is closed, open or missing?

In a normal burglar they put a resistor across the switch contact. The system can then look for that resistor (switch open), look for a short (switch closed), look for nothing (switch is missing).

I am thinking I can use some sort of circuit such as RCTime and see the three switch conditions I want...

Does anyone have any other ideas?

I guess if I have to, I could go to two bits per switch but I think the Basic Stamp should be able to do this reliably with one bit.

Greg

Comments

  • FranklinFranklin Posts: 4,747
    edited 2011-01-17 19:21
    In a normal burglar they put a resistor across the switch contact. The system can then look for that resistor (switch open), look for a short (switch closed), look for nothing (switch is missing).

    I am thinking I can use some sort of circuit such as RCTime and see the three switch conditions I want...
    That sounds like the way you should go.
  • bsnutbsnut Posts: 521
    edited 2011-01-17 22:54
    You have the right idea and RCTIME command is the way to go.
  • ercoerco Posts: 20,256
    edited 2011-01-18 15:55
    I think some alarm systems use pulse trains of different frequencies to detect changing switch conditions. You could use a Stamp with the COUNT command, or even a 555 timer in a missing pulse detector configuration.
  • TomatoTomato Posts: 23
    edited 2011-01-18 20:56
    I agree that the rctime command is the simplest approach. But I also thought of another idea (requires some more circuitry). If, in normal operation, current flows through the resistor across the switch contacts, you can detect the voltage drop across it with a comparator (LM339 or something). Configure it so that it outputs supply voltage as long as the wire is intact. When the wire is cut, current stops flowing through the resistor and the differential input to the comparator disappears. Ensure a negative output swing with like a 10k pulldown on the comparator output.

    This way, you use two pins on the microcontroller. One of them can detect open circuit or closed circuit, and the other can detect the fault (whether or not current flows through the resistor).

    I guess this doesn't really work, though, if the alarm's idle state is with the switch closed.

    Anyway, just a thought.

    -Tomato
  • bsnutbsnut Posts: 521
    edited 2011-01-19 01:07
    You had the right idea with your first post. What you are doing is, know as supervising the circuit with an resistor around 5K at the end of two wires. Which is common place in Fire Alarm and Security systems to check for wire breaks. Mainly in Fire Alarm systems, were you are looking for a switch closure, which is shutting the resistor out the circuit.

    What you need to do is look at help file for RCTIME in Basic Stamp Editor which will show you how it is connected. What you, have to remember is you will always have a resistor in the circuit.
Sign In or Register to comment.