1
\$\begingroup\$

I am attempting to build a system which stays active when an RFID tag is present and then deactivates when it's removed.

RFID readers seem to have an output that fires once when the tag is in range and then doesn't run again until the tag is moved away then then rescanned.

My initial idea was to use a standard reader and then reset it forcing a new tag to come through each time. The ID-20 reader has a reset pin which I believe supports this.

I would prefer to use a cheaper reader for this project as I have quite a few to build so I am currently working with this device.

The cheaper reader doesn't have a reset pin so I was going to toggle the power to the reader when I wanted a new read. Sadly this didn't work as planned, this cheaper reader only seems to read when a tag is moving through the field.

Has anyone done anything like this before and can offer advice or would anyone know why the cheaper reader wouldn't work when the tag is static?

\$\endgroup\$

4 Answers 4

2
\$\begingroup\$

This is a reader firmware problem. Most access control readers default to emulating old-fashioned magstripe readers, so they only report once per "insertion" and mask the rest of their reads, as long as the tag is still visible.

Internally, the tag is constantly repeating its ID -- otherwise, the system would be much less reliable, since there would only be one chance to catch the message.

The "right" solution is to find a reader that's configurable for repeating reports, such as the Olimex MOD-RFID125, but I don't know if any meet your price point.

It's strange that the cheaper reader doesn't report a tag on powerup. It's possible that it has a sloppy RF powerup ramp, so the tag gets into a weird state because it didn't cleanly initialize. If you have an oscilloscope and a loop of wire, you can try to put it near the reader and tag to try observing the signal. You're working with a 125 kHz carrier, which should be slow enough for most scopes to capture.

\$\endgroup\$
1
\$\begingroup\$

The RFID tag you are using is most likely powered through electromagnetic induction. Therefore, the tag will only be powered when it is exposed to a varying magnetic field. In your case, the magnetic field is probably constant in time but varies in space. The RFID tag will be powered when it is moved through the spatially varying magnetic field.

When you turn on your reader, my guess is that the magnetic field produced by the reader doesn't vary fast enough to generate power in the RFID tag. That is, although you are transitioning from 0 magnetic forces (when the device is off) to some constant magnetic field (when the device is on), this transition does not occur fast enough. If you want the RFID tag to produce a signal while sitting in 1 place, you will need to generate a time-varying magnetic field.

\$\endgroup\$
2
  • \$\begingroup\$ From what I could remember from college this seemed like a possible option but I was expecting the naturally pulsating (I think it is at least) field to negate the need for the tag to be moving. You can also move the tag very slowly and still get a read which is odd. \$\endgroup\$
    – ArthurGuy
    Commented Sep 18, 2014 at 16:28
  • \$\begingroup\$ No, the reader field is not static. All RFID readers send out an oscillating carrier wave to deliver power to the tag. What you describe is more like a magstripe reader, where your swiping of the card really is what generates the motion of the magnetic field. ArthurGuy's problem seems to be that his readers simulate old-fashioned magstripe readers by only outputting the read once then masking further repetitions. Internally, I'm pretty sure the tag keeps repeating its ID as long as it's in the field. \$\endgroup\$
    – Harry Tsai
    Commented Oct 3, 2014 at 17:33
0
\$\begingroup\$

The RFID reader you are using has fixed function(read tag when tag approaches).

You have to design a new module or use programmable module.

The easier way is to have an IR sensor or similar behind the reader, so it can detect card's presence.

\$\endgroup\$
1
  • \$\begingroup\$ A proximity switch for the tag is possible but very easy to defeat, I don't need this to be secure but I don't want people using a workaround like this. \$\endgroup\$
    – ArthurGuy
    Commented Sep 18, 2014 at 16:29
0
\$\begingroup\$

I have actually been able to make this kind of system work with an RFID-RC522. I don't know how or why it works, but it pings the card every time the loop goes around. Will attach code, hope this helps others.

CODE:

#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h> //include Wire.h library
#include "RTClib.h" //include Adafruit RTC library

#define SS_PIN 10
#define RST_PIN 9
#define RED 3
#define GREEN 2

RTC_DS3231 rtc; //Make a RTC DS3231 object

MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class

MFRC522::MIFARE_Key key;

String cardnum =  "";

// Init array that will store UID
byte uid[4];

void setup() {
  Serial.begin(9600);
  pinMode(RED, OUTPUT);
  pinMode(GREEN, OUTPUT);
  digitalWrite(RED, HIGH);
  digitalWrite(GREEN, LOW);
  SPI.begin(); // Init SPI bus
  rfid.PCD_Init(); // Init MFRC522
  for (byte i = 0; i < 6; i++) {
    key.keyByte[i] = 0xFF;    
  }
}


void printHex(byte *buffer, byte bufferSize) {
  cardnum = "";
  for (byte i = 0; i < bufferSize; i++) {
//    Serial.print(buffer[i] < 0x10 ? " 0" : " ");
//    Serial.print(buffer[i], HEX);
  cardnum += buffer[i] < 0x10 ? "0" : "";
  cardnum += buffer[i];
  }
//    Serial.print(cardnum);
}


void loop() {
  if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial()){
   for (byte i = 0; i < 4; i++) {
        uid[i] = rfid.uid.uidByte[i];
   }

    printHex(rfid.uid.uidByte, rfid.uid.size);

    if (cardnum == "144123239121"){
      Serial.println();
      Serial.print("");
      digitalWrite(RED, LOW);
      digitalWrite(GREEN, HIGH);
    }
      else if (cardnum == "64126193128")
     {
      Serial.print("");
       digitalWrite(RED, LOW);
       digitalWrite(GREEN, HIGH);
     }
     delay(20);
  }else
   {
       digitalWrite(RED, HIGH);
    digitalWrite(GREEN, LOW);
   }
 }
\$\endgroup\$
1
  • 2
    \$\begingroup\$ "I don't know how or why it works" is hardly a very good basis for a technical answer, is it? \$\endgroup\$
    – MrGerber
    Commented Aug 8, 2019 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.