DIGITALbeginner

Reed Switch

A glass reed switch on a TinkerBlock board: two blades that a magnet pulls shut, from either pole, with no power needed to sense. It sits between VCC and SIGNAL with a 10 kΩ pull-down, so a magnet reads HIGH, and a red LED lights while it is closed. It draws nothing while open, and VCC must be your board's logic voltage.

Comes in this kit — not sold separately

Specifications

TypeMagnetic reed switch, normally open, with a pull-down and an indicator LED. A magnet reads HIGH
SwitchMKA-14103 reed switch: two blades in a sealed glass tube, Ø2.3 × 14 mm, leads soldered 18 mm apart. Either pole closes it
SensitivityCloses at 15 to 18 AT (ampere-turns), sorted; lets go when the field falls to 35 to 90 % of that. The distance depends on your magnet
SpeedCloses within 1 ms and opens within 0.4 ms, bounce included; rated for up to 100 operations a second
LifeUp to 100 million operations at a light load, by the maker's rating; fewer at heavy loads. This board switches under 4 mA
SIGNALThe switch's other end, with a 10 kΩ pull-down to GND. Open: 0 V, LOW. Closed: VCC, HIGH. Read it with INPUT, not INPUT_PULLUP
SupplyYour board's logic voltage on VCC: 3V3 on an ESP32, ESP32-S3 or Pico, 5V on an Uno. A closed switch puts VCC straight on the pin
Current0 mA while open: VCC reaches only the switch. Closed, about 1.6 mA at 3.3 V and 3.5 mA at 5 V, from VCC, none from your pin
IndicatorRed LED and 1 kΩ on SIGNAL: lit while the switch is closed, fed through it. Not a power light
Pins to wire3 of the 4: GND, VCC and SIGNAL. NC is connected to nothing on the board
Header4-pin right-angle male, 2.54 mm pitch: GND, VCC, NC, SIGNAL, with GND on the square pad
Board22.4 × 30.4 mm, two 4.8 mm mounting holes 16 mm apart. The front prints ACTIVE HIGH, the back MAGNETIC ACTIVATION
In the box1 × TK41 block. It also ships inside the TinkerBlock kits

What it does

It tells your board whether a magnet is near. The glass tube across the top is a reed switch: two thin blades sealed inside, their tips overlapping with a gap between them. A magnet nearby turns each blade into a magnet of its own, the tips pull together, and the switch closes. Take the magnet away and they spring apart.

Drag to turn it
The TK41. The reed switch is the glass tube under the logo. Turn it over for the back.

On this board the switch joins VCC to SIGNAL. A 10 kΩ holds SIGNAL LOW while it is open, so a magnet reads HIGH, as ACTIVE HIGH on the front says. A red LED on SIGNAL lights while the switch is closed, fed through it. With no magnet, VCC reaches nothing but one blade, and the block draws no current.

The page this replaces called the resistor a pull-up (it is a pull-down), offered either supply as though it suited any board, and said a wheel sensor would wear one out. The maker rates the type for up to 100 million operations at a light load.

Two things to know before wiring

  • VCC is your board's logic voltage. A closed switch puts VCC straight on your pin: 3V3 on an ESP32, an ESP32-S3 or a Pico, 5V on an Uno.
  • Read it with INPUT. The pull-down is on the board. INPUT_PULLUP fights it, and on an Uno can leave the open level where the pin does not promise to read LOW.

Wiring, in four lines

  1. GND to your board's GND.
  2. VCC to 3V3 on an ESP32, ESP32-S3 or Pico; 5V on an Uno.
  3. SIGNAL to GPIO 4 on an ESP32-S3, GPIO 25 on an ESP32, D2 on an Uno, GP15 on a Pico.
  4. NC to nothing: it is connected to nothing on the board.

Then pinMode(pin, INPUT), and digitalRead(pin) is HIGH while a magnet holds the switch closed.

Where to start

The handbook below is nine 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 counts adds debouncing and timing.

For how it works, read two blades in glass and closes near, opens far. If it will not switch, when it does not switch.

When it doesn’t work

Which way round does the magnet go?
Either pole closes it: a magnet turns both blades into magnets with opposite poles at their tips, and turning it over swaps both. Lay it along the glass tube; a magnet pointed straight at the middle of the tube can fail to close it.
How far away does a magnet work?
It depends on the magnet, not the switch: the switch closes at a field of 15 to 18 ampere-turns, and a stronger magnet makes that farther away. Hold yours to the glass and pull it away while watching the LED. It lets go farther out than it closed, by up to about 40 %.
Should VCC go to 3V3 or 5V?
To your board's logic voltage: 3V3 on an ESP32, ESP32-S3 or Pico, 5V on an Uno. A closed switch joins SIGNAL straight to VCC, so 5 V on VCC is 5 V on a 3.3 V pin.
It counts two or three times for one magnet.
The contacts bounce as they meet, for well under a millisecond. Count a change only once SIGNAL has held it for about 20 ms; the handbook's door counter does exactly that.
Can I count wheel turns with it?
For slow things, yes: it is rated for up to 100 operations a second and, at a light load, up to 100 million operations. That suits a bicycle wheel, a rain gauge or a door. For a motor shaft, use a Hall sensor such as the TK18, which has no contacts to bounce or wear.
Does it need power?
The switch does not: a magnet closes it on its own. The board draws nothing while it is open and about 1.6 mA at 3.3 V while it is closed, for the pull-down and the LED. So mount it where the resting state is open if it runs on a battery.

The reed switch handbook

9 articles · about 40 minutes

This page is the reference: what the part is, what it is made of, and the questions people arrive already asking. The handbook is the walk — the same part in the order somebody actually meets it.

The board

2 articles

Four pins of which three are wired, a glass reed switch between VCC and SIGNAL, a 10 kΩ that holds SIGNAL LOW while it is open, and a light that shows it closed.

How it works

3 articles

Two blades that a magnet turns into magnets of their own, a pull-down that makes it active high, and why VCC has to be your board's logic voltage.

Reading it

2 articles

Three wires, digitalRead, and the gap between where it closes and where it lets go.

Using it

2 articles

A door sensor that counts, debounced, and the short list of reasons it does not switch.

Edit this page — content/modules/reed-switch.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

Reed Switch

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →