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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Mifare RC522 RFID

Post by Benj »

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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Mifare RC522 RFID

Post by Benj »

Aha found an STm library which looks a bit more readable. I'll give this a quick go and see where I get to.

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

Re: Mifare RC522 RFID

Post by Benj »

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.46 KiB) Downloaded 613 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.

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

Re: Mifare RC522 RFID

Post by Benj »

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.68 KiB) Downloaded 597 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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Mifare RC522 RFID

Post by jgu1 »

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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Mifare RC522 RFID

Post by Benj »

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 586 times
This file is the example project.
MFRC Example.fcfx
(10.33 KiB) Downloaded 643 times

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: Mifare RC522 RFID

Post by STibor »

Hello!
Thank you for your component!
I have RFID hardware, tested in the evening.

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

Re: Mifare RC522 RFID

Post by Benj »

I have RFID hardware, tested in the evening.
Great thanks :D

I'll keep my fingers crossed for you.

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: Mifare RC522 RFID

Post by STibor »

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/ImageReposito ... 7deda3.png

Can I use multiple RFID modules such as SPI devices on a bus?

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

Re: Mifare RC522 RFID

Post by Benj »

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.

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: Mifare RC522 RFID

Post by STibor »

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: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: Mifare RC522 RFID

Post by STibor »

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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Mifare RC522 RFID

Post by jgu1 »

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: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Mifare RC522 RFID

Post by jgu1 »

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 425 times

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

Re: Mifare RC522 RFID

Post by Benj »

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 462 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 456 times
The connections look something like this and the pin names in the component should match up better now.
RFID-RC522-pinout.png
(300.81 KiB) Downloaded 11115 times
Let us know how you get on.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Mifare RC522 RFID

Post by jgu1 »

Hi Ben!

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


Jorgen

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: Mifare RC522 RFID

Post by STibor »

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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Mifare RC522 RFID

Post by jgu1 »

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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Mifare RC522 RFID

Post by Benj »

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.
[/youtube]

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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Mifare RC522 RFID

Post by jgu1 »

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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Mifare RC522 RFID

Post by Benj »

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

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Mifare RC522 RFID

Post by jgu1 »

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: 101
Joined: Tue Sep 01, 2015 9:37 pm
Been thanked: 14 times
Contact:

Re: Mifare RC522 RFID

Post by kennethnilsen69 »

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: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Mifare RC522 RFID

Post by jgu1 »

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: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Mifare RC522 RFID

Post by jgu1 »

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 366 times

Post Reply