This 12V Electromagnetic Solenoid Lock is a compact and secure locking mechanism ideal for DIY access control systems, smart lockers, vending machines, and other automation projects. When powered, the solenoid pulls the bolt in, unlocking the latch; when power is cut, a spring pushes it back to lock.
It features a 5mm stroke and operates reliably at 12V DC, drawing only 350mA, making it efficient for battery-powered or microcontroller-controlled systems.
Key Features
Electromagnetic solenoid lock with spring-loaded bolt
12V DC operating voltage, low power consumption (350mA)
5mm linear stroke for smooth locking/unlocking
Durable metal housing for long-lasting operation
Easy integration with Arduino, ESP32, Raspberry Pi, relays, etc.
Ideal for cabinets, lockers, access control, and vending mechanisms
Specifications
Parameter
Value
Operating Voltage
12V DC
Current Consumption
~350mA
Stroke Length
5mm
Operation Type
Pull-type (spring return)
Material
Metal body and plunger
Mounting
Pre-drilled mounting holes
Cable Length
~15–20cm
Applications
Smart locks, cabinets, drawers, automation
How It Works
Powered (ON): Lock bolt retracts
Unpowered (OFF): Spring pushes bolt back into locked position
Package Includes
1 × 12V DC Solenoid Lock (5mm stroke)
🔌
Pin Connections
1 Table
Pin Connections Table 1
Board
Sensor Pin
Connection
Solenoid
to switching transistor/relay
coil leads into a flyback-diode-protected switch, gated by a board digital pin
Electromagnet Solenoid Lock 5mm 12VDC 350mA - Raspberry Pi Pico
📄 File: electromagnet_solenoid_lock_5mm_12vdc_350ma_-_arduino_uno.inoArduino Uno
530 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Electromagnet Solenoid Lock 5mm 12VDC 350mA draws too much current for a GPIO pin directly - switch it through a flyback-diode-protected transistor or relay, gated by pin 7 on Arduino Uno.
5// Electromagnet Solenoid Lock 5mm 12VDC 350mA draws too much current for a GPIO pin directly - switch it through a flyback-diode-protected transistor or relay, gated by pin 7 on Arduino Nano.
6#define SOLENOID_PIN 7
7
8voidsetup() {
9Serial.begin(115200);
10pinMode(SOLENOID_PIN, OUTPUT);
11digitalWrite(SOLENOID_PIN, LOW);
12}
13
14voidloop() {
15digitalWrite(SOLENOID_PIN, HIGH); // energize
16delay(1000);
17digitalWrite(SOLENOID_PIN, LOW); // release
18delay(3000);
19}
📄 File: electromagnet_solenoid_lock_5mm_12vdc_350ma_-_arduino_mega.inoArduino Mega
531 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Electromagnet Solenoid Lock 5mm 12VDC 350mA draws too much current for a GPIO pin directly - switch it through a flyback-diode-protected transistor or relay, gated by pin 7 on Arduino Mega.
5// Electromagnet Solenoid Lock 5mm 12VDC 350mA draws too much current for a GPIO pin directly - switch it through a flyback-diode-protected transistor or relay, gated by pin 13 on ESP32.
5// Electromagnet Solenoid Lock 5mm 12VDC 350mA draws too much current for a GPIO pin directly - switch it through a flyback-diode-protected transistor or relay, gated by pin D3 on ESP8266.
5// Electromagnet Solenoid Lock 5mm 12VDC 350mA draws too much current for a GPIO pin directly - switch it through a flyback-diode-protected transistor or relay, gated by pin PB2 on STM32.
6#define SOLENOID_PIN PB2
7
8voidsetup() {
9Serial.begin(115200);
10pinMode(SOLENOID_PIN, OUTPUT);
11digitalWrite(SOLENOID_PIN, LOW);
12}
13
14voidloop() {
15digitalWrite(SOLENOID_PIN, HIGH); // energize
16delay(1000);
17digitalWrite(SOLENOID_PIN, LOW); // release
18delay(3000);
19}
📄 File: electromagnet_solenoid_lock_5mm_12vdc_350ma_-_raspberry_pi_pico.inoRaspberry Pi Pico
538 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Electromagnet Solenoid Lock 5mm 12VDC 350mA draws too much current for a GPIO pin directly - switch it through a flyback-diode-protected transistor or relay, gated by pin 17 on Raspberry Pi Pico.
6#define SOLENOID_PIN 17
7
8voidsetup() {
9Serial.begin(115200);
10pinMode(SOLENOID_PIN, OUTPUT);
11digitalWrite(SOLENOID_PIN, LOW);
12}
13
14voidloop() {
15digitalWrite(SOLENOID_PIN, HIGH); // energize
16delay(1000);
17digitalWrite(SOLENOID_PIN, LOW); // release
18delay(3000);
19}
Electromagnetic actuator - simple on/off (energize/release), switched through a transistor or relay, not PWM-speed-controlled like a motor.