Power supply for 12v solenoid

Okay so i am making a project with a adafruit optical finger print sensor LCD I2C screen and a PIR sensor the idea is that when the PIR senses that someone walks into the room the LCD would ask for a finger print and etc. But I have a 12v door solnoid deadbolt and I need a power supply for it to work. I already have a 25v 4ah battery form a hover board. Any suggestions?Use code tags to format code for the forum

Schematic code here: it works BTW and I using a arduino nano

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

// LCD setup
LiquidCrystal_I2C lcd(0x27, 16, 2);

// PIR setup
const int pirPin = 5; // D5
bool motionDetected = false;

// Fingerprint setup
SoftwareSerial fingerSerial(2, 3); // RX, TX
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&fingerSerial);

void setup() {
// LCD
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("System Starting");

// PIR
pinMode(pirPin, INPUT);

// Fingerprint
finger.begin(57600);
if (finger.verifyPassword()) {
lcd.setCursor(0, 1);
lcd.print("FP Ready");
} else {
lcd.setCursor(0, 1);
lcd.print("FP Error");
while (true); // Halt if sensor not found
}

delay(2000);
lcd.clear();
}

void loop() {
motionDetected = digitalRead(pirPin);

if (motionDetected) {
lcd.setCursor(0, 0);
lcd.print("Motion Detected ");
lcd.setCursor(0, 1);
lcd.print("Scan Finger ");
delay(500);

bool accessGranted = false;

for (int i = 0; i < 5; i++) {
  lcd.setCursor(0, 1);
  lcd.print("Scanning...     ");

  int result = getFingerprintID();
  if (result != -1) {
    accessGranted = true;
    break;
  }
  delay(1000); // Wait 1 second between attempts
}

lcd.clear();
lcd.setCursor(0, 0);
if (accessGranted) {
  lcd.print("Access Granted ");
  delay(750);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Welcome back    ");
  lcd.setCursor(0,1);
  lcd.print("Eland, Unlocking") ;
} else {
  lcd.print("Access Denied  ");
  delay(600);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Identity        ");
  lcd.setCursor(0,1);
  lcd.print("Negative        ");
}

delay(3000);
lcd.clear();

}
}

// Fingerprint scan function
int getFingerprintID() {
finger.getImage();
if (finger.image2Tz() != FINGERPRINT_OK) return -1;
if (finger.fingerSearch() != FINGERPRINT_OK) return -1;
return finger.fingerID;
}

Rather than attempting to use a 25V supply to power a 12V solenoid and burning the solenoid out, I would suggest using a 12V supply of sufficient amperage to power your solenoid.

1 Like

Please edit your post to make use of the code tags.

1 Like

12V 8xAA battery holders are available, as are various NiMH or LiPo battery packs.

Are you attempting to run the microprocessor and the 12 volt lock from the same power source? Or separate power sources?

Assuming you are using separate power sources:

It is very common for manufacturers of various 12 volt and 24 volt access control accessories to provide a transformer that is rectified to make DC. This can be used assuming you are trying to run the lock off of mains AC power. Many solenoid and electromagnetic locks are wired to the transformer with a DC power lead going through a relay to turn the device off or on.

Often times, access control systems that are powered by AC mains electric are required to have battery back up. In which case you could just use a 12 volt battery for your lock.

Is this just a personal project? Depending on the physical size requirements or mounting configurations, jremington's battery pack may work well. Unless it will be used frequently, many times per day.

I build gates, entries, and railings for a living. I built a pedestrian gate one time with a solenoid lock. I do not remember the voltage requirements but I used rechargeable AA batteries that I mounted inside the gate frame. I kept the batteries charged with an appropriately sized solar panel (integrated into the gate) and charger (integrated into the gate). That was years ago and it still works, being used probably 30 times per day.

EDITED: Some of the solenoid locks can draw up to 2 amps when activated. Some of the dead bolt style door locks can draw up to 1 amp when activated. So design your power source and wiring appropriately.

Fail.

Please completely describe your dead bolt or give a link to it's information. Is your deadbolt spring loaded so you only use the 12 volts to pull the dead bolt? Or is your dead bolt also locked by the 12 volts, so the polarity change of the 12 volts determines lock or unlock?

Is your solenoid 25V or 12V?

where I'm putting the lock is right next to an outlet.

It is 12v

Yes, it is spring loaded so when the is no power applied, the lock is out, but when power is applied, it pulls it in.

So why are you using a 25V battery?

I have a spare of one of these:

Should I just get a 12v 1a power jack that plugs into the wall? eg.

Yes but buy one that is at least 2A
and one of these:

Is the lock going in the door or in the wall? Or do you know yet?

If you use the outlet right next to it and install the lock in the door you have to be aware that the wiring will flex every time the door is opened and closed. And may get pinched when the door gets closed.

You could install the lock in the wall and have it lock into the door. Plus all of your entry hardware would already be on the wall.

Or use the battery pack recommended or similar one and mount the lock in the door along with all of the other hardware.

I suppose, unless I missed reading it somewhere above, it could all be in a self-contained unit mounted into the wall.

See the wedge shape of the armature? That is an electric latch, not a dead bolt which is a solid bar all the way to the end. We had an electric latch on a basement door many years ago with a secret push button. Was a life saver!!!

Okay I just found out the my spare bread board power supply is input 12v and it steps it down to only 5v. So any other ideas? And preferably I would like it to be bread board compatible just to make it more simple. Thanks!

What is the solenoid’s current (Amps) or power (Watts)?

You are willing to make a solenoid door lock with a circuit built on breadboard?

No, you don’t wat to put 2A through a breadboard. Connect the 12V directly to the solenoid