Solenoid
Controlling Solenoid Lock 12V with Arduino Uno
What is the Solenoid Lock 12V?
Solenoid Lock 12V practical reference
A 12V solenoid lock commonly paired with RFID readers or keypads in DIY smart-lock and access-control builds.
Key specifications
- Operating voltage: 12V DC
- Current draw: ~350-500 mA while energized
- Lock type: Fail-secure on most DIY-market units — locked when unpowered, unlocks only while energized
- Duty cycle: Not rated for continuous hold on most models — leaving it energized long-term can overheat the coil, check your specific datasheet
Pinout and connection notes
Same inductive-load rules as any solenoid: drive it through a relay or MOSFET with a flyback diode across the coil. Confirm fail-secure vs fail-safe behavior on your specific unit before it goes into a real door.
- +: Coil positive lead — through a relay or MOSFET, never straight from a GPIO pin
- -: Coil negative lead
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up Solenoid Lock 12V with Arduino Uno
Library
None — built-in digitalWrite by —
No library needed; driven via a relay or MOSFET, not directly from a pin.
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| Relay IN | D8 | Triggers a relay module; the relay switches the 12V solenoid circuit. |
| Relay VCC / GND | 5V / GND | Powers the relay's control side only. |
| Solenoid + / external 12V supply | — | Solenoid locks typically draw 400-500mA at 12V — far beyond any Arduino pin or the relay's logic side. |
Swipe sideways to see every column →
- These locks are meant to be energized only briefly to unlock — most models are not rated for continuous 12V holding current and will overheat if left energized for long periods; check your specific lock's duty-cycle rating.
- Always drive it through a relay module (or MOSFET) rated for 12V/1A+, with a flyback diode across the solenoid coil — never wire it directly to an Arduino pin.
- Fail-safe vs fail-secure matters for real installs: this wiring is fail-secure (stays locked on power loss). For fire-egress or fail-safe requirements, you need a different lock mechanism entirely — that's a code-compliance question, not just a wiring one.
Related Components
Active Buzzer
Self-oscillating buzzer that beeps with just a single HIGH signal — no PWM required.
BLDC ESC
High-speed brushless motor and electronic speed controller combo.
Continuous Servo
Modified servo that spins continuously like a geared motor.
Solenoid Valve 5V
Compact solenoid valve for automated watering and dosing.
Related Guides & Projects
Arduino Uno R4 Minima Pinout: Every GPIO, ADC, DAC, and Op-Amp Pin Explained
A complete Arduino Uno R4 Minima pinout reference — digital I/O, ADC, DAC, op-amp, CAN, dual UART, and exactly what it leaves out compared to the WiFi variant.
Mastering PWM on Arduino: Dimming LEDs and Controlling Motors
Understand what PWM actually is on Arduino, dim an LED smoothly, and safely control a DC motor's speed with a driver chip -- plus the mistakes (like wiring a motor straight to a pin) that damage boards.
4-Digit 7-Segment Counter with TM1637 & Arduino
Drive a TM1637-based 4-digit 7-segment display with Arduino Uno to show a real-time up/down counter, elapsed timer, and scrolling text. Covers library setup, brightness control, and custom segment mapping.
Arduino Uno R4 Minima vs WiFi: Which One Should You Choose?
Same processor, same memory, different price. Here's what the WiFi variant's extra hardware actually gets you, and when the Minima is the smarter buy.