Help using Arduino to read from RFID Reader

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!!

Are you powering the board with something like 12 volts?
Are the microchip and your antenna using the same frequency?
Paul

You are reading the rest of the tag without ever knowing if it has been received. It may still be coming over the serial line. That is why the serial available gives you the number of characters that have been received so far. You need to take care to not get ahead of what is being placed in the receive buffer.
Paul

Hi Paul - I'm using 5v to power the RFID reader and the arduino is currently plugged into my pc for power.

I'm not sure how to interpret when the data i'm receiving is data I want to read or not... Do you have any suggestions? Thank you!

Try using the higher voltages, as the documentation suggests, up to 15 volts. Remember, the controller must power the microchip so it can transmit.
Paul

Here's the power supply I bought for the RFID: https://www.amazon.com/gp/product/B08JYPMCZY/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1

Do you suggest just connecting a 9v to power it? Do you think that will resolve the issue of the data being read?

It's not my suggestion. Read the documentation: Power input +5.5 to 15 V DC. Try a 12 volt power supply. As I wrote, you need enough power to remotely power the microchip.
Paul

Do you have a suggested power supply to use to connect to the RFID reader?

Yes, I have several such supplies. Find one in your part of the country.
Paul

Hi Paul - I'm not sure how to find a 15v power supply to connect to this. The power supply I own seems to only support 3.3V/5V, so it sounds like I need to possibly buy something else to connect to my RFID reader, but I'm not sure what product would be the best. I was wondering was products you would recommend for me to use that would be easy to integrate with my reader? Thank you so much.

Try Google or Ebay.
Paul

Hi Paul - I'm unsure why you're being so short with me, when you chose to respond to my ask for help. Obviously I'm not sure what to be searching for, can you provide me some more details? I have only found 3.3/5V DC (the one I own) and am not certain how to connect to 15v or what type of dc to search for. Thanks.

I guess I am short with you because you do not take the time to learn any of the fundamentals of electricity or even terminology, but you want to use complex devices and software, anyway.
I just searched Google for "12 volt power supply" and "12 volt adapter" and found quite a few. Same for search on Ebay.
Paul

Thanks for being so polite to a newbie who is trying to learn. Everybody has to start somewhere. If you think I need more understanding of fundamentals or terminology, there's a better way to say that than being short and rude with someone.

Something like this

https://www.mouser.com/datasheet/2/670/smm12_usb-1957568.pdf

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.