zodier / MFRC522-UART-Arduino

Arduino library for MFRC522 based modules via UART interface.
MIT License
25 stars 15 forks source link

Explain #1

Open MagoKimbra opened 8 years ago

MagoKimbra commented 8 years ago

Please if possible explain me this library.. I have by module RC522 width UART... Sorry for my english!!!

zodier commented 8 years ago

Hi MagoKimbra, you have a simple example in the "examples" folder. If you have any specific question, please, ask here and I will try to help you. :)

jr-k commented 8 years ago

I set the MISO(TX) pin on D0 and SDA(RX) on D1 but I got nothing... I have the RFID-RC522, do I need to connect 2 pins to activate UART mode ?

Also I've tested my device work with SPI and it's working.

Can you help me pls ?

zodier commented 8 years ago

Hi jreziga, what model of Arduino are you using? Note that some models of Arduino share the Serial Bus (like Arduino nano) with the USB connector. While you are using the USB connection with your computer the Serial Bus with RC522 doesn't works fine. If you are using an Arduino Mega, please use the Serial1 on pins 19 (RX) and 18 (TX). For some other models see https://www.arduino.cc/en/Reference/Serial.

Please, let me know if this resolve your problem.

jr-k commented 8 years ago

I'm using Arduino Uno. My NFC reader is that one : http://www.banggood.com/fr/RC522-Chip-IC-Card-Induction-Module-RFID-Reader-p-81067.html

MagoKimbra commented 8 years ago

I could not get it to go, because it is set to work in i2c. I have solved with this http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=90_93&products_id=2258&zenid=lemnu9n477rsbvu951fqrmnf25

https://www.youtube.com/watch?v=-PMeuHj56-E

yoonzy commented 8 years ago

please help me zoider.. i has try simple example in the "examples" folder.. and i'm using MFRC522 with ArduinoMega2560 I set the MISO(TX) pin to pins 19 (RX) and SDA(RX) pin to pins 18 (TX).. is this the correct configuration? I haven't got any response when opening the serial monitor..

ricardojlrufino commented 8 years ago

this works with this module ? http://www.seekic.com/uploadfile/member_product/5199/20138242131767.jpg

zodier commented 8 years ago

Hi @yoonzy. Your configuration seems correct. But remember to change "&Serial" on the example code to "&Serial1" if you are using pins 19 (RX) and 18 (TX) with Arduino Mega.

Hi @ricardojlrufino. My module is not exactly that one (is this), but you can try it and tell me if it works. :)

ricardojlrufino commented 8 years ago

I think that my module is for SPI only

nguyentuancdt1 commented 7 years ago

Hi #zodier, i'm using mega2560 and rfid_module_v4 elechouse, i don't know the way to write a byte to card, i can write by SPI comm, can you teach me the way to write by uart, thank !

rfid module http://www.elechouse.com/elechouse/index.php?main_page=product_info&products_id=2156

nguyentuancdt1 commented 7 years ago

Hi zodier !

I’m sorry because now I reply, I just don’t understand the way to send & receive module MFRC522 by UART, also if by SPI I can write the number to card very easy

Or read number of card again, but I think speed R/W SPI slower UART, can you teach me the way write/read data to card, example

Write number 1 to card, after that read card.

Now I have project make auto car, Car will full other car to transfer material. The auto car will read card to know position such as warehouse or station.

When I using SPI, sometime auto car pass card, so I think using uart will be better

Help me pls !

