akash614
Posts: 41
Joined: Tue Dec 05, 2017 2:48 am

Client-Server RFID System with RPI and ESP8266

Sun May 19, 2019 1:33 pm

Hi Guys i made a Raspberry Pi based RFID Attendance System of connecting all MFRC522 LED LCD Relay to RPI and it works very well but i want to make a bunch of these connected to main server

Reference Code for attendance System : https://github.com/danjperron/MFRC522-python

but i cant add a raspberry pi to each system if there are more than 10 so i got this idea of having ESP8266 connected to Relay LCD and MFRC522 and this Esp8266 is connected to raspberry pi throught wifi but

how do i write new code for raspberry pi and Esp8266 to Communicate with SQL database to authenticate or not

simple is how do i make Single Server and Multiple Client system connected to one SQL Database on Raspberry Pi

Andyroo
Posts: 2834
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Client-Server RFID System with RPI and ESP8266

Sun May 19, 2019 3:19 pm

Two possible ways:

1) When you define the server in SQL you could point this to the Pi via IP address or name. You need to set the SQL server to allow connections from the network though.

2) Use MQTT to pass messages between the units. Put the broker on the SQL server and create a simple subscription program that takes the ID tag, checks if it is valid or not and publishes a valid or illegal card message back.
Need Pi spray - these things are breeding in my house...

akash614
Posts: 41
Joined: Tue Dec 05, 2017 2:48 am

Re: Client-Server RFID System with RPI and ESP8266

Sun May 19, 2019 3:53 pm

Andyroo wrote:
Sun May 19, 2019 3:19 pm
Two possible ways:

1) When you define the server in SQL you could point this to the Pi via IP address or name. You need to set the SQL server to allow connections from the network though.

2) Use MQTT to pass messages between the units. Put the broker on the SQL server and create a simple subscription program that takes the ID tag, checks if it is valid or not and publishes a valid or illegal card message back.
2nd looks OK to work but i have many stages like expired, unknown, accepted, invalid.

how do i make everyone one of this possible and i would like to modify just some code in it so that the remaining is on esp8266 and both work together like rfid and relay code is in ESP8266 and the validity checking authenticating in the rpi so

how do i do this any help in the code for this would be nice

the modified code is based from https://github.com/danjperron/MFRC522-python

please it would be great help

PhatFil
Posts: 1189
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Client-Server RFID System with RPI and ESP8266

Sun May 19, 2019 6:35 pm

If your looking for a roadmap for your project? I would suggest looking at Mqtt and hosting a broker on your Pi to facilitate communication to and from your esp8266 devices.


For your esp8266 devices you can take advantage of the arduino platform and its esp8266 support. Arduino Libraries for h/w interfacing are Very well documented And are bundled with a clear example sketch (program) describing its use.
So Most projects can be started by cutting large blocks of example sketch code into a new project and changing the variable names.

Or you could use one of the esp firmware system projects like tasmota If it supports the rfid h/w ? it does support some https://github.com/arendst/Sonoff-Tasmo ... nd-RDM6300 and you can always request for additional h/w suport to be added, it is how the project has grown..

Using Mqtt to handle the coms all your connected devices need do is publish the sensor output, and your current system just needs to subscribe to the relevant topics to receive the esp output.

akash614
Posts: 41
Joined: Tue Dec 05, 2017 2:48 am

Re: Client-Server RFID System with RPI and ESP8266

Sun May 19, 2019 6:51 pm

PhatFil wrote:
Sun May 19, 2019 6:35 pm
If your looking for a roadmap for your project? I would suggest looking at Mqtt and hosting a broker on your Pi to facilitate communication to and from your esp8266 devices.
Using Mqtt to handle the coms all your connected devices need do is publish the sensor output, and your current system just needs to subscribe to the relevant topics to receive the esp output.
This is a nice idea i can connect multiple clients to one server as i am new to this and never did ESP8266 programming can you please help me out in setting one of these projects

would there be any mistake in communication if it is send from reader 1 the signal goes to reader 2 would there be any problems like this

anyways it would be great help from you guys to simply set up

all i want to convert is the link for code i provided is to be in client and server state so server side is to send a signal after receiving the rfid UID and want the Esp8266 to send data of UID to raspberry pi and authenticate

