SkyeTek M10 RFID

Basically I’m trying to interface the M10 with the arduino I was wondering if anyone had more knowledge than I with RFID and arduino. I am using Software Serial to try and send messages to the reader so pin2 is RX and pin3 is TX. my problem is I’m having trouble sending those messages or determining what exactly im sending. I have the Tx and Rx crossed ground connected to ground and voltage to voltage. the hardware isn’t particularly the issue I was just curious if anyone could shed some light on the programming aspect.

Code :

#include <SoftwareSerial.h>

char Data = ‘0008002101010000F35E’;
char TagFail =‘00048101E7FC’;
char Val1;
char Val2;

const int LedPin = 13;

SoftwareSerial mySerial(2, 3); // RX, TX
SoftwareSerial OutPutSerial(5, 6 );

void setup()
{
pinMode(LedPin, OUTPUT);
Serial.begin(57600);

Serial.println(“Set”);

// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println(Data);

}

void loop()
{
if (mySerial.available())
Val1 = Serial.write(mySerial.read());
delay(500);
if (Serial.available())
Val2 = mySerial.write(Serial.read());
delay(500);

if(Val1==Data || Val2==Data)
{
digitalWrite(LedPin, HIGH);
delay(5000);

}

if(Val1==TagFail || Val2==TagFail)
{
digitalWrite(LedPin, HIGH);
delay(2000);
digitalWrite(LedPin, LOW);
delay(2000);
digitalWrite(LedPin, HIGH);
delay(2000);
digitalWrite(LedPin, LOW);
delay(2000);
}

else
{
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);
digitalWrite(LedPin, HIGH);
delay(200);
digitalWrite(LedPin, LOW);
delay(200);

}

}

Problem 1 : How can I read the data I receive/Send without interfering with the serial ports ?
Problem 2 : Do I need to specify the number of bytes that I am trying to receive/send through serial?
Problem 3 : Is there any specific code that I am missing or other fucntions I need to include for this to function properly?
Any help with software Serial is much appreciated I am confused on exactly how it works I’ve done the tutorials with 2 arduinos and watched videos but I still don’t quite get it.

if(Val1==Data || Val2==Data)

Val1 and Data are different addresses. They will never be equal. Nor will Val2 and Data.

The strcmp() function might interest you.

On the other hand, what Serial.write() returns is the number of bytes written, which is not a string.

Which single key did you press to generate this character? ‘0008002101010000F35E’

Looks more like a string to me, so it needs double quotes, and an array to hold it.

    if (mySerial.available())
    Val1 = Serial.write(mySerial.read());
    delay(500);
    if (Serial.available())
    Val2 = mySerial.write(Serial.read());
    delay(500);

Storing what you read might be a good idea. If all you do is print it, you can hardly expect to compare it later.

Problem 1 : How can I read the data I receive/Send without interfering with the serial ports ?

Blink an LED in a Morse code pattern? The only way to see what you read from the reader is to use the serial port, and that involves “interfering with the serial ports”.

Problem 2 : Do I need to specify the number of bytes that I am trying to receive/send through serial?

Depends on what you are sending. If it is an int or a single char, the length is defined. If it is a NULL terminated array of chars, the length is defined.

You can only read one byte at a time, so the length is pretty close to exactly 1, all the time, so it is not necessary to specify that.

Problem 3 : Is there any specific code that I am missing or other fucntions I need to include for this to function properly?

Yes, there is. But, fix the issues already defined. You need to do a bunch of research on the functions you are using, to understand what they do, and what they return.

Any help with software Serial is much appreciated I am confused on exactly how it works I’ve done the tutorials with 2 arduinos and watched videos but I still don’t quite get it.

It works exactly like Serial, except on different pins. Well, not exactly the same, but, for your purposes, its close enough.

Val1 and Data are different addresses. They will never be equal. Nor will Val2 and Data.

The strcmp() function might interest you.

On the other hand, what Serial.write() returns is the number of bytes written, which is not a string.

Which single key did you press to generate this character? '0008002101010000F35E'

Looks more like a string to me, so it needs double quotes, and an array to hold it.

First off thanks for replying. Secondly strcmp() is string compare yes? returns a 0 or 1 depending on the strings I will definitely look more into this. What I'm trying to do with '0008002101010000F35E' is send this data to the host because this serial data is the specific number that puts the reader into DetectTags mode. I tried to define it as a string first but it didn't work because I was trying to compare it to val1 and Val2 which are going to be characters. now I see what you mean with the array. So I'll need to do something like String Data[8] = {0,0,0,8,0,0,2,1} Can I send that to the reader using Serial Write? or will I have to use Serial print to transfer the data? .Will I also need to do this with Val 1 and Val2 to read each byte that is coming out of the Serial buffer?

Storing what you read might be a good idea. If all you do is print it, you can hardly expect to compare it later.

How can I go about doing this? is there like a .txt function with arduino I can save the output to?

So I'll need to do something like String Data[8] = {0,0,0,8,0,0,2,1}

No. No. No.

char Data[] = "0008002101010000F35E";

Can I send that to the reader using Serial Write? or will I have to use Serial print to transfer the data?

The results would be the same.

Will I also need to do this with Val 1 and Val2 to read each byte that is coming out of the Serial buffer?

Yes, except that you have to explicitly size them (put a value in the );

How can I go about doing this? is there like a .txt function with arduino I can save the output to?

No, but this topic comes up practically every day on the forum. One reference:

Ok. Thanks alot appreciate the help.