From: Himura Kazuto [mailto:notifications@github.com] Sent: Thursday, January 26, 2017 6:36 PM To: zodier/MFRC522-UART-Arduino Cc: nguyentuancdt1; Comment Subject: Re: [zodier/MFRC522-UART-Arduino] Explain (#1)

I'm trying to understand how should I talk to this chip via UART and one evening was not enough for this. I've found a question. Where does the 0xAB came from? As I see in the datasheet, to read a register you should send zero, then 8 bit is data then one. So one the package is 10bit. And your code looks weird, I can't understand what do you send and why should it work. Also I don't see the serial number request, why do you expect the chip will send it on init?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zodier/MFRC522-UART-Arduino/issues/1#issuecomment-275368273 , or mute the thread https://github.com/notifications/unsubscribe-auth/AXpUqj6eqDbvDVl2xMNKVKtJeshedCqEks5rWIUKgaJpZM4HJ4Wv . https://github.com/notifications/beacon/AXpUqhbWNwa1Qo_5QZLVtuXwo3VeAjLuks5rWIUKgaJpZM4HJ4Wv.gif

Himura2la commented 7 years ago

Use my repo, bro. I did it, my RC522 is working via UART. I found that the usual code that everybody use is quite weak, but as I googled, there's no alternatives((

nguyentuancdt1 commented 7 years ago

Oh yes, I already see your code, now I have a mega2560 board, I’m using TX1/RX1(pin18,18) connect to MRFC522, TX0/RX0 to show serial but I don’t know change in your code to reconfig, I think have to change in https://github.com/zodier/MFRC522-UART-Arduino/blob/master/MFRC522.cpp MFRC522.cpp and https://github.com/zodier/MFRC522-UART-Arduino/blob/master/MFRC522.h MFRC522.h also Conector.begin(&Serial); allright ?

If I want to write number 1 into card, is it “Connector.write(1)” ???

If I want to read and show the number of card on Serial0, is it “Serial.println(Connecto.read)” ???

Can you teach me the way to change, thank bro !

From: Himura Kazuto [mailto:notifications@github.com] Sent: Thursday, February 02, 2017 2:58 PM To: zodier/MFRC522-UART-Arduino Cc: nguyentuancdt1; Comment Subject: Re: [zodier/MFRC522-UART-Arduino] Explain (#1)

Use my repo, bro. I did it, my RC522 is working via UART. I found that the usual code that everybody use is quite weak, but as I googled, there's no alternatives((

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zodier/MFRC522-UART-Arduino/issues/1#issuecomment-276891228 , or mute the thread https://github.com/notifications/unsubscribe-auth/AXpUqpGtCHKJPMqASUuKrbmpDDU7aoX2ks5rYYyWgaJpZM4HJ4Wv . https://github.com/notifications/beacon/AXpUqoElqIwyVUyPToDuveWQE-BMpncRks5rYYyWgaJpZM4HJ4Wv.gif

Himura2la commented 7 years ago

Use the official repository https://github.com/miguelbalboa/rfid, this code is much more powerful. First thing you have to do is rewrite the register-reading and -writing functions. https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L46 https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L61 https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L79 https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L95 Refer to my python code.

And watch all pin-dependant statements, you should correct them also. like here https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L199

And don't forger to switch your board to UART mode. http://igor-kochet.livejournal.com/267758.html

nguyentuancdt1 commented 7 years ago

Exactly, I already use https://github.com/miguelbalboa/rfid this library to SPI comm, read and write data card normal, now I want to use UART comm but can not :(. I use MRFID-RC522 in elechouse it’s not RFID-RC522, it don’t have switch SPI-UART. Haizzz !!!!

Help me bro ^^

From: Himura Kazuto [mailto:notifications@github.com] Sent: Friday, February 03, 2017 2:13 PM To: zodier/MFRC522-UART-Arduino Cc: nguyentuancdt1; Comment Subject: Re: [zodier/MFRC522-UART-Arduino] Explain (#1)

Use the official repository https://github.com/miguelbalboa/rfid, this code is much more powerful. First thing you have to do is rewrite the register-reading and -writing functions. https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L46 https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L61 https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L79 https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L95 Refer to my python code.

And watch all pin-dependant statements, you should correct them also. like here https://github.com/miguelbalboa/rfid/blob/master/MFRC522.cpp#L199

And don't forger to switch your board to UART mode. http://igor-kochet.livejournal.com/267758.html

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zodier/MFRC522-UART-Arduino/issues/1#issuecomment-277180044 , or mute the thread https://github.com/notifications/unsubscribe-auth/AXpUqu8D7f4uArpT1XQjUF8LXI4uNdp9ks5rYtONgaJpZM4HJ4Wv . https://github.com/notifications/beacon/AXpUqpDMTypKBEQbTe6zFvNvavkothcnks5rYtONgaJpZM4HJ4Wv.gif

Himura2la commented 7 years ago

There's no 'switch'. you will need to cut the pull-up track to pin 32 as shown here http://igor-kochet.livejournal.com/267758.html Also, I have to notice that the task you are going to achieve is quite complicated. You will need to read the datasheet, understand the existing code (and how it is connected to the datasheet) then write your own code accordng to the datasheet. Of corse now you also have my working code in another language, but it simplifies your task just a little bit. In case something should not work as expected, there will be noone to help except for the datasheet. You can go on searching for a ready solution in case it's too hard for you. Or you can drop your arduino and start using the real-world hardware and software. In this case you will have my ready code.

nguyentuancdt1 commented 7 years ago

Thank https://github.com/Himura2la Himura2la !

Does your code have connect between adruino uno and mrfid-rc522 ?

I will review again !

Himura2la commented 7 years ago

I don't use arduino. My code connects rc522 with a PC or anything that could execute Python. For instance, Raspberry Pi or ESP8266

nguyentuancdt1 commented 7 years ago

oh oh, so i don't understand because your code differance adruino, sorry now i'm newbie hihi

Himura2la commented 7 years ago

That's why I warned you this is not an plug-and-flash task and may require time and knowledge...

nguyentuancdt1 commented 7 years ago

ok thank you ! i will trying

cyberjupiter commented 7 years ago

@Himura2la can you write us a simple read and write for Arduino using UART? I would be glad even if it is not a complete code.

Himura2la commented 7 years ago

Sorry, I don't have time to translate my code into the language I hate ( Python is extremely readable, I hope you won't have problems in understanding my code

cyberjupiter commented 7 years ago

Okay sorry but maybe I was too demanding. I have never worked with Python but I will give it a shot. Would you mind if I contact you from time to time for a specific question regard with the code?

Himura2la commented 7 years ago

Sure. You definitely have to try Python, it's just perfect.

Himura2la commented 6 years ago

They are not required, in fact I never ever used them and even don't know their purpose. UART is RX, TX and common GND

On Sun, Mar 11, 2018, 5:58 PM Prasset notifications@github.com wrote:

i am so confused about DTRQ and MX pins in UART communication. I cant found it in RC522 module.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zodier/MFRC522-UART-Arduino/issues/1#issuecomment-372121579, or mute the thread https://github.com/notifications/unsubscribe-auth/AHcPuOIgbzi-A0EvpHpncIkY7FBObFEiks5tdTt8gaJpZM4HJ4Wv .