Title: "Optimizing Arduino Code for Faster RFID Tag Processing with PN5180 Reader"
Text: I am currently working on a project using an Arduino Nano board and a PN5180 reader to read RFID tags from boxes on a conveyor belt. The nature of the project requires fast and efficient reading and processing of the RFID tags. However, I am facing issues with the speed of the program, possibly due to the library used. I am currently using the Arduino ESP-32 library for PN5180-NFC, specifically the tueddy branch on GitHub by ATrappmann. While the program performs well when the RFID tags move at a slower pace on the conveyor belt, it struggles to keep up with the required speed, resulting in a significant number of failed reads.
This challenge is particularly pressing as I lack control over the conveyor belt speed, making it crucial to optimize the code for quicker and more reliable RFID tag processing. Before using the PN5180 reader, I was using the RC522 reader with a different library, and got it to 100% success rate in tag reads. However, I needed the PN5180 for extended range. If anyone in the community has experience with the Arduino or if you can provide guidance on improving the code's efficiency, I would greatly appreciate your insights.
You might just gain time by putting the Serial port in a higher gear if the receiving end can cope.
Serial.begin(500000); or even 1 million bits.
That gives more time to the tag-reader.
how long does it take to read a tag now? : I dont have a specific time on how long it takes, from tests I have done I noticed that the tags are actually being read but if its passing by too quick it wont have any output i also dont know the exact speed of the conveyor belt. how many tags pass each minute? : its like 1 tag every 5 to 10 minutes, its really just the speed of that one box every 5 - 10 minutes.
I have tried the code this way but for some reason if those lines are not in the loop, the program just stops reading after about 15 reads sometimes even less and I have to close it and open it up again to get it going again.
This is just telling the program to return if there is no card present. This helps the program faster because if there is no card present the program doesn't need to do nothing.
But I will try this method anyway to see what happens.
if there's nothing there it doesn't matter what it does or doesn't do. are you optimizing the case when there's no rfid detector instead of the case when there is
@robtillaart@gcjr I just wanted to thank you guys, just finished testing and had a 100% success on 50 reads!! I had spent in total over 25 hours trying to get this to work properly and finally its done.
All I had to do was increase the baud rate as rob had said and I removed the part which was checking is there was a card present like gcjr had said. So thank you both very much.