Hall Effect Sensor: Doors, Windows, Mail Box, etc.
When influenced by a magnetic field, a Hall Effect Switch Sensor outputs binary data through one of its three pins: Near a sufficient magnetic field, a Hall Effect Switch outputs ON (one or true). Otherwise, it outputs OFF (zero or false). There is also a Hall Effect Sensor that outputs analog data proportional to the strength of the magnetic field. I will not discuss that type of Hall Effect Sensor.
Where a magnet is used to trigger a reed switch, a magnet can also trigger a Hall Effect Switch. A Hall Effect switch sensor can be used (with a magnet) to sense whether things like these are open or closed: windows, people doors, garage doors, & mail box doors.
A reed switch has only two pins, power & ground while a Hall Effect sensor has those two pins plus a data line. A Hall Effect sensor is smaller than a plastic-encased reed switch, yet a Hall Effect sensor seems fairly sturdy. A plastic-encased reed switch includes a way to mount it. For some installations, Hall Effect sensor may need such a way supplied. However, one might safely counter-sink & glue a hall sensor in a door or window frame & embed a matching magnet in the edge of the door or window opposite the sensor. In order to trigger the sensor, a magnet's pole must be oriented parallel to the sensor's face.
In the following posts, I discuss how we can use a Hall Effect switch in place of a reed switch or a tilt switch or ?? to detect whether something is opened or closed.
I used this Omnipolar Switch, Hall Effect Sensor. The minimum supply voltage for this version of the sensor is 2.5V which works well with a 3.3 volt Arduino compatible that protects an attached RFM69 radio from 5 volt damage.
Identifying the sensor's pins: Looking at the black head of the Hall Effect Senor, the slightly smaller face that has a writing on it is the top face and the other slightly larger side is the bottom face. Place the Hall Effect Sensor so that the bottom face is against the table and the top face is up. Looking down at the top face with the pins facing towards you, the first pin (on the left) is Positive (+), the middle pin is the Ground (-) and the pin on the right is the Data Output.
Sensing Garage Door Open or Closed with Hall Switch Sensor
A Hall Effect Switch can replace the reed switch (connected to Arduino D6) in this post.
Schematic for garage door position detection:
<< Forum members (free registration), click on pic for larger view.
Note: the sensor's digital output needs to be "pulled up" to a definite ON (rather than float), i.e. be connected to 3.3 volt power via a resistor. The choose_nodes sketch handles that.
With the latest choose_nodes program sketch, the Hall Effect Switch may be used with #define SWITCH1 (Arduino D5) or #define SWITCH2 (Arduino D6) or #define SWITCH3 (Arduino D7). Although on a Moteino or Miniwireless, D5 has a reserved purpose. Find more help at posts starting here.
To detect a mail box (or other) door being open or closed, a Hall Effect Switch (& magnet) can replace the tilt switch (connected to Arduino D6) in this post.
Wiring diagram for mail box node or other node on battery using a sleeping Arduino:
To use a sleeping Arduino which awakes by a triggered Hall Effect Switch, use #define MAIL or #define SWITCHIRQ (D3). The #defines activate code that will wake the sleeping Arduino (to send the pin state) whenever the D3 pin changes state (ON or OFF).
Starting here, (except ignoring posts about the DIY Arduino), use the same sketch, customizing, & OpenHAB configurations. Posts there were updated to be compatible with OpenHAB 2.5.0.M1, MQTT 2.xx Binding, & the Embedded MQTT message broker.