Hi Vaclav, sorry i actually did not see the second part of your first post, i will try anything that gets put forward to me.
But what i have just done to the code really simplified things so that the help i get can be narrowed down.
I have stripped the code back to what you see below, when i plug into the USB in my laptop the project will work with no issues, but as soon as i power with a battery it only lasts for 30 seconds then stops responding to RFID cards being scanned.
Now for the power i have tried just regular batteries in the DC input (this lasts for about 10 seconds), i have also tried to power via the USB port (this lasts for 30 seconds)
When you say above try and add some serial prints - if i add serial prints i need to plug the USB into my laptop to see them, but when i do this the program runs fine.
#define passPin 13
#define failPin 12
Serial1.begin(9600); // RFID
pinMode(passPin, OUTPUT); // Connected to Green on tri-color LED to indicate user is valid
byte val = 0; // Temp variable to hold the current byte
if (Serial1.available() > 0) // If the serial port is available and sending data...
if ((val = Serial1.read()) == 2) // First Byte should be 2, STX byte
delay(500); // wait for a second