

The 12V solenoid lock is an electromechanical device designed to provide secure access control. It operates by using a solenoid to control the locking mechanism, which is activated when a 12V DC power supply is applied. This component is widely used in applications such as electronic door locks, vending machines, lockers, and other automated security systems. Its compact design and reliable operation make it a popular choice for projects requiring controlled access.








The 12V solenoid lock typically has two wires for connection:
| Wire Color | Description |
|---|---|
| Red | Positive terminal (+12V DC) |
| Black | Negative terminal (Ground) |
Below is an example of how to control a 12V solenoid lock using an Arduino UNO and a relay module.
// Example code to control a 12V solenoid lock using Arduino UNO
// The solenoid lock is connected to a relay module controlled by pin D7.
const int relayPin = 7; // Define the pin connected to the relay module
void setup() {
pinMode(relayPin, OUTPUT); // Set the relay pin as an output
digitalWrite(relayPin, LOW); // Ensure the relay is off initially
}
void loop() {
// Activate the solenoid lock
digitalWrite(relayPin, HIGH); // Turn on the relay
delay(5000); // Keep the lock activated for 5 seconds
// Deactivate the solenoid lock
digitalWrite(relayPin, LOW); // Turn off the relay
delay(5000); // Wait for 5 seconds before reactivating
}
The solenoid lock does not activate:
The solenoid lock gets hot:
The Arduino resets when activating the solenoid:
By following this documentation, you can effectively integrate and troubleshoot a 12V solenoid lock in your projects.