# Getting the RFID-RC522 to work! \[SOLVED\]

**URL:** <https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571>\
**Category:** Libraries\
**Created:** [March 22, 2014, 6:56pm UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571 "2014-03-22T18:56:55Z")\
**Posts on this page:** 20\
**Page:** 11

<div class="post-metadata">

**Author:** ![anlek](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/anlek/32/5083_2.png) [@anlek](https://community.particle.io/u/anlek)\
**Post date:** [September 15, 2015, 12:29am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/206 "2015-09-15T00:29:18Z")

</div>

Awesome! Thank you so much!

---

<div class="post-metadata">

**Author:** ![anlek](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/anlek/32/5083_2.png) [@anlek](https://community.particle.io/u/anlek)\
**Post date:** [September 15, 2015, 12:47am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/207 "2015-09-15T00:47:56Z")

</div>

Any idea how long it will take before the webIDE will work? I just tried it and I still get the SOS lights.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [September 15, 2015, 2:55am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/208 "2015-09-15T02:55:45Z")

</div>

!!! I’ll have to test again! Make sure you pull the latest version in your app.

---

<div class="post-metadata">

**Author:** ![smnnekho](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/smnnekho/32/7074_2.png) [@smnnekho](https://community.particle.io/u/smnnekho)\
**Post date:** [September 15, 2015, 10:43am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/209 "2015-09-15T10:43:32Z")

</div>

i just got my RFID today and tested it with your new version and it definitly works on my photon (0.45). … Good Timing i guess and Thank you for porting it!

---

<div class="post-metadata">

**Author:** ![smnnekho](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/smnnekho/32/7074_2.png) [@smnnekho](https://community.particle.io/u/smnnekho)\
**Post date:** [September 15, 2015, 11:16am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/210 "2015-09-15T11:16:36Z")

</div>

In case someone else could use a quick and easy code to just get the Card’s ID as a string (i saw someone asking anywhere in this Thread) - this works fine for me:

```
void loop() {

// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
	return;
	
}

// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
	return;
	
}

String cardID = "";

for (byte i = 0; i < mfrc522.uid.size; i++) 

{
    cardID += String(mfrc522.uid.uidByte[i] < 0x10 ? "0" : "");
    cardID += String(mfrc522.uid.uidByte[i], HEX);
    
}

Serial.println(cardID);

Particle.publish("pushover", cardID + " scanned", 60, PRIVATE);

mfrc522.PICC_HaltA();

```

}

---

<div class="post-metadata">

**Author:** ![anlek](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/anlek/32/5083_2.png) [@anlek](https://community.particle.io/u/anlek)\
**Post date:** [September 15, 2015, 3:34pm UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/211 "2015-09-15T15:34:16Z")

</div>

How does one ‘pull’ the latest version in to an app?

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [September 15, 2015, 3:47pm UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/212 "2015-09-15T15:47:43Z")

</div>

@anlek, if you are using the web IDE, remove the library and then re-add it again. Also make sure you are compiling for `latest 0.4.5`. 😄

---

<div class="post-metadata">

**Author:** ![anlek](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/anlek/32/5083_2.png) [@anlek](https://community.particle.io/u/anlek)\
**Post date:** [September 15, 2015, 5:46pm UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/213 "2015-09-15T17:46:32Z")

</div>

Understood, Thanks!

---

<div class="post-metadata">

**Author:** ![anlek](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/anlek/32/5083_2.png) [@anlek](https://community.particle.io/u/anlek)\
**Post date:** [September 16, 2015, 11:15pm UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/214 "2015-09-16T23:15:26Z")

</div>

So I created a new project (I also removed and re-added the `MFRC522` library and still getting SOS lights (on the latest `0.4.5` firmware).

```auto
#include "MFRC522/MFRC522.h"
#define SS_PIN SS
#define RST_PIN A1

MFRC522 mfrc522(SS_PIN, RST_PIN);	// Create MFRC522 instance.

```

Any other ideas? I’m quite lost…

---

<div class="post-metadata">

**Author:** ![anlek](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/anlek/32/5083_2.png) [@anlek](https://community.particle.io/u/anlek)\
**Post date:** [September 16, 2015, 11:17pm UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/215 "2015-09-16T23:17:14Z")

</div>

On the webIDE it still states: `MFRC522 0.1.1` and not `0.1.2`  
 ![](https://community.particle.io/uploads/particle/original/f/3/f3b6e673269add8b2c4a2d13bfe583c0ff201021.png)

---

<div class="post-metadata">

**Author:** ![anlek](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/anlek/32/5083_2.png) [@anlek](https://community.particle.io/u/anlek)\
**Post date:** [September 16, 2015, 11:28pm UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/216 "2015-09-16T23:28:06Z")

</div>

I think I got it refreshed… sorry for the messages.

---

<div class="post-metadata">

**Author:** ![Gabriel](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@Gabriel](https://community.particle.io/u/Gabriel)\
**Post date:** [October 18, 2015, 1:48pm UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/217 "2015-10-18T13:48:23Z")

</div>

Hi, I am working on a time-keeping project using an arduino uno, a lcd display and… a rfid reader RC522.  
But I have a problem because the rfid reader uses the same pins as lcd’s . So I was wondering if I could connect RC522 using just the SOUT pin, or maybe there is another possibility to connect these two devices together.

---

<div class="post-metadata">

**Author:** ![vinay.sah](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@vinay.sah](https://community.particle.io/u/vinay.sah)\
**Post date:** [March 29, 2016, 7:27am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/218 "2016-03-29T07:27:53Z")

</div>

Hi guys, @peekay123, @korneel  
I am newbie to spark, i have found the library in the particle IDE and Pin are configure as per the in app comment.  
Could you please point me out how to see output data from the card which i place on the MFRC522 chip.  
also, Please point me some easy way to send this data to my server url as json data (something like webhook) for the card which i place on the MFRC522.

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [March 29, 2016, 7:53am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/219 "2016-03-29T07:53:36Z")

</div>

If you plug your Particle device into your computer via USB and open a serial monitor application (e.g. PuTTY) you can attach to the respective COM port an see the `Serial` output.

And if you have a line like this in your code

```cpp
Particle.publish("pushover", cardID + " scanned", 60, PRIVATE);

```

You can go to [https://dashboard.particle.io/user/logs](https://dashboard.particle.io/user/logs) and see the output there.

If you want to use a webhook to relay this event to your server you’d best look at the webhooks docs first  
[https://docs.particle.io/guide/tools-and-features/webhooks](https://docs.particle.io/guide/tools-and-features/webhooks)

---

<div class="post-metadata">

**Author:** ![vinay.sah](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@vinay.sah](https://community.particle.io/u/vinay.sah)\
**Post date:** [March 29, 2016, 8:01am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/221 "2016-03-29T08:01:39Z")

</div>

Thanks for reply. i will look this webhook docs 🙂

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [March 29, 2016, 8:03am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/222 "2016-03-29T08:03:49Z")

</div>

BTW: If you were a bit quick with posting a reply, you don’t need to delete the post and create a new one.  
You can just hit the pencil icon in the bottom line of the post to edit your own posts.

---

<div class="post-metadata">

**Author:** ![jeremywmccarter](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jeremywmccarter/32/11418_2.png) [@jeremywmccarter](https://community.particle.io/u/jeremywmccarter)\
**Post date:** [August 17, 2016, 7:06am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/223 "2016-08-17T07:06:54Z")

</div>

@peekay123 I’ve been reading through this thread, and have downloaded your code from GitHub ([RC522\_RFID](https://github.com/pkourany/RC522_RFID)). But I’m getting errors when I compile.

Admittedly, this is my first time using libraries and SPI…I’m new to Particle, but have experience with Arduino (you helped me on my first post in fact, Arduino vs. Particle…thank you!).

Here are the errors:

RFID.cpp: In member function ‘void RFID::halt()’:  
RFID.cpp:512:13: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]  
uint8\_t status;  
^  
RFID.cpp: In member function ‘uint8\_t RFID::softSPITranser(uint8\_t)’:  
RFID.cpp:532:38: error: ‘struct GPIO\_TypeDef’ has no member named 'BSRR’  
PIN\_MAP[\_mosiPin].gpio\_peripheral-\>BSRR = PIN\_MAP[\_mosiPin].gpio\_pin; // Data High  
^

RFID.cpp:534:38: error: ‘struct GPIO\_TypeDef’ has no member named 'BRR’  
PIN\_MAP[\_mosiPin].gpio\_peripheral-\>BRR = PIN\_MAP[\_mosiPin].gpio\_pin; // Data Low

Any thoughts? I’m thinking maybe I’m not doing something right in the [build.particle.io](http://build.particle.io)…my App shows the three files:  
RC522-RFID.INO  
RFID.CPP  
RFID.H

Am I missing something?

Thanks so much, in advance!  
J-

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [August 17, 2016, 10:36am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/224 "2016-08-17T10:36:13Z")

</div>

You can replace these calls with the respective commands `pinSetFast()` / `pinResetFast()` and `pinReadFast()` to get rid of the error messages.

```cpp
    for (uint8_t bit = 0; bit < 8; bit++) {
      if (data & (1 << (7-bit))) // walks down mask from bit 7 to bit 0
        pinSetFast(_mosiPin); // Data High
      else
        pinResetFast(_mosiPin); // Data Low
		
      pinSetFast(_clockPin); // Clock High

      b <<= 1;
      if (pinReadFast(_misoPin))
        b |= 1;

      pinResetFast(_clockPin); // Clock Low
    }

```

---

<div class="post-metadata">

**Author:** ![jeremywmccarter](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jeremywmccarter/32/11418_2.png) [@jeremywmccarter](https://community.particle.io/u/jeremywmccarter)\
**Post date:** [August 17, 2016, 11:29am UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/225 "2016-08-17T11:29:15Z")

</div>

Wow, thanks @ScruffR! That did it! What a quick response, and what an earlybird! 😉

Really appreciate it!

Best-  
Jeremy

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [August 17, 2016, 12:10pm UTC](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571/226 "2016-08-17T12:10:11Z")

</div>

That’s the advantage of a global community - it’s 2:10pm for me already 😉

[Previous page](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571.md?page=10)

[Next page](https://community.particle.io/t/getting-the-rfid-rc522-to-work-solved/3571.md?page=12)
