Freetronics RFID Door Lock Shield and Priority 1 RFIDREAD-mRW-125

Control electric door locks and strike plates using your Arduino and an RFID module. Serial interface for an external RFID reader, and a switched output for door strike control. [Product page]
dukman83
Posts: 17
Joined: Fri Jun 19, 2015 4:16 am

Re: Freetronics RFID Door Lock Shield and Priority 1 RFIDREAD-mRW-125

Post by dukman83 » Tue Oct 27, 2015 12:12 am

Hi Angus,

Thank you for getting back to me.

I've used the existing code and replaced the loop with the one you provided to look like this:
#include <SoftwareSerial.h>

#define rxPin 10
#define txPin 11

// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

void setup() {
// define pin modes for tx, rx:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}

void loop()
{
if (mySerial.available())
{
Serial.write('*');
Serial.write(mySerial.read());
}
if (Serial.available())
{
mySerial.write(Serial.read());
}
}

I'm still not getting anything with software serial, but am on hardware serial pins.
I've tried it on another Ethrten and it's the same. I've confirmed that both the Ethertens also receive an input, by seeing the yellow light flash with each strike of the enter/send key on the console.

Thanks again,

Alex

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Freetronics RFID Door Lock Shield and Priority 1 RFIDREAD-mRW-125

Post by angusgr » Wed Oct 28, 2015 4:54 am

Hi Alex,

I can't explain that then, sorry. :(

Angus

dukman83
Posts: 17
Joined: Fri Jun 19, 2015 4:16 am

Re: Freetronics RFID Door Lock Shield and Priority 1 RFIDREAD-mRW-125

Post by dukman83 » Sat Oct 31, 2015 11:35 pm

Hi Angus,

Oh really..? damn.. hmm.. that's really got me stumped.

Thanks for all your help anyways, I really appreciate it!

Alex

dukman83
Posts: 17
Joined: Fri Jun 19, 2015 4:16 am

Re: Freetronics RFID Door Lock Shield and Priority 1 RFIDREAD-mRW-125

Post by dukman83 » Wed Dec 02, 2015 2:11 am

Hi guys,

Just wanted to let you guys know that I've decided to go ahead and manufacture the board despite the fact that softwareserial didn't work for whatever reason and was going to just use the hardware serial pins.

After assembling the board and doing an initial test, the results were more than promising - in fact, it all worked first go! :)

I've then decided to have another crack at seeing why the softwareserial approach didn't work and have loaded the previously used code.

The added
"if (rfid.available())
{
Serial.write(rfid.read());
}"
snippet had indicated that the reader is in fact working using the softwareserial approach, however, the read isn't completely correct. In fact, it's quite confusing...

The hardware serial read had correctly read in the whole tag value, as previously mentioned - the whole 10 hex digits worth.
The softwareserial read had only read parts of the tag id, and does not do so consistently.
It will randomly print the values of the tag.
For example:
Say the tag ID is 0123456789 - the first read might be something like 02345789, the next would be 01008, then 010078 etc.
The read length and numbers are not consistent, but they are always a part of the tag id.

Hardware serial always reads consistently and I'm totally lost as to why it's doing that.

I've also had a look at the code explanation in the Practical Arduino book for an explanation on some of the code, but wasn't able to ascertain clarity in some things such as where the stop byte is located in the tag value, why does the val need to equal to 2 (line 117 on https://github.com/practicalarduino/RFI ... Single.pde) - to name a few, though, I feel that they are not relevant at this point.

I've put a simple debug print statement just below the header check line (117) and have noticed that it never enters that statement.

Does anyone have any ideas as to why the softwareserial approach would be so inconsistent and unreliable?

Many thanks,

Alex

Update... After further testing, I have found the issue to be within the "if ((val = rfid.read()) == 2)" block - softwareserial seems to print the correct tag ID, provided that whole block is commented out...

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest