Skip to content
ActuatorsSolenoid

12V Electric Solenoid Door Lock

Fail-secure solenoid lock for DIY access-control projects.

Wiring & code for

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

  1. Confirm the exact part number and breakout-board revision.
  2. Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
  3. Check controller pin assignments and bus address or interface mode against the example code.
  4. Power up with external loads disconnected, then test signals before full integration.
  5. 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.

Board Integration

Library

None — built-in digitalWrite by —

No library needed; driven via a relay or MOSFET, not directly from a pin.

Wiring

Component pinArduino Uno pinNote
Relay IND8Triggers a relay module; the relay switches the 12V solenoid circuit.
Relay VCC / GND5V / GNDPowers 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 →

C++
  • 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.
View full Arduino Uno guide