Mifare RC522 RFID

Please add any feature requests for Flowcode version 6 here

Moderator: Benj

Forum rules
Only feature requests will be considered here. General questions should not be posted in this forum.
User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Tue Feb 09, 2016 11:27 am

Lots of meetings today so doubt I will get chance but I'll have another try for you this week, maybe using a different code base if I can find one.

User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Tue Feb 09, 2016 11:34 am

Aha found an STm library which looks a bit more readable. I'll give this a quick go and see where I get to.
These users thanked the author Benj for the post:
jgu1 (Wed Feb 10, 2016 12:14 pm)
Rating: 5%
 

User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Tue Feb 09, 2016 6:34 pm

Hello,

Would you mind giving this a whirl and see if it gets different IDs for different cards. I still need to add the macros to read/write the data on the card but at least we should get unique IDs for the different cards now.

MFRC522.fcfx
(36.47 KiB) Downloaded 295 times


I'll see if I can dig out my RC522 module for testing but it's been a while since I last saw it so probably buried in a box somewhere.
These users thanked the author Benj for the post:
jgu1 (Wed Feb 10, 2016 12:14 pm)
Rating: 5%
 

User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Wed Feb 10, 2016 11:46 am

Fingers crossed this is most of the functionality back in now.

Have a go and let me know how you get on, if things are looking good then I will make the example into a component.

MFRC522.fcfx
(46.7 KiB) Downloaded 269 times


I might have made a mistake in the last example as the data shown on the LCD was coming from the wrong buffer I think. Anyway should be correct now.

Not managed to find my RC522 board yet, may have to buy in another one.
These users thanked the author Benj for the post:
jgu1 (Wed Feb 10, 2016 12:14 pm)
Rating: 5%
 

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: Mifare RC522 RFID

Postby jgu1 » Wed Feb 10, 2016 12:13 pm

Hi Ben!

Too bad, pity, I've just given my RFID to a friend. :( WHO should use it for an Arduino project. But I will immediately order a new on Ebay. Could take a while.

Maybe we have luck, and Stibor see this news and he could test it..

Anyway Ben, thank´s. You hear.

Br

Jorgen.

User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Wed Feb 10, 2016 12:15 pm

Hello,

Too bad, pity, I've just given my RFID to a friend.


Never mind, I'm sure there are others who can help to test in the meantime. If not then let me know when your replacement arrives and you have had a go.

Here is a exported version with an example.

This file needs to be placed into the "Flowcode 6/Components" folder.
RFID_MFRC522.fcpx
(10.33 KiB) Downloaded 272 times


This file is the example project.
MFRC Example.fcfx
(10.33 KiB) Downloaded 303 times
These users thanked the author Benj for the post (total 2):
jgu1 (Wed Feb 10, 2016 2:03 pm) • STibor (Wed Feb 10, 2016 3:08 pm)
Rating: 10%
 

User avatar
STibor
Posts: 262
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 115 times
Been thanked: 112 times
Contact:

Re: Mifare RC522 RFID

Postby STibor » Wed Feb 10, 2016 3:08 pm

Hello!
Thank you for your component!
I have RFID hardware, tested in the evening.
These users thanked the author STibor for the post (total 2):
Benj (Wed Feb 10, 2016 5:46 pm) • jgu1 (Wed Feb 10, 2016 6:15 pm)
Rating: 10%
 

User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Wed Feb 10, 2016 5:46 pm

I have RFID hardware, tested in the evening.


Great thanks :D

I'll keep my fingers crossed for you.

User avatar
STibor
Posts: 262
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 115 times
Been thanked: 112 times
Contact:

Re: Mifare RC522 RFID

Postby STibor » Wed Feb 10, 2016 8:41 pm

Hello!

