RFID RC522 Reader & Chromium Web Page

Raspberry Pi Asked on December 5, 2020

I’m having a bit of difficulty locating a specific example, however I have found people referencing that they have accomplished what I am looking for.

At a basic level, I have a webpage being served through Chromium and I have my RC522 RFID module. What I’d like to do is be able to scan an RFID card and to submit the ID of the RFID either through an AJAX script or pull the ID into an input field.

I’m fine with the web side and the page itself, but I am still learning Raspberry Pi, and this is a bit beyond what the little DIY books discuss haha.

There are cases like these where they pull the RFID through Python:

And then there is a case like this one where I get close, but it doesn’t seem to quite get there:

If anyone can give me any leads or suggestions, I’d greatly appreciate it. Our little museum is trying to update ourselves for grants and some things are doable and others are a stretch.

Thank you so very much –


My issue is the connection of the two. I’m in new territory here and not sure how I would pass the data from the RFID reader to the Chromium browser. If I use the basics through this python GIT – – and use the file through the console, I can easily pull the ID from the RFID chip/card. But I’m not sure how I’d be using the script in the background and passing the RFID ID to the Chromium browser.

I’ve continued to browse around the internet and found that some people have suggested using node.js instead to pass the data from the RFID Card and Reader to the Chromium browser.

I’m open to any suggestions, some of these posts I’m sifting through are older and I’m not sure if one suggestion is better off than the other for recent updates of Raspberry Pi and its operating system. Even the python I mentioned above, which is widely used, states that their haven’t been any large overhauls to the code and at some point, might become unusable as Raspberry Pi progresses.

One Answer

We achieved this using php.

using python to load the site with ?id=(your id variable).

then in the php using $_GET['id'].

Edit as requested:


import RPi.GPIO as GPIO
import SimpleMFRC522
import time
import urllib
import pygame
reader = SimpleMFRC522.SimpleMFRC522()

while True:

            id, text =
            url =("{}&card_value={}".format(id,text))
        print (url)
        while == True:



$card_id = $_GET['card_id'];
$card_value = $_GET['card_value'];
$time_out = date('Y-m-d ', time());
include ($_SERVER['DOCUMENT_ROOT']."/_includes/pdo_intranet.php");

try {
        $sql = "INSERT INTO `rfid` (`card_id`, `card_value`) VALUES ('".$card_id."', '".$card_value."')";
        $pallet = $conn->query($sql);
catch(PDOException $e) {
    echo "DB ERROR: " . $e->getMessage();


Ignore some of our weird variable names, I hope this can help point you in the right direction.

This stores the id and name into a database, i suppose you can then use ajax to do what you want.

Answered by Carl Piper on December 5, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP