I´m running a raspberry pi4 as an attendance tool. The Pi itself is bored with the Tasks running on it which is basically a nodejs Server a Web Frontend aswell as a Postgres DB.
However if I start my Python Script to check constantly for RFID Tags the CPU rises to 30% usage with one core maxed out which leads to a Temperature increase.
Since all other tasks are basically a no brainer for the PI I was wondering if there is any way to throttle this process down or a better approach for the python script.
The script itself is absolutely basic but unfortunately needs to run in an endless loop like:
reader = SimpleMFRC522()
while true:
id, text = reader.read()
if(id):
...processData
I´m aware that 30% CPU usage is also pretty much nothing but since the PI does not have any FANs or Heatsinks on it I´ma little concerned about the Temperature in productive env.
Also, since this task does basically nothing but check for rfid tags and if found post data to a restapi, I´m feeling like it´sa waste on used performance overall.
Thanks!
If this is the library, it looks like it's a non-blocking read: https://github.com/pimylifeup/MFRC522-python/blob/52d5a6952c70c97a834593fc8092fa9d40c87a2e/mfrc522/SimpleMFRC522.py#L16
You want your read
call to block; sadly, the very... thin "simple" wrapper you're using explicitly does a non-blocking read. So, simply replace SimpleMFRC522
with an MFRC522
object and read blockingly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.