Thank you!
I tested the module.
The results are very good, the program works.
There are so many mistakes that:
After init of the 1-4 information is incorrect.
For example:
RFID Init
okay
7,0,0,0,0 bad value
1,0,0,0,0
9,212,9,3,77 good value
9,212,9,3,77
9,212,9,3,77
9,212,9,3,77
9,212,9,3,77
9,212,9,3,77
9,212,9,3,77
0,212,9,3,77 back in a bad value
9,212,9,3,77
9,212,9,3,77
9,212,9,3,77
This is a credit card sized RFID.

Small blue-sized RFID card is very insensitive and slow, over a faulty scan.

Little blue card:
http://www.globalspec.com/ImageRepository/LearnMore/20139/RFID-key-fobs21974946e86242168eea795f307deda3.png

Can I use multiple RFID modules such as SPI devices on a bus?
These users thanked the author STibor for the post:
jgu1 (Thu Feb 11, 2016 2:29 pm)
Rating: 5%
 

User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Thu Feb 11, 2016 1:35 pm

Hello,

So it is looking better. Well that's certainly something. :D

Thanks for letting me know.

Yes multiple RFID modules are fine, just add the component as many times as you need and use a different CS pin for each module. All components will need to be initialised.
These users thanked the author Benj for the post:
jgu1 (Thu Feb 11, 2016 2:29 pm)
Rating: 5%
 

User avatar
STibor
Posts: 262
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 115 times
Been thanked: 112 times
Contact:

Re: Mifare RC522 RFID

Postby STibor » Fri Feb 19, 2016 6:44 pm

Hello!

Very good macro RFID, quickly scans the ID.
The sensitivity is very low.
The Arduino library sensing distance of several centimeters in any RFID card.
The Flowcode macro distance of 0.8cm larger RFID card, the small card 0cm.
The sensitivity to be increased?
How could the RF excitation power, excitation or increased time?

The Flowcode macro RFID 6.1.3.2 version is the same as the previous version?

User avatar
STibor
Posts: 262
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 115 times
Been thanked: 112 times
Contact:

Re: Mifare RC522 RFID

Postby STibor » Sun Feb 21, 2016 10:12 am

Hello!
I checked the SPI data line logic analyzer.
The initialization did not match the Arduino example applications.
Slightly modified the program.
The maximum transmission distance of 5 cm. :D

I think I was good.
Last edited by STibor on Tue Nov 01, 2016 11:28 am, edited 1 time in total.
These users thanked the author STibor for the post (total 2):
Benj (Sun Feb 21, 2016 11:56 pm) • electron67 (Tue Jun 07, 2016 12:17 am)
Rating: 10%
 

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: Mifare RC522 RFID

Postby jgu1 » Sat Mar 12, 2016 6:57 pm

Hi Stibor/Ben!

Finally, on wednesday I will receive my RC522.

But I don´t quiet understand. I can see Stibor, the last program you have made is totally different from Ben´s. Does Ben´s program still not working after update?

For me it look like you have made some bitbanging. To be honest, I do not really find out your program.

Could and will you please add a display (lcd) to the program so I first are able to read the ID and afterwords where in the programm I add the ID so it is possible to open an electric Lock (output). :D

Thank´s in advance

Jorgen.

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: Mifare RC522 RFID

Postby jgu1 » Thu Mar 17, 2016 8:03 am

Hi All!

Finally I got my Rfid RC522 Card. Could someone please tell me the wiring connection between the Card and in Ben´s project to the pic16f1937 please. :D


Thank´s in advance

Jorgen
Attachments
MFRC Example.fcfx
(10.33 KiB) Downloaded 173 times

User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Fri Mar 18, 2016 11:42 am

Hello,

Right I have added STibor's changes to the component, also added the dynamic SPI layer to the component and exported so we have something much more like a finished polished component now.

RFID_MFRC522.fcpx
(12.03 KiB) Downloaded 213 times


Update the component by copying the file above into your "Flowcode 6/Components" directory.

Once you have done this you can load the project file.

MFRC Example-1.fcfx
(10.46 KiB) Downloaded 209 times


The connections look something like this and the pin names in the component should match up better now.