help would be very needful in this project

PhatFil
Posts: 1189
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Client-Server RFID System with RPI and ESP8266

Sun May 19, 2019 8:22 pm

akash614 wrote:
Sun May 19, 2019 6:51 pm

This is a nice idea i can connect multiple clients to one server as i am new to this and never did ESP8266 programming can you please help me out in setting one of these projects
To go arduino ide programming route, Perhaps look at this lib to read the rfid h/w
https://github.com/Jorgen-VikingGod/ESP8266-MFRC522
and for connecting to a wifi network to publish a Mqtt Topic/payload message perhaps this lib will provide you with the code snippets and explaination needed.. https://github.com/256dpi/arduino-mqtt

If the arduino and its ide are new to you? youtube has lots of great tutorials and its a system designed for kids to learn so there are LOTS of online resources and help..


I would start with getting the example sketch for the rfid h/w talking to the h/w, and then add in the code from the mqtt example to connect to the wifi and publish the reading...

To use tasmota or another firmware project flash and configure, though rfid h/w support is limited, you may be able to simply publish the raw output from a connected spi device? but thats beyond my own experience with the f/w
https://github.com/arendst/Sonoff-Tasmota/wiki iirc the feature to output raw sensor data is the 'serial bridge'
The precompiled firmware solution may involve a little more reading but should be the fastest route..
would there be any mistake in communication if it is send from reader 1 the signal goes to reader 2 would there be any problems like this
Read up on mqtt and consider how you format the topics and payloads you publish as a good design will eliminate such concerns perhaps publish using a topic like "RFID/ESP-001/" with a payload of raw data or a decoded state.
anyways it would be great help from you guys to simply set up

all i want to convert is the link for code i provided is to be in client and server state so server side is to send a signal after receiving the rfid UID and want the Esp8266 to send data of UID to raspberry pi and authenticate

help would be very needful in this project
You wont find folk to 'do your homework' for you in here but will find lots of help if you hit a stumbling block while working it out for yourself or need a pointer..

akash614
Posts: 41
Joined: Tue Dec 05, 2017 2:48 am

Re: Client-Server RFID System with RPI and ESP8266

Mon May 20, 2019 6:24 am

PhatFil wrote:
Sun May 19, 2019 8:22 pm
akash614 wrote:
Sun May 19, 2019 6:51 pm

This is a nice idea i can connect multiple clients to one server as i am new to this and never did ESP8266 programming can you please help me out in setting one of these projects
To go arduino ide programming route, Perhaps look at this lib to read the rfid h/w
https://github.com/Jorgen-VikingGod/ESP8266-MFRC522
and for connecting to a wifi network to publish a Mqtt Topic/payload message perhaps this lib will provide you with the code snippets and explaination needed.. https://github.com/256dpi/arduino-mqtt

If the arduino and its ide are new to you? youtube has lots of great tutorials and its a system designed for kids to learn so there are LOTS of online resources and help..


I would start with getting the example sketch for the rfid h/w talking to the h/w, and then add in the code from the mqtt example to connect to the wifi and publish the reading...

To use tasmota or another firmware project flash and configure, though rfid h/w support is limited, you may be able to simply publish the raw output from a connected spi device? but thats beyond my own experience with the f/w
https://github.com/arendst/Sonoff-Tasmota/wiki iirc the feature to output raw sensor data is the 'serial bridge'
The precompiled firmware solution may involve a little more reading but should be the fastest route..
would there be any mistake in communication if it is send from reader 1 the signal goes to reader 2 would there be any problems like this
Read up on mqtt and consider how you format the topics and payloads you publish as a good design will eliminate such concerns perhaps publish using a topic like "RFID/ESP-001/" with a payload of raw data or a decoded state.
anyways it would be great help from you guys to simply set up

all i want to convert is the link for code i provided is to be in client and server state so server side is to send a signal after receiving the rfid UID and want the Esp8266 to send data of UID to raspberry pi and authenticate

help would be very needful in this project
You wont find folk to 'do your homework' for you in here but will find lots of help if you hit a stumbling block while working it out for yourself or need a pointer..
i guess i got the idea i just have to modify code by removing rfid and replacing it with receive data from esp8266 and send data back to authenticate

Return to “Other projects”