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;
}