RFID-RC522-pinout.png
RFID-RC522-pinout.png (300.81 KiB) Viewed 10675 times


Let us know how you get on.
These users thanked the author Benj for the post (total 3):
jgu1 (Fri Mar 18, 2016 11:50 am) • STibor (Fri Mar 18, 2016 6:43 pm) • electron67 (Tue Jun 07, 2016 12:17 am)
Rating: 15%
 

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: Mifare RC522 RFID

Postby jgu1 » Fri Mar 18, 2016 11:50 am

Hi Ben!

Great, thank´s I will test it during the weekend and you hear..


Jorgen
These users thanked the author jgu1 for the post:
Benj (Fri Mar 18, 2016 11:55 am)
Rating: 5%
 

User avatar
STibor
Posts: 262
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 115 times
Been thanked: 112 times
Contact:

Re: Mifare RC522 RFID

Postby STibor » Fri Mar 18, 2016 6:54 pm

Hello!

@ Ben thanks for your program!
How prepared Dynamic SPI layer?
If you have time you can create a video about this?
Preparation solved the SPI clock divider layer?

@ JGU (you must know) RC522 3,3Volt the power supply.
The PIC microcontroller with the following outputs (if 5Volt power line work) SS SCK SDO Reset (not MCLR) use a resistor divider, or voltage translator.
These users thanked the author STibor for the post (total 2):
Benj (Fri Mar 18, 2016 7:05 pm) • jgu1 (Fri Mar 18, 2016 10:02 pm)
Rating: 10%
 

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: Mifare RC522 RFID

Postby jgu1 » Fri Mar 18, 2016 10:01 pm

Hi Stibor & Ben!

Thank´s for info. Unfortunately I didt´n manage to get it work.

I have made a 3,3volt supply to the reader with a zener + resistor, seemed to be ok. So do you mean that I have to make a divider for each datapin exept MCLR?

I have moved the display to port E and I can see that i write: " Initialise ok" and that all. When I measure with scoope on the datapin I can se signal´s.

Stibor have you the possibility to test Ben´s program? If it work by you I may have hardwareproblem.

Thank´s in advance.

Jorgen

User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Mon Mar 21, 2016 1:14 pm

How prepared Dynamic SPI layer?


It's a fairly complicated process of taking the properties of the RFID component and passing them to the CAL SPI component using a property change event macro.

For a hardware channel we assign the channel in the CAL SPI component, we disable the connections from being editable and then copy the hardware pin connections from the CAL SPI component.

For a software channel we assign the channel in the CAL SPI component, we enable the connections to be editable and then write the software pin connections to the CAL SPI component.

Then there is an additional layer required if the chip supports re-mappable hardware SPI.

This video is along the right lines but doesn't go into all the detail.


For Flowcode v7 we are looking at ways to simplify this process so you simply drag a CAL SPI onto your program and then select which properties you want to bring through to your component rather then having to manually copy values back and forth. This means the CAL component can do all the complicated stuff allowing component generation to be much simpler.

So do you mean that I have to make a divider for each datapin exept MCLR?


There are 5 pins connections from the microcontroller to the RC522 board. 4 of these are outputs from the micro and 1 is an input.

Outputs - MOSI, SCK, CS, Reset

Inputs - MISO

If your using a micro powered at 5V then the outputs will need potential dividers to bring the output voltage from 5V to 3V3.

The Input can be connected directly as a 5V micro will read a 3V3 signal as a logic 1.

Powering the RC522 from a Zener might not work depending on the current required to operate. I would advise a 3V3 regulator instead attached to the 5V supply rail.
These users thanked the author Benj for the post:
jgu1 (Mon Mar 21, 2016 9:34 pm)
Rating: 5%
 

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: Mifare RC522 RFID

Postby jgu1 » Mon Mar 21, 2016 9:38 pm

Hi again Ben!

Ok, but if I look at many ohter arduinoproject with rc522, I see that they use the 3,3Volt from the arduino to supply the rfid522 and all the communication is directly connected to the in/ out.


