SparkFun Forums 

Where electronics enthusiasts find answers.

User avatar
By briar3296
#204936
I'm trying to use four ID-3LA RFID readers on one Arduino Mega. I'm using small, glass RFID tags (kind of what are inserted for pet identification). I'm using pins 52 & 52 for Rx4, Tx4 (software serial) as well as the other built-in serial ports. I made antennas by hand. Each antenna and reader works very well stand alone. However, once I try hooking up more than two readers to my Arduino the antennas become very insensitive and can't pick up anything even when they previously were very responsive. Right now I have them all connected in parallel on one breadboard. I had trouble finding the 5V current, so is it possible that there isn't enough current to power all four? I don't think it's an interference problem. Please help! Thanks!
User avatar
By TS-Mark
#204999
Hi briar3296,

Depending on how you are powering the Mega, you should have plenty of current available on the 5V pin. Are you powering the Mega via USB or the barrel jack? If you are using USB, do you know what version of USB your port is? Older versions can only source 500mA but USB 3/SS can source up to 900mA. If you are powering it from the barrel jack, what are the specifications of your power supply? When you have more than 2 ID-3LA's connected, do you notice the Mega resetting or browning out? If you measure the voltage to the three ID-3LA's, is it sitting at 5V or drooping below that?

If it looks like you have enough power for the circuit, it might be interference. Try setting up the ID-3LA's a small distance away from each other and see if that helps at all. Start with something like 6" and slowly increase it from there.

If you still cannot nail down what is causing the issue, let us know and we can troubleshoot further. We may be able to set up a similar circuit here to test.
User avatar
By briar3296
#205007
Hi Mark,

I'm using the USB since I need to read serial outputs.
It looks like I have USB 3.0.

