RFID programming giving error

While I may be missing some critical thing here, Im not sure why you need the Tag to have “Name, ID, email and other info”. Keep in mind that the tags will have limited space and the more data you are reading off the tag, the long it will take to read/check and OK the user at the “tap” event.
e.g.

ntag213
	4 Byte pages
	user space page 4-39
	39-4 = 35 * 4 = 140 Bytes

Note: this is just one example, you would need to check you tags and ensure they work with the reader AND can hold all the data you want.

But this would not be normal for a connected system. (i.e. your talking about an SQL database)

If your readers are “online” then you only really need an unique ID, and the backend system would then hold all the other data in its sql database.
i.e. Key in user information, grab the next “blank” card, write the assigned UserID to the tag and protected it.

When a user taps on, the device reads the UserID from the tag via the reader, then sends that (e.g. over wifi) to a backend server. The server then would then check if the user is allowed and add an event record “user with id UserID tapped on at read X”.

Now you can run a report on the SQL to get a list of all tapped on users over a period of time and/or all the tap ons for 1 or more users.

While I may be wrong here, I would think that getting any micro controller to have a library to talk to an SQL database would be challenging, if anything maybe SQLite) but you still need the database stored somewhere for every ready to connect to; at which point its simpler to send the ID to a server and get a response, leaving the server to deal with the database/logging etc.

If the readers are offline and you will collect the records later, then write them to a CSV then just import that CSV into your database of choice.

edit: Looks like someone has been working on it.

But I am still not sure its the best way for many reasons.

2 Likes

Hi @Matthew126715

In another post I wrote some code for the Piicodev RFID module that would write to a .CSV file, it may be of use to you for getting an idea of what would be required, you will though need to adapt it for SQL.