Specifications
| Type | Magnetic reed switch, normally open, with a pull-down and an indicator LED. A magnet reads HIGH |
|---|---|
| Switch | MKA-14103 reed switch: two blades in a sealed glass tube, Ø2.3 × 14 mm, leads soldered 18 mm apart. Either pole closes it |
| Sensitivity | Closes 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 |
| Speed | Closes within 1 ms and opens within 0.4 ms, bounce included; rated for up to 100 operations a second |
| Life | Up to 100 million operations at a light load, by the maker's rating; fewer at heavy loads. This board switches under 4 mA |
| SIGNAL | The 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 |
| Supply | Your 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 |
| Current | 0 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 |
| Indicator | Red LED and 1 kΩ on SIGNAL: lit while the switch is closed, fed through it. Not a power light |
| 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, 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 MAGNETIC ACTIVATION |
| In the box | 1 × 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.
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_PULLUPfights it, and on an Uno can leave the open level where the pin does not promise to read LOW.
Wiring, in four lines
- GND to your board's GND.
- 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.
- 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.