I'm not sure what you mean by resetting or browning out. It does have issues though. Sometimes when I click upload it says it's trying but it never finishes. Other times when it has been plugged in for a while (let's say half an hour to an hour), and I go to upload, it claims that the board isn't connected and can't upload even though it previously could and is still connected. However, this happens even with two ID-3LDA's. I'm not sure if this counts as resetting or browning out.

I really don't think it's interference. I have at least 8in between any of the antenna.

Sometimes two work really well, and then I'll unpower it, change the pins, and suddenly one of them won't work at all. I had three working (one on a different power source) working great, but I tried to add the fourth and suddenly only one of them would work.

Thank you for your help.
User avatar
By TS-Mark
#205012
Interesting. It sounds like the Mega might be locking up or getting stuck in a weird state because of a power drop. I would guess it is a power issue since you have plenty of processing power on a Mega for testing 3 RFID readers. Which pin are you using to provide power to the ID-3LA's? Since you're powering via USB, if you have not tried yet, power them from the Vin pin since that will be at 5V. See if that helps the issue at all.
User avatar
By briar3296
#205051
I've included three pictures on the upload problems. I have been using the 5V pin. I tried the Vin pin and ended up still having issues both uploading and with the ID-3LA reading the tags. It's boggling me why sometimes 2-3 work flawlessly and other times, one works, I add the other, and then only one works.

Additionally, I ran into another issue where only some of my glass capsules (also Sparkfun) are being read. Do you know why this might be?
You do not have the required permissions to view the files attached to this post.
User avatar
By TS-Mark
#205117
What UARTs are you using with the RFID readers? You mention using pins for software serial but also the other UARTS on the board. Are you by chance using the HW UART for the Mega's communication between it and the computer? That might be the issue your screenshots are showing since it is saying the COM port is busy or inaccessible.

As for the glass capsules, do the ones that are not being read work at all or do they appear to be completely dead? The read range on those is going to be quite small so do they not work even with the tag essentially pressed against the reader/antenna?
User avatar
By briar3296
#205145
I'm using TX1/RX1 etc. (pins 14-19). I'm not sure what you mean by "HW UART".

Edit: They can be picked up by the ID-20LA, so they're not dead.
I have pressed them against the antenna, and there's still nothing. The ones that will read can be read an inch away.
User avatar
By TS-Mark
#205234
Sorry for the confusion. HW UART/Hardware UART would be on pins D0 and D1. Those pins are tied directly to the USB-to-Serial so if you have something connected to them it can cause issues uploading or you can create issues with a serial device connected to those pins.

As far as uploading issues, I'm not sure we can help with that since it usually is going to be a problem with the code but I am not familiar with the errors in the screenshots you provided on your previous post. While we cannot help debug custom code, if you can copy your code into your response, we could try compiling/uploading it to an Arduino Mega here and see if we can replicate the issue. That might help us identify the problem.

Lastly, just to confirm the issue with the glass capsule tags, you have an ID-20LA that can read them but the ID-3LA cannot, correct? It may be a problem with the design of your antennas. The datasheet for the ID-3LA mentions specific dimensions for reading glass capsule tags so you may need to play around with the design for your antenna to get them to read properly.
User avatar
By briar3296
#205252
Ah, I see. I haven't been using those pins.

That's right about the ID-20LA/ID-3LA. I saw how datasheet says the coils should be less than 10x10cm, and mine have an inner diameter of ~5cm. It just doesn't make sense to me why half of the tags will read but half won't.
I'm considering just switching to using ID-20LAs because they have the built in antenna. Do you know how close they can get to each other before interference becomes a problem? From fiddling with the one they seem to be pretty directional and only read when the tag is right in front of the square surface and not to the side.

Here's my code:
Edited by moderator to add code tags.
Code: Select all
  #include <SoftwareSerial.h>
  SoftwareSerial rfid2 = SoftwareSerial(50,51); // Rx, Tx

// change position and/or tag values as necessary (case sensitive)
  int posim = 1; // initial a position
  int posif = 3; // initial b position
  String pirate = "002FBE72C023"; //a tag
  String ninja = "002FBE7355B7"; // b tag 

  String msg1; // Output from antenna 1
  String msg2; // Output from antenna 2
  long rt = 0; // seconds elapsed

void setup() {
  Serial.begin(9600);
  rfid2.begin(9600); // Begin software serial port
  Serial1.begin(9600); // Begin hardware serial port 1 (pins 18,19)

// initial positions
  Serial.print(ninja);
  Serial.print(" ");
  Serial.print(posim);
  Serial.print(" ");
  Serial.println(rt);

  Serial.print(pirate); 
  Serial.print(" ");
  Serial.print(posif);
  Serial.print(" ");
  Serial.println(rt);

}

void loop() {

  while(Serial1.available()>0) {
    msg1 += char(Serial1.read());
    delay(1);
  }
  while(rfid2.available()>0){
    msg2 += char(rfid2.read());
    delay(1);
  }
// parses serial input to get only the tag
  if(msg1.length() >= 13) {
     msg1=msg1.substring(1,13);
      Serial.print(msg1);
      Serial.print(",");
      Serial.print("ONE");
      Serial.print(",");
      Serial.print(rt);
      Serial.println(";");
  } 
// parses serial input to get only the tag
  if(msg2.length() >= 13) {
     msg2=msg2.substring(1,13);
     Serial.print(msg2);
     Serial.print(",");
     Serial.print("TWO");
     Serial.print(",");
     Serial.print(rt);
     Serial.println(";");
  }
  delay(10); // delay needed to avoid resetting too early

// Directionality logic
// ninja
  if (posim == 1 && msg1 == ninja){
    posim = 2; 
    Serial.print(msg1);
    Serial.print(" ");
    Serial.print(posim);
    Serial.print(" ");
    Serial.println(rt);
    msg1 = "";
  }
  if(posim == 2 && msg1 == ninja){
    posim = 1; 
    Serial.print(msg1);
    Serial.print(" ");
    Serial.print(posim);
    Serial.print(" ");
    Serial.println(rt);
    msg1 = "";
  }
  if(posim <= 2 && msg2 == ninja){ 
    posim = 3; 
    Serial.print(msg2);
    Serial.print(" ");
    Serial.print(posim);
    Serial.print(" ");
    Serial.println(rt);
    msg2 = "";
  }
  if(posim == 3 && msg2 == ninja){ 
    posim = 4;
    Serial.print(msg2);
    Serial.print(" ");
    Serial.print(posim);
    Serial.print(" ");
    Serial.println(rt);
    msg2 = "";
  }
  if(posim >= 3 && msg1 == ninja){
    posim = 1;
    Serial.print(msg1);
    Serial.print(" ");
    Serial.print(posim);
    Serial.print(" ");
    Serial.println(rt);
    msg1 = "";
  } 
  if(posim == 4 && msg2 == ninja){ 
    posim = 3; 
    Serial.print(msg2);
    Serial.print(" ");
    Serial.print(posim);
    Serial.print(" ");
    Serial.println(rt);
    msg2 = "";
  }

// pirate 
  if (posif == 1 && msg1 == pirate){
    posif = 2;
    Serial.print(msg1);
    Serial.print(" ");
    Serial.print(posif);
    Serial.print(" ");
    Serial.println(rt);
    msg1 = "";
  }
  if(posif == 2 && msg1 == pirate){
    posif = 1;
    Serial.print(msg1);
    Serial.print(" ");
    Serial.print(posif);
    Serial.print(" ");
    Serial.println(rt);
    msg1 = "";
  }
  if(posif <= 2 && msg2 == pirate){
    posif = 3;
    Serial.print(msg2);
    Serial.print(" ");
    Serial.print(posif);
    Serial.print(" ");
    Serial.println(rt);
    msg2 = "";
  }
  if(posif == 3 && msg2 == pirate){
    posif = 4;
    Serial.print(msg2);
    Serial.print(" ");
    Serial.print(posif);
    Serial.print(" ");
    Serial.println(rt);
    msg2 = "";
  }
  if(posif >=3 && msg1 == pirate){
    posif = 1;
    Serial.print(msg1);
    Serial.print(" ");
    Serial.print(posif);
    Serial.print(" ");
    Serial.println(rt);
    msg1 = "";
  }
  if(posif == 4 && msg2 == pirate){
    posif = 3;
    Serial.print(msg2);
    Serial.print(" ");
    Serial.print(posif);
    Serial.print(" ");
    Serial.println(rt);
    msg2 = "";
  }
}
User avatar
By Santa_Impersonator
#205281
Is there a chance that you are sharing all the hardware connections for the serial communication from the RFID reader on a single pin, I only saw one instance of SoftwareSerial? Your implementation of the data parsing could also be causing issues if the microcontroller is off by a single character.

Otherwise, have you double checked your code to make sure you initializing the serial connections properly on pins 14-19?
User avatar
By TS-Mark
#205371
After looking at your code, the issue may be that you are not initializing the serial port for the third RFID reader. You initialize Serial, Serial1 and the SoftwareSerial port but not, say, Serial2 on pins 17 and 16. That might be what is causing the issue here when you add the third RFID reader since you need to keep Serial available for the Mega to talk to the computer via USB.

As for interference between antennas, I'm afraid I do not have a good answer for that since we have only really tested these on their own. The "Designing Coils for the ID-3LA" section of the datasheet would be the best source of information about that. It might just be a matter of trial and error to figure out an ideal spacing for the three readers in your circuit.
User avatar
By briar3296
#205522
Thanks for the help!
I ended up just purchasing four ID-20LAs; for what I need, they work really well and all on one Mega.
For the code I posted I only needed two serial ports. When I need four I have been initializing them.
User avatar
By TS-Mark
#205525
Thanks for the update! That's strange the ID-3LA's were giving you so much trouble with more than 2 of them on a single Mega. I don't know enough about RFID interference to say for certain, but my guess is the external antennas were somehow the culprit here. Probably RF interference voodoo or something. Regardless, I'm glad to hear you've got everything up and can move forward with your project.

Let us know if you have any other questions or issues with these RFID readers or any of our products and we would be happy to help as much as we can.