TK18DIGITALbeginner

Hall Effect Sensor

An omnipolar Hall switch on a TinkerBlock board: bring either pole of a magnet near and SIGNAL goes LOW and a red light comes on. No contact to wear out, it works through plastic, and it looks at the field every 22 ms, so it is made for doors, lids and slow wheels.

Comes in this kit — not sold separately

Specifications

TypeOmnipolar Hall effect switch, active low: a magnet reads LOW, no magnet reads HIGH
SensorCrossChip CC6201 in TSOT-23-3, at the top left of the board. Micropower, non-latching
ThresholdSwitches LOW at 40 G of either pole, back HIGH below 32 G (typical values, 8 G of hysteresis)
ResponseLooks at the field once every 22 ms (typical), so SIGNAL changes up to 22 ms late and a magnet in range for less than that can be missed
OutputPush-pull, with a 10 kΩ pull-up to VCC on the board. No magnet, SIGNAL is at VCC; a magnet, near 0 V
IndicatorRed LED with a 1 kΩ resistor from VCC to SIGNAL. Lights while a magnet is near, about 3 mA from 5 V
Supply3.3 V or 5 V on VCC (the chip runs from 2 to 5 V, 5.5 V absolute maximum). SIGNAL sits at VCC with no magnet, so use 3V3 beside an ESP32, ESP32-S3 or Pico and 5V beside an Uno
CurrentAbout 5 µA average with no magnet; about 3.5 mA from 5 V while a magnet holds the LED on
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
In the box1 × TK18 block, no magnet. It also ships inside the TinkerBlock kits

What it is

A Hall effect chip that switches when a magnet comes near, a 10 kΩ pull-up, and a red LED that lights while it does. No magnet, SIGNAL sits at VCC and your board reads HIGH. Bring either pole of a magnet to the chip and it pulls SIGNAL LOW, and your board reads LOW. The front of the board says ACTIVE LOW; the back says OUTPUTS LOW VOLTAGE WHEN MAGNETIC FIELD DETECTED.

The TK18 at an angle: a black board with a wide gold border, a small brown capacitor and a three-legged black chip at the near top-left corner, two small resistors below them, a tiny LED in the middle, a large gold magnet-and-lightning icon at the top right, two big mounting holes, lonely binary along the left edge, a boxed ACTIVE LOW along the right, and a right-angle header whose four pins point out past the bottom edge.
The TK18. The sensing chip is the small three-legged part at the top left.

Nothing touches and nothing wears out, and a magnetic field passes straight through plastic, wood and glass. That is why door and lid sensors are built this way. The chip is a CrossChip CC6201, which responds to either pole, lets go when the magnet leaves, and saves power by looking at the field only once every 22 ms or so. That last part decides what it is for: a door or a lid that stays put for seconds, not a magnet flicking past on a fast wheel.

The page this replaces said it responds to one pole only, might latch, and reads HIGH for a magnet. All three were wrong.

VCC is the voltage your pin sees

With no magnet near, the chip drives SIGNAL up to VCC, so whatever is on VCC is what your pin sits at most of the time:

Your boardVCC toNo magnetMagnetLED
Arduino Uno5V5 V, HIGHnear 0 V, LOWabout 3 mA, bright
ESP32, ESP32-S3, Pico3V33.3 V, HIGHnear 0 V, LOWabout 1.3 mA, a little dimmer

Never 5V beside a 3.3 V board. The LED currents are worked out from its datasheet's forward voltage rather than measured.

Which pin is which

Parts up, header at the bottom, reading left to right:

GNDto your board's GNDthe square pad: count from here
VCCto 3V3 or 5Vyour board's logic voltage
NCnothingnot connected on the board
SIGNALto a digital inputLOW while a magnet is near

The back prints TK18 HALL EFFECT SENSOR instead of pin names. Turned over, the square pad is on the right, and it is still GND.

Wiring, in three lines

  1. GND to your board's GND.
  2. VCC to 5V on an Uno, 3V3 on an ESP32, ESP32-S3 or Pico.
  3. SIGNAL to a digital pin: D2 on an Uno, GPIO 25 on an ESP32, GPIO 4 on an ESP32-S3, GP15 on a Pico.

Leave NC unconnected. Set the pin to INPUT: the chip drives SIGNAL both ways and the pull-up is already on the board.

Example

// The GPIO number SIGNAL is wired to.
// Uno: 2. ESP32: 25. ESP32-S3: 4. Pico: 15.
const int HALL_PIN = 4;

void setup() {
  Serial.begin(115200);
  pinMode(HALL_PIN, INPUT);   // the chip drives SIGNAL both ways
}

void loop() {
  if (digitalRead(HALL_PIN) == LOW) {   // active low: LOW is a magnet
    Serial.println("magnet");
  } else {
    Serial.println("no magnet");
  }
  delay(200);
}

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.

If nothing happens when the magnet comes near, how far a magnet reaches is usually the answer. For a door or a lid, a door alarm is the project; for a wheel, read once every 22 ms first.

And before plugging it into an ESP32, VCC sets the level is the one page that protects the board.

When it doesn’t work

Does it read HIGH or LOW when a magnet is near?
LOW. The chip pulls SIGNAL to ground when it sees a magnet and lets it go back to VCC when the magnet leaves, and the red LED lights while it is LOW. The front of the board says ACTIVE LOW. Sketches that treat HIGH as the magnet, including the one this page used to show, get it backwards.
Which pole do I need?
Either. The CC6201 is omnipolar: a north pole and a south pole both switch it at about 40 gauss. What matters is where and how you hold the magnet: over the small chip at the top left, a flat face towards it. The gold magnet printed at the top right is only a picture.
Does it latch?
No. It is a switch: take the magnet away and SIGNAL goes back HIGH once the field falls below about 32 gauss. The gap between 40 and 32 is hysteresis, which stops a magnet at the edge of range from making the output flicker.
How close does the magnet have to be?
Closer than most people expect. Worked out from the magnet's field rather than measured, a 10 × 3 mm neodymium disc switches it from about 20 mm and a 5 × 2 mm disc from about 11 mm, face on and on axis. A flat fridge magnet may have to touch the board. No magnet is included.
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. With no magnet near, SIGNAL sits at VCC, so 5V on VCC puts 5 V on a 3.3 V pin for as long as the magnet is away.
Can I use it to measure a motor's speed?
Only a slow one. The chip looks at the field once every 22 ms or so, and a magnet that is in range for less than that can pass unseen. A wheel turning a few hundred times a minute is fine; a fan or a motor shaft is not.

The Hall effect sensor handbook

10 articles · about 50 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.

What is on the board

2 articles

Four pins of which three are wired, a three-legged chip at the top left that does the sensing, and the rule that protects your board: VCC is the voltage SIGNAL sits at whenever no magnet is near.

How a magnet becomes LOW

2 articles

What the chip measures, why either pole works, why a magnet at the edge does not make it flicker, and the red light that comes on when the output goes LOW.

Reading it

2 articles

Three wires and a sketch that prints what the pin says, then how close a magnet has to come before it prints anything else.

Once every 22 ms

2 articles

The chip looks at the field about 45 times a second and sleeps in between. What that misses, and how fast a wheel can turn before it starts missing turns.

Using it

2 articles

A door that has been left open, and the short list of reasons a magnet does nothing.

Edit this page — content/modules/hall-effect-sensor.mdx

Community

Questions about this product

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

Ask a question ↗

Hall Effect Sensor

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