Shop OBEX P1 Docs P2 Docs Learn Events
Hall Effect Sensor to detect open door — Parallax Forums

Hall Effect Sensor to detect open door

parf02parf02 Posts: 2
edited 2013-11-28 09:46 in General Discussion
I am trying to build a security system which can detect when a door opens.
I was thinking of putting the sensor on the wall and a magnet on the door. When the door is closed, the sensor and the magnet are in proximity.
I am using a BASIC stamp II to monitor the HIGH/LOW output of the sensor.

I was expecting the hall effect sensor to output 1 or 0 depending on wether or not the two were in proximity. After testing, the results are not as simply. Sometimes the senor outputs 0 when there is no magnet sometimes its 1.

Can I do anything to make it work as I was expecting?

Thank you

Comments

  • ercoerco Posts: 20,256
    edited 2013-11-27 13:15
    Hall effect, or reed switch? If Hall effect, do you have an amplifier or comparator circuit between the sensor and Stamp?

    For detecting a closed door situation, I'd use the simplest possible sensor, either a reed switch (typical Radio Shack window switch for burglar alarms) or a mechanical switch, as used in car doors and refrigerator doors to control the interior light.
  • parf02parf02 Posts: 2
    edited 2013-11-27 13:26
    I think I might change to using a reed switch.
    Thanks for the suggestion!!
  • ElectricAyeElectricAye Posts: 4,561
    edited 2013-11-27 17:01
    Yes, magnetic reed switches are those things you see everywhere. There are lots of different styles and configurations. One word of caution, however: my magnetic personality often sets them off at parties.

    http://www.security.honeywell.com/hsc/documents/omincatin.pdf
  • tonyp12tonyp12 Posts: 1,951
    edited 2013-11-27 17:03
    reed is so 1970's
    I have plenty experience with solid state mag sensors, some are open-drain and some are push-pull.
    What mag sensor/halleffect do you use?
    Some are Omni polar and some only change when first south and then a north pole magnet.
    In what angle direction is the magnet located compared to sensor/pcb?
    Through hole or smt is best for you?
  • ercoerco Posts: 20,256
    edited 2013-11-27 17:54
    @p12 :The 1970's were cool. :)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-11-27 19:00
    Whichever sensor you use, make sure that the default condition if something goes wrong is "door open." IOW, for a reed switch, the magnet should hold the switch contacts closed when the door is closed, thus completing the circuit. If the magnet falls off the door, or is stolen, or if the logic circuit power fails, it will look like the door is open. 'Same applies to Hall-effect sensors: the "active" state should be "door closed."

    -Phil
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-11-27 19:21
    Hi Phil;

    Same thing for broken wire to.

    Fail Safe operation.

    Duane J
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-11-28 09:20
    Hall effect unipolar switches are open collector, so they would have to be wired with a pull-up resistor on the logic pin.

    A closed door would be a logic 0, an open door would be a logic 1. That would seem to imply that a power failure would indicate a false door closed.

    Jameco has these with the amplifier. Though they require power from higher than 3.3v, the open-collector can be pulled up to 3.3 to work directly with the Propeller i/o. I have been helping a fellow with a kinetic sculpture that is using both the unipolar and bipolar hall-effect sensor (which include the amplifier, the open-collector, and a teenie-tiny regulated power supply). They work fine... as long as you understand that the unipolar will only trigger with one pole of the magnet. If you install the magnet backwards... nothing happens.
  • tonyp12tonyp12 Posts: 1,951
    edited 2013-11-28 09:46
Sign In or Register to comment.