Good evening everybody,
I have been working on an networked RFID access control system, but have an issue I absolutely cannot diagnose, after spending days on it.
First, let me describe the system.
The system contains an Arduino Uno, Ethernet shield (with Wiznet chip), an electronic strike (connected via a relay) and an EM-18 RFID reader module (and an RGB LED).
When a tag is scanned, the reader sends the tag number to the Arduino (at 57600 baud, using the AltSoftSerial library) and the Arduino sends a GET request to a server with the tag number as a paramater.
The server then looks up number in a database and then returns a value if it is accepted and triggers a relay to open an electronic strike (opening the door), or other values for different functions.
The average ‘response time’ from the tag number being received, to the door opening is around 300ms (without the server table lookup it’s around 160ms).
However, I have been having a major issue. After placing the Arduino close in an enclosure next to the strike’s transformer, the Arduino freezes for 30 seconds when trying to connect to the server after around 3 successful scans, at the following piece of code:
This happens forever after one ‘fail’. Pressing the Reset button solves the issue.
The first few scans are ALWAYS successful in receiving and processing the response. When the strike transformer is turned off, and scanning ~200 times in 20 minutes, there were no issues.
I then put the Arduino and transformer/relay module in separate boxes (50cm separation), and the only wires going between them are the power, ground and signal wire for the relay module (the module has a built in transistor). After turning on the transformer and letting the system work, all is well. After a few hours, the system gets into the same state as before, freezing when a tag is scanned.
I have connected the Arduino reset line to one of the I/O pins with a few components as mentioned in a hack somewhere, and have the Arduino reboot when it detects the 30 second freeze. When it reboots, all is well again, then after a couple of hours it freezes.
Scanning 100 times rapidly works fine, time seems to cause the problem.
I think the problem would now probably be with the code, or maybe in the Ethernet library itself.
I have commented every line and have attached the code to this post. If anyone would please be willing to help, I would GREATLY appreciate it. Thanks in advance for anyone willing to give me advice or knows how to fix the problem,
- Joseph Rautenbach.
RFID_125Khz_Install_final.ino (7.59 KB)