arduino - RFID-RC522 not reading card -
i have rfid-rc522 (mf-rc522) module , i'm using arduino sketch program. have downloaded example code:
/* * -------------------------------------------------------------------------------------------------------------------- * example sketch/program showing how read data picc serial. * -------------------------------------------------------------------------------------------------------------------- * mfrc522 library example; further details , other examples see: https://github.com/miguelbalboa/rfid * * example sketch/program showing how read data picc (that is: rfid tag or card) using mfrc522 based rfid * reader on arduino spi interface. * * when arduino , mfrc522 module connected (see pin layout below), load sketch arduino ide * verify/compile , upload it. see output: use tools, serial monitor of ide (hit ctrl+shft+m). when * present picc (that is: rfid tag or card) @ reading distance of mfrc522 reader/pcd, serial output * show id/uid, type , data blocks can read. note: may see "timeout in communication" messages * when removing picc reading distance early. * * if reader supports it, sketch/program read piccs presented (that is: multiple tag reading). * if stack 2 or more piccs on top of each other , present them reader, first output * details of first , next picc. note may take time data blocks dumped, * keep piccs @ reading distance until complete. * * @license released public domain. * * typical pin layout used: * ----------------------------------------------------------------------------------------- * mfrc522 arduino arduino arduino arduino arduino * reader/pcd uno/101 mega nano v3 leonardo/micro pro micro * signal pin pin pin pin pin pin * ----------------------------------------------------------------------------------------- * rst/reset rst 9 5 d9 reset/icsp-5 rst * spi ss sda(ss) 10 53 d10 10 10 * spi mosi mosi 11 / icsp-4 51 d11 icsp-4 16 * spi miso miso 12 / icsp-1 50 d12 icsp-1 14 * spi sck sck 13 / icsp-3 52 d13 icsp-3 15 */ #include <spi.h> #include <mfrc522.h> #define rst_pin 9 // configurable, see typical pin layout above #define ss_pin 10 // configurable, see typical pin layout above mfrc522 mfrc522(ss_pin, rst_pin); // create mfrc522 instance void setup() { serial.begin(9600); // initialize serial communications pc while (!serial); // nothing if no serial port opened (added arduinos based on atmega32u4) spi.begin(); // init spi bus mfrc522.pcd_init(); // init mfrc522 mfrc522.pcd_dumpversiontoserial(); // show details of pcd - mfrc522 card reader details serial.println(f("scan picc see uid, sak, type, , data blocks...")); } void loop() { // new cards if ( ! mfrc522.picc_isnewcardpresent()) { return; } // select 1 of cards if ( ! mfrc522.picc_readcardserial()) { return; } // dump debug info card; picc_halta() automatically called mfrc522.picc_dumptoserial(&(mfrc522.uid)); }
when execute it, message:
firmware version: 0x0 = (unknown)
warning: communication failure, mfrc522 connected?
scan picc see uid, sak, type, , data blocks...
i have re-checked connections thousand time it's not working, pins connected example says to, , led d1 on (red). can me?
if looking solution...
step-1: change rst pin 5 if using arduino uno or use rst pin 9 in arduino mega. other pins remains same.
step-2:download addicorerfid library.
step-3: open arduino ide , navigate sketch > include library using “add .zip library…” option.
step-4: restart arduino ide (close , open again)
step-5: inside arduino ide navigate file > examples > addicorerfid. select “addicore_rfid_example” sketch , upload sketch
step-6: open serial window , select "both nl & cr" , select "9600" baud rate option
detail explanation can found @ link
Comments
Post a Comment