Specifications
| Type | Door and window sensor interface: a screw terminal that puts a magnetic reed sensor between VCC and SIGNAL. A closed sensor (magnet near) reads HIGH |
|---|---|
| Terminal | KF301-5.0-2P screw terminal, two ways, 5.0 mm pitch. The sensor has no polarity: either wire under either screw |
| Pull-down | None on the board, and no pull-up. Set the pin to INPUT_PULLDOWN (Pin.PULL_DOWN in MicroPython), or fit 10 kΩ from SIGNAL to GND on a board with none, such as an Uno. ESP32 GPIO 34 to 39 have none either |
| Indicator | Red LED with 5.1 kΩ on SIGNAL: lit while the sensor is closed, dark while it is open. Not a power light |
| Supply | Your board's logic voltage on VCC: 3V3 on an ESP32, ESP32-S3 or Pico, 5V on an Uno. The header prints 3V3; VCC powers nothing, a closed sensor puts it on SIGNAL |
| Current | 0 mA while open. Closed, about 0.3 mA at 3.3 V and 1.1 mA at 5 V, the LED plus the pull-down (45 kΩ internal on an ESP32, 10 kΩ outside on an Uno); worked out, not measured |
| Pins to wire | 3 of the 4: GND, VCC and SIGNAL. NC is connected to nothing on the board |
| Header | 4-pin right-angle male, 2.54 mm pitch: GND, 3V3 (VCC), NC, SIGNAL, with GND on the square pad |
| Board | 22.4 × 30.4 mm, two 4.8 mm mounting holes 16 mm apart. The front prints ACTIVE HIGH, the back DETECT THE OPEN/CLOSED STATUS OF DOORS AND WINDOWS |
| In the box | The kit's listing gives 7 sensors with 7 interface modules (its photo shows 6): 3 plastic surface, 3 recessed, 1 metal housing, each with a magnet, and a Start Card |
What it does
It tells your board whether a magnetic door or window sensor is closed. The black block across the top is a two-way screw terminal: the sensor's two bare wires go under the screws, and the sensor, a switch that a magnet closes, sits between VCC and SIGNAL. Closed, SIGNAL is VCC and your pin reads HIGH. Open, SIGNAL is connected to nothing.
A red LED and a 5.1 kΩ on SIGNAL light while the sensor is closed. They are fed from SIGNAL, not from VCC, so the LED is not a power light: the product listing says it is, and it is not. VCC reaches only the terminal and the header, so with the sensor open the block draws no current.
Three things to know before wiring
- There is no pull-down. Nothing on the board gives SIGNAL a level while
the sensor is open. Set the pin to a pull-down in
setup():INPUT_PULLDOWN, orPin.PULL_DOWNin MicroPython. An Uno has no internal pull-down, so fit 10 kΩ from SIGNAL to GND. ESP32 GPIO 34 to 39 have none either. - VCC is your board's logic voltage. The header prints 3V3; that is a label, not a requirement. A closed sensor puts VCC on your pin: 3V3 on an ESP32, an ESP32-S3 or a Pico, 5V on an Uno.
- Do not use
INPUT_PULLUP. It pulls the open pin to the supply, and a closed sensor reads HIGH too.
Which sensor
The kit's listing gives three kinds, each a magnet and a reed switch. Sizes are the listing's, not measured.
| Sensor | In the box | Listing gives | Suits |
|---|---|---|---|
| Plastic, surface mount | 3 | 27 × 13 × 8 mm | doors and window frames |
| Hidden, recessed | 3 | no size | cabinets and wooden doors |
| Metal housing | 1 | 105 × 37 × 15 mm | gates and garage doors |
The board and the sketch are the same for all three.
Wiring, in four lines
- GND to your board's GND.
- 3V3 (VCC) to 3V3 on an ESP32, ESP32-S3 or Pico; 5V on an Uno.
- SIGNAL to GPIO 4 on an ESP32-S3, GPIO 25 on an ESP32, D2 on an Uno, GP15 on a Pico. On an Uno, add 10 kΩ from this pin to GND.
- NC to nothing: it is connected to nothing on the board.
The sensor's two wires go under the two screws, either way round. Then
pinMode(pin, INPUT_PULLDOWN), and digitalRead(pin) is HIGH while the
sensor is closed.
Where to start
The handbook below is ten short articles, each with a working figure. The first read is the whole build in three wires and a few lines, and a door that nags adds debouncing and a reminder when one stays open.
For why the board needs a pull-down, read no pull-down on the board. If it will not switch, when it does not switch.
When it doesn’t work
- Why does it read randomly when the door is open?
- The board has no pull-down, so with the sensor open SIGNAL is connected to nothing and floats. Set the pin to a pull-down in setup(): INPUT_PULLDOWN on an ESP32 or a Pico, Pin.PULL_DOWN in MicroPython. An Uno has none, so fit 10 kΩ from SIGNAL to GND.
- Is the red LED a power light?
- No, whatever the listing says. It hangs off SIGNAL through 5.1 kΩ and lights only while the sensor is closed. A powered, wired board with the door open is dark.
- The header says 3V3. Do I have to use 3.3 V?
- No. The pin is VCC and powers nothing; a closed sensor puts that level on SIGNAL, so it should be your board's logic voltage: 5V on an Uno, 3V3 on an ESP32, ESP32-S3 or Pico. An Uno reads 3.3 V as HIGH with 0.3 V to spare.
- Can I read it with INPUT_PULLUP?
- No. A pull-up pulls SIGNAL to the supply while the sensor is open, and a closed sensor puts VCC on it: both read HIGH and the two cannot be told apart. Use a pull-down.
- Does HIGH mean the door is open or shut?
- With the magnet on the door and the sensor on the frame, a shut door is closed and reads HIGH, per the listing. Some reed sensors are made the other way. Watch the LED as you move the magnet to check yours before you label anything.
- How far apart can the two halves be?
- The listing gives no distance and nobody has measured the sensors in this kit. It depends on the magnet and the sensor. Watch the LED as you move the halves apart, and mount them closer than where it goes out.