element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum RFID Reader (ID-12LA, 125kHz) not working- please help!!!
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 415 subscribers
  • Views 396 views
  • Users 0 members are here
  • arduino_leonardo
  • rfid
  • id-12la
Related

RFID Reader (ID-12LA, 125kHz) not working- please help!!!

e14 Contributor
e14 Contributor over 13 years ago

Hello,

 

I am using a 125kHz ID-12LA RFID Reader, a breakout board and an Arduino Leonardo.

 

I soldered the ID-12LA to the breakout board, then I soldered some small wires to pins 1,2,7,9 and 11.

 

When I place a tag near the reader, nothing pops up (the tag's ID) on the serial monitor.

 

The serial monitor works fine if I use Serial.write("blah"); , which indicates that my wiring is wrong somewhere.

Should you wish to check that I've followed the instructions right, I got the whole project from http://www.instructables.com/id/Reading-RFID-Tags-with-an-Arduino/

 

 

In the attached image, this is the wiring:

 

Arduino --> ID-12LA

 

Pin 5 --> Pin 9 (D0)

Pin 4 --> Pin 9 (D0)

GND --> Pin 7 (FS)

GND --> Pin 1 (GND)

+5V --> Pin 2 (RESET)

+5V --> Pin 11 (+5V)

 

Please tell me if you see anything wrong with my wiring or this code:

 

#include <SoftwareSerial.h>

 

 

// The RFID module's TX pin needs to be connected to the Arduino.

 

 

#define rxPin 4

#define txPin 5

 

 

// Create a software serial object for the connection to the RFID module

SoftwareSerial rfid = SoftwareSerial( rxPin, txPin );

 

 

// Set up outputs

#define futureOutput 12

#define ledPin 13

 

 

// Specify how long the output should be held.

#define unlockSeconds 2

 

 

// The tag database consists of two parts. The first part is an array of

// tag values with each tag taking up 5 bytes. The second is a list of

// names with one name for each tag (ie: group of 5 bytes). You can expand

// or shrink this as you see fit. Tags 2 and 3 are only there for example.

char* allowedTags[] = {

  "[INSERT IDENTIFIER HERE]", // Tag 1

  "2900940E95", // Tag 2

  "ABC123DE45", // Tag 3

};

 

 

// List of names to associate with the matching tag IDs

char* tagName[] = {

  "[ADD YOUR NAME HERE]", // Tag 1

  "Mark Trussell", // Tag 2

  "NAME 3", // Tag 3

};

 

 

// Check the number of tags defined

int numberOfTags = sizeof(allowedTags)/sizeof(allowedTags[0]);

 

 

int incomingByte = 0; // To store incoming serial data

 

 

/**

* Setup

*/

void setup() {

// pinMode(ledPin, OUTPUT);

// digitalWrite(ledPin, LOW);

  //pinMode(futureOutput, OUTPUT);

  //digitalWrite(futureOutput, LOW);

 

 

  Serial.begin(9600); // Serial port for connection to host

  rfid.begin(9600); // Serial port for connection to RFID module

delay(5000);

  Serial.println("RFID Reader Initialized");

}

 

 

/**

* Loop

*/

void loop() {

  byte i = 0;

  byte val = 0;

  byte checksum = 0;

  byte bytesRead = 0;

  byte tempByte = 0;

  byte tagBytes[6]; // "Unique" tags are only 5 bytes but we need an extra byte for the checksum

  char tagValue[10];

 

 

  // Read from the RFID module. Because this connection uses SoftwareSerial

  // there is no equivalent to the Serial.available() function, so at this

  // point the program blocks while waiting for a value from the module

  if((val = rfid.read()) == 2) { // Check for header

    bytesRead = 0;

    while (bytesRead < 12) { // Read 10 digit code + 2 digit checksum

      val = rfid.read();

 

 

      // Append the first 10 bytes (0 to 9) to the raw tag value

      if (bytesRead < 10)

      {

        tagValue[bytesRead] = val;

      }

 

 

      // Check if this is a header or stop byte before the 10 digit reading is complete

      if((val == 0x0D)||(val == 0x0A)||(val == 0x03)||(val == 0x02)) {

        break; // Stop reading

      }

 

 

      // Ascii/Hex conversion:

      if ((val >= '0') && (val <= '9')) {

        val = val - '0';

      }

      else if ((val >= 'A') && (val <= 'F')) {

        val = 10 + val - 'A';

      }

 

 

      // Every two hex-digits, add a byte to the code:

      if (bytesRead & 1 == 1) {

        // Make space for this hex-digit by shifting the previous digit 4 bits to the left

        tagBytes[bytesRead >> 1] = (val | (tempByte << 4));

 

 

        if (bytesRead >> 1 != 5) { // If we're at the checksum byte,

          checksum ^= tagBytes[bytesRead >> 1]; // Calculate the checksum... (XOR)

        };

      }

      else {

        tempByte = val; // Store the first hex digit first

      };

 

 

      bytesRead++; // Ready to read next digit

    }

 

 

    // Send the result to the host connected via USB

    if (bytesRead == 12) { // 12 digit read is complete

      tagValue[10] = '\0'; // Null-terminate the string

 

 

      Serial.print("Tag read: ");

      for (i=0; i<5; i++) {

        // Add a leading 0 to pad out values below 16

        if (tagBytes[i] < 16) {

          Serial.print("0");

        }

        Serial.print(tagBytes[i], HEX);

      }

      Serial.println();

 

 

      Serial.print("Checksum: ");

      Serial.print(tagBytes[5], HEX);

      Serial.println(tagBytes[5] == checksum ? " -- passed." : " -- error.");

 

 

      // Show the raw tag value

      Serial.print("VALUE: ");

      Serial.println(tagValue);

 

 

      // Search the tag database for this particular tag

      int tagId = findTag( tagValue );

 

 

      // Only fire the strike plate if this tag was found in the database

      if( tagId > 0 )

      {

        Serial.print("Authorized tag ID ");

        Serial.print(tagId);

        Serial.print(": unlocking for ");

        Serial.println(tagName[tagId - 1]); // Get the name for this tag from the database

        unlock(); // Fire the strike plate to open the lock

      }

      else {

        Serial.println("Tag not authorized");

      }

      Serial.println(); // Blank separator line in output

    }

 

 

    bytesRead = 0;

  }

}

 

 

/**

* Fire the relay to activate the strike plate for the configured

* number of seconds.

*/

void unlock() {

  digitalWrite(ledPin, HIGH);

  digitalWrite(futureOutput, HIGH);

  delay(unlockSeconds * 1000);

  digitalWrite(futureOutput, LOW);

  digitalWrite(ledPin, LOW);

}

 

 

/**

* Search for a specific tag in the database

*/

int findTag( char tagValue[10] ) {

  for (int thisCard = 0; thisCard < numberOfTags; thisCard++) {

    // Check if the tag value matches this row in the tag database

    if(strcmp(tagValue, allowedTags[thisCard]) == 0)

    {

      // The row in the database starts at 0, so add 1 to the result so

      // that the card ID starts from 1 instead (0 represents "no match")

      return(thisCard + 1);

    }

  }

  // If we don't find the tag return a tag ID of 0 to show there was no match

  return(0);

}

 

 

Thanks!!!

Attachments:
image
  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube