Hi there!
I recently bought this RFID reader from priority1design: https://www.priority1design.com.au/rfidrw-e-ttl.pdf
I connected it to my Arduino UNO and an external power supply (since eventually, it won't be getting power from my Arduino) and am trying to read a microchip with the coil...
Here's the code I'm running:
#include <SoftwareSerial.h>
#define rxPin 8
#define txPin 9
SoftwareSerial RFID(rxPin, txPin); //RX, TX
int newtag[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int data1 = 0;
unsigned long setime;
void setup(){
Serial.begin(9600); // start serial to PC
RFID.begin(9600); // start serial to Serial1 reader
delay(5000);
if (RFID.available() > 0){
Serial.println("OK SD2");
RFID.print(F("SD2"));
RFID.print(13);//crn->carriage return (en decimal 13: Serial1.write(13))0x0d
delay(500);
}
else
Serial.println("KO SD2");
if (RFID.available() > 0){
Serial.println("OK READ SD2");
Serial.println(RFID.read());
delay(500);
}
else
Serial.println("KO READ SD2");
if (RFID.available() > 0){
Serial.println("OK LTG");
RFID.print(F("LTG"));
RFID.print(13);//crn->carriage return (en decimal 13: Serial1.write(13))
delay(500);
}
else
Serial.println("KO LTG");
if (RFID.available() > 0){
Serial.println("OK READ LTG");
Serial.println(RFID.read());
delay(500);
}
else
Serial.println("KO READ LTG");
}
void loop(){
if (RFID.available() > 0){
Serial.println("OK RAT");
RFID.print(F("RAT"));
delay(500);
}
else
Serial.println("KO RAT");
if (RFID.available() > 0){
Serial.println("OK READ RAT");
for (int z = 0 ; z < 8 ; z++) // read the rest of the tag
{
data1 = RFID.read();
newtag[z] = data1;
Serial.print(data1);
Serial.print(" ");
}
Serial.println("");
RFID.flush(); // stops multiple reads
}
else
Serial.println("KO READ RAT");
delay(1000);
}
When I run this code, regardless if my microchip is near the coil or not, it prints out something like this:
16:52:53.212 -> OK RAT
16:52:53.726 -> OK READ RAT
16:52:53.726 -> 255 255 -1 -1 -1 -1 -1 -1
16:52:54.712 -> OK RAT
16:52:55.229 -> OK READ RAT
16:52:55.229 -> 255 -1 -1 -1 -1 -1 -1 -1
16:52:56.220 -> KO RAT
16:52:56.220 -> KO READ RAT
16:52:57.212 -> KO RAT
16:52:57.212 -> KO READ RAT
16:52:58.196 -> OK RAT
16:52:58.713 -> OK READ RAT
16:52:58.713 -> 255 255 255 -1 -1 -1 -1 -1
16:52:59.703 -> KO RAT
16:52:59.750 -> KO READ RAT
16:53:00.735 -> KO RAT
16:53:00.735 -> KO READ RAT
16:53:01.718 -> OK RAT
16:53:02.231 -> OK READ RAT
16:53:02.231 -> 255 255 -1 -1 -1 -1 -1 -1
When I move the microchip near the coil, it does the same thing and doesn't seem to detect anything... I'm really struggling to understand if I'm reading from this properly or how to use the serial commands from priority1Design (or if i should be ignoring them and strictly just using the serial.read()...)
Any advice would be appreciated, thank you SO much in advance!!