Thank's for your patience and help. I Will order a 3,3 V regulator and try to more attemps, you wil hear from me, hope this is ok.

Br.

Jorgen

User avatar
Benj
Matrix Staff
Posts: 14670
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4655 times
Been thanked: 4277 times
Contact:

Re: Mifare RC522 RFID

Postby Benj » Tue Mar 22, 2016 11:15 am

Hello,

Yes your right everyone seems to power from a 3V3 regulator but then connect the 5V I/O directly. I can't find much info on this and the NXP datasheet is not clear at all by not listing max voltages for the I/O pins.

My advice would be to use the resistors as hopefully it will be more reliable long term. Less potential stress for the rc522 ic.

However I won't hold it against you for connecting directly. Sometimes the best way forwards is try it and see :D
These users thanked the author Benj for the post:
jgu1 (Mon Mar 28, 2016 5:40 pm)
Rating: 5%
 

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: Mifare RC522 RFID

Postby jgu1 » Mon Mar 28, 2016 5:54 pm

Hi Benj and all

I have now tryed to get it running. But sorry, no matter what I do it will not work. I have a stable 3,3V supply, Made by a LM317. Tryed with divider ect. I am sure the card is ok, because if I try with an Arduino examble it work. But I would prefer to use Flowcode. :lol:

When I measure with my scoop, I can see signal on mosi and miso, but nothing on clock or data. I have changed the port for the display to port D.
I see in the display when I start up: "Rfid Init Ok" after that Nothing happen. the display is Blanck- even when I swipe a tag or card.

It would be nice if somebody could try to make a test if you have a rfid522 and a pic16f1937.

***I'm sorry for the inconvenience***

Br

Jorgen

kennethnilsen69
Posts: 87
Joined: Tue Sep 01, 2015 9:37 pm
Been thanked: 14 times
Contact:

Re: Mifare RC522 RFID

Postby kennethnilsen69 » Thu Apr 14, 2016 1:34 am

Benj wrote:Hello,

Right I have added STibor's changes to the component, also added the dynamic SPI layer to the component and exported so we have something much more like a finished polished component now.

RFID_MFRC522.fcpx


Update the component by copying the file above into your "Flowcode 6/Components" directory.

Once you have done this you can load the project file.

MFRC Example-1.fcfx


The connections look something like this and the pin names in the component should match up better now.

RFID-RC522-pinout.png


Let us know how you get on.



Hi Benj this component worked very well on my Arduino uno :-) It reads the chip just fine without any errors. and its stable :-)

there's one thing I miss, and it is to raise RFCfgReg up to 48dB as that they can do in Arduino library to Extend range for the MFRC522 RFID Reader. Is this possible to achieve here in flowcode?
http://forum.arduino.cc/index.php?topic=199983.0

Thanks :-)

Kenneth

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: Mifare RC522 RFID

Postby jgu1 » Fri Apr 15, 2016 12:32 pm

Hi Kennethnielsen! Sound Danish. :D

Would you share your testprogram with the Arduino please. As you can see in above, I didn´t manage to get it run with pic16f1737. Maybe I would have better luck with your program with Arduino. and please pin connection.

If you will, thank´s in advance.


Br. Jorgen.

jgu1
Posts: 1139
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1052 times
Been thanked: 280 times
Contact:

Re: Mifare RC522 RFID

Postby jgu1 » Sat Apr 16, 2016 7:40 pm

Hi Ben!

Yes, finally I managed to get it run. I tryed to do the same as "kennethnielsen" change the device to an Arduino. It work´s perfect. Really great job Ben, thank´s :D and as kennethnielsen say, wery stable and equal number everytime I swipe the card. Perfect.

I have set one card in for acces ID and add an output so I am able to activate a motor or some other device to open a lock wisch go high for 2 sec.

How do I add more card, please......

Br Jorgen.
Attachments
MFRC Example-1Uno.fcfx
(12.81 KiB) Downloaded 129 times