1. Two Ways to Detect a Magnet
A magnet approaching a sensor can be detected in two fundamentally different ways: by using the magnetic field to physically move something, or by measuring the electrical effect of the field on a semiconductor. The first approach gives us the reed switch; the second gives us the Hall effect sensor. Neither is universally superior — they solve the same problem by different means, and the better choice depends on how fast, how often, and in what environment you need to detect that field.
2. How Reed Switches Work Physically
A reed switch consists of two thin ferromagnetic metal reeds — typically a nickel-iron alloy — sealed inside a small glass capsule filled with inert gas. The reeds overlap slightly at their tips but are separated by a tiny air gap. Under no magnetic influence, the reeds hold their natural positions and the switch is open (or closed, depending on the variant).
When a permanent magnet comes close enough, its field magnetises both reeds, inducing opposite poles at their tips. The attractive force between the opposing poles deflects one or both reeds until they make contact, closing the circuit. Remove the magnet, and the reeds’ mechanical spring tension pulls them apart again.
The MC-38 magnetic door sensor packages this reed switch in a practical plastic housing with a matching magnet — the sensor mounts on the door frame, the magnet on the door itself. When the door closes, the magnet aligns with the reed switch and closes (or opens) the circuit. When the door opens, the magnet moves away and the switch returns to its resting state.
Key physical properties of reed switches:
- The contacts are fully enclosed in glass and inert gas, so they do not oxidise over time.
- The switching action is inherently mechanical — contact bounce occurs on every transition.
- No power is consumed in the open or closed state; power only flows through the circuit when the switch closes.
- The glass capsule is fragile — excessive shock, vibration, or bending stress on the leads can crack it.
- Most reed switches are rated for 10–100 million switching cycles, depending on load current.
3. How Hall Effect Sensors Work (Solid-State)
The Hall effect is a quantum mechanical phenomenon first described by Edwin Hall in 1879. When a current-carrying conductor is placed in a perpendicular magnetic field, the field exerts a force (the Lorentz force) on the moving charge carriers, deflecting them toward one edge of the conductor. This charge separation creates a measurable voltage — the Hall voltage — perpendicular to both the current and the magnetic field.
In a Hall effect sensor IC, a thin semiconductor layer carries a known current. The Hall voltage produced by an external magnetic field is amplified and fed into a comparator circuit. When the field exceeds a threshold, the comparator switches the output — typically an open-collector NPN transistor — from high to low (or vice versa for latching variants). The entire process is electronic; nothing moves.
The A3144 Hall effect sensor is a unipolar switch — it activates in response to a south magnetic pole of sufficient strength
and deactivates when that field is removed. Its open-collector output pulls low when activated,
requiring a pull-up resistor on the output pin (most Arduino input pins have internal pull-ups
you can enable with INPUT_PULLUP). It operates from 4.5–24 V, making it
compatible with both 5 V Arduino systems and higher-voltage industrial inputs.
Key properties of Hall effect sensors:
- No moving parts — infinite theoretical mechanical lifespan.
- No contact bounce — the output transitions are clean.
- Requires a supply voltage (and therefore draws standby current) at all times.
- Can respond to fields in the microsecond range — vastly faster than a reed switch.
- Available in unipolar (activates on one pole), bipolar (latches on one pole, releases on opposite), and omnipolar (activates on either pole) variants.
- Sensitive to the polarity and orientation of the magnet — the south pole must face the branded face of the A3144.
4. Comparison Table
| Property | Reed Switch (MC-38) | Hall Effect Sensor (A3144) |
|---|---|---|
| Operating principle | Mechanical contact | Semiconductor (solid-state) |
| Moving parts | Yes — ferromagnetic reeds | No |
| Response time | ~0.5–2 ms (mechanical) | <1 µs (electronic) |
| Contact bounce | Yes — debouncing required | No — clean transitions |
| Standby power | Zero (passive component) | ~4–9 mA continuous |
| Mechanical lifespan | 10–100 million cycles | Unlimited (no wear) |
| Magnet polarity sensitivity | Works with either pole | Typically pole-specific (south for A3144) |
| Shock and vibration | Fragile (glass capsule) | Robust (solid-state) |
| External circuitry needed | Pull-up resistor only | Pull-up resistor + decoupling capacitor |
| Typical cost | Very low | Low |
| Suitable for high-frequency sensing | No (mechanical limits) | Yes (>10 kHz) |
5. When to Choose a Reed Switch
Door and Window Security Sensors
The reed switch is the dominant technology in home and commercial security systems for a reason. A door or window is opened and closed perhaps 50–100 times per day — well within the reed switch’s mechanical lifespan. The switch draws zero standby current, which is critical in battery-powered alarm sensors that must operate for months or years on a single cell. The MC-38’s normally-closed configuration is a deliberate safety design: the circuit is closed (and therefore monitored) when the door is shut. A broken wire or failed sensor opens the circuit the same way an open door does — so faults are detected automatically rather than silently ignored.
Low-Power and Battery Applications
If your circuit needs to run on battery for extended periods and events are infrequent, a reed switch is the right choice. The Hall effect sensor draws continuous current simply by being powered on. A reed switch in a low-power design can be wired to wake a sleeping microcontroller via an interrupt pin — the switch itself consumes nothing until the magnet activates it.
Simple Position Sensing Where Speed Is Not Critical
Lid-open detection on a box, drawer-closed sensing, float switches in tanks — applications where the magnet moves slowly and infrequently suit the reed switch perfectly. The 0.5–2 ms response time is more than adequate for anything a human hand is actuating.
6. When to Choose a Hall Effect Sensor
Speed Sensing and Tachometers
Measuring the rotation speed of a motor shaft, wheel, or fan blade requires detecting rapid magnetic pulses — potentially thousands per minute. A small magnet attached to the rotating part passes the sensor on every revolution. At 3,000 RPM with a single magnet, the sensor must detect 50 events per second. The A3144 handles this trivially; a reed switch’s mechanical inertia and bounce would cause missed and false counts at even moderate speeds.
Flow Meters
Turbine-type flow meters use a small impeller with embedded magnets that rotate in proportion to flow rate. Accurately counting those pulses at high flow rates requires a sensor that can detect rapid transitions without bouncing — exactly what the Hall effect sensor provides.
High-Vibration Environments
In automotive, industrial, or outdoor applications where the sensor is subject to continuous vibration, the reed switch’s glass capsule is a liability. Vibration can cause false triggering as the reeds rattle, and shock can shatter the capsule entirely. The A3144’s solid-state construction is impervious to mechanical stress.
When Clean Transitions Matter
In any application where each pulse must be counted accurately — encoder signals, step counting, event logging — the Hall sensor’s bounce-free output avoids the multiple counts per event that a reed switch can produce without debouncing. Even with software debouncing, a reed switch can occasionally produce spurious counts in electrically noisy environments.
7. Wiring and Code Examples for Both
Reed Switch with Arduino
Wiring is minimal: connect one lead of the reed switch to an Arduino digital pin and the other to GND. Enable the internal pull-up resistor in firmware. When the switch opens, the pin reads HIGH; when it closes, the pin is pulled to GND and reads LOW.
const int REED_PIN = 2;
bool lastState = HIGH;
void setup() {
pinMode(REED_PIN, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
bool currentState = digitalRead(REED_PIN);
if (currentState != lastState) {
delay(20); // Simple debounce — wait for bounce to settle
currentState = digitalRead(REED_PIN);
if (currentState != lastState) {
lastState = currentState;
if (currentState == LOW) {
Serial.println("Magnet detected — circuit closed.");
} else {
Serial.println("Magnet removed — circuit open.");
}
}
}
}
The 20 ms delay() debounce is adequate for a slow-moving door sensor. For
interrupt-driven designs or where delay() is unacceptable, replace with a millis()-based debounce that records the time of the first edge and ignores
further transitions for 20 ms afterward.
Hall Effect Sensor (A3144) with Arduino
The A3144 has three pins: VCC (4.5–24 V), GND, and OUTPUT (open-collector). Connect VCC to Arduino 5 V, GND to GND, and OUTPUT to a digital input pin. Enable the internal pull-up or add a 10 kΩ pull-up resistor externally. Place a 100 nF decoupling capacitor between VCC and GND as close to the sensor as possible — it suppresses supply noise that can cause false triggers. Orient the sensor so its branded (flat) face points toward the south pole of your magnet.
const int HALL_PIN = 3;
void setup() {
pinMode(HALL_PIN, INPUT_PULLUP);
Serial.begin(9600);
// Attach interrupt for high-speed applications
attachInterrupt(digitalPinToInterrupt(HALL_PIN), onMagnetChange, CHANGE);
}
void loop() {
// Main loop free for other tasks
}
void onMagnetChange() {
if (digitalRead(HALL_PIN) == LOW) {
Serial.println("Magnet present.");
} else {
Serial.println("Magnet absent.");
}
}
For speed sensing, count interrupt triggers over a fixed time window and calculate RPM:
volatile unsigned long pulseCount = 0;
unsigned long lastTime = 0;
void setup() {
pinMode(3, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(3), countPulse, FALLING);
Serial.begin(9600);
}
void countPulse() {
pulseCount++;
}
void loop() {
unsigned long now = millis();
if (now - lastTime >= 1000) { // Calculate every second
unsigned long count = pulseCount;
pulseCount = 0;
lastTime = now;
// RPM = pulses per second × 60 (assuming 1 magnet per revolution)
Serial.print("RPM: ");
Serial.println(count * 60);
}
}
8. Closing Decision Guide
The choice between a reed switch and a Hall effect sensor comes down to four questions:
- How fast does the magnet move? If events happen more than a few times per second, use the Hall effect sensor. If events are human-speed (doors, drawers, floats), either works — but the reed switch is simpler.
- How important is battery life? For battery-powered, low-event applications, the reed switch’s zero standby current is a compelling advantage. A Hall sensor drawing 6 mA continuously will drain a 2,500 mAh cell in under 18 days of standby.
- Is the environment high vibration? Automotive, industrial, or outdoor applications with mechanical shock favour the Hall sensor’s rugged solid-state construction.
- Does bounce matter? If you are counting events and every count must be accurate, the Hall sensor’s clean output is the safer choice. If you are detecting a simple open/closed state, debouncing a reed switch is straightforward and adds no meaningful complexity.
For most home automation and security projects — door sensors, window contacts, cabinet monitoring — the reed switch wins on simplicity, cost, and zero standby power. For anything involving rotation, speed, flow, or high-frequency magnetic detection, the Hall effect sensor is the right tool. Both are inexpensive, both are widely supported in Arduino libraries, and having a stock of each in your components drawer covers the vast majority of magnetic sensing applications you will ever encounter.
