Overview
The P20/15 is a 12V DC holding electromagnet: energize its two leads and the flat 20 mm face grips ferrous metal with up to 3 kg (about 30 N) of force; cut the power and it lets go. That energize-to-hold behavior makes it a clean building block for cabinet locks, door latches, parts pick-and-place, robot end effectors, drop mechanisms, and magnetic fixtures.
It is a two-wire inductive load. You switch it with a relay, transistor, or logic-level MOSFET from an Arduino, ESP32, Pico, or Raspberry Pi — never directly from a GPIO pin — and you always give the coil a flyback diode so its stored energy has somewhere safe to go at turn-off. The wiring section covers both.
At a Glance
Specifications
| Parameter | Value |
| Model | P20/15 holding electromagnet (sucker type) |
| Rated Voltage | 12V DC |
| Holding Force | Up to 3 kg / ~30 N on flat, clean mild steel |
| Typical Power | ~2-3 W (~0.2-0.25 A at 12V) |
| Dimensions | 20 mm diameter x 15 mm tall |
| Mounting | Threaded hole/stud on rear face |
| Duty | Continuous operation supported; coil warms in normal use |
| Load Type | Inductive — flyback diode required with electronic switching |
| Polarity | Not polarity-sensitive for holding operation |
Wiring & Driving Guide
Two wires: one to switched +12V, one to ground. The microcontroller only ever drives the switch:
| Connection | Goes To |
|---|---|
| Magnet lead 1 | +12V supply |
| Magnet lead 2 | MOSFET drain (or relay COM/NO contact) |
| MOSFET source / relay coil GND | Supply GND, shared with microcontroller GND |
| MOSFET gate (via ~220R) | GPIO pin (logic-level MOSFET, e.g. IRLZ44N / 2N7000 for this small load) |
| Flyback diode (1N4007) | Across the magnet leads — cathode (stripe) to +12V side |
Code Examples
Arduino: timed hold and release
// P20/15 electromagnet via logic-level MOSFET on D5
// 12V supply for the magnet, grounds shared with the Arduino.
// Flyback diode across the magnet leads is mandatory.
const int MAGNET_PIN = 5;
void setup() {
pinMode(MAGNET_PIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
Serial.println("Magnet ON - holding");
digitalWrite(MAGNET_PIN, HIGH);
delay(5000); // hold for 5 s
Serial.println("Magnet OFF - released");
digitalWrite(MAGNET_PIN, LOW);
delay(3000); // released for 3 s
}
Pico (MicroPython): button-controlled lock
# Simple electromagnetic lock: hold while button is NOT pressed.
# MOSFET gate -> GP16, button between GP14 and GND.
from machine import Pin
import time
magnet = Pin(16, Pin.OUT)
button = Pin(14, Pin.IN, Pin.PULL_UP)
magnet.value(1) # locked at boot
print("Locked")
while True:
if button.value() == 0: # button pressed -> release
magnet.value(0)
print("Released")
time.sleep(3) # stay open 3 s
magnet.value(1)
print("Locked")
time.sleep(0.05)