MKR1000 with RFID RC522

Hi all,

Love the MKR1000 so far. I'm finding it quite a nice little board.
shortly describe about my project its rfid attendance system . at my previous version i use ESP8266 for collect data and send to server.

Now I relay want to use MKR1000 as main controller . so I am trying to code with this MKR1000.

from very first test code working normally as expected . also connect my spi oled with MKR1000 and last night its working fine.
basically I am using spi protocol to communicate MKR1000 and RFID READER RC522. Use stander pin of MKR1000 and define rst and ss pin.

problem :- when I upload my sketch MKR1000 stop recognise . no port present after upload my sketch. it return Boot loader mode.
so i don't understand what happing there . pin instruction may be coses of that.

#include <SPI.h>
#include "MFRC522.h"

#define RST_PIN  6 // RST-PIN für RC522 - RFID - SPI - Modul GPIO5 
#define SS_PIN  7  // SDA-PIN für RC522 - RFID - SPI - Modul GPIO2 




MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup() {
 
  Serial.begin(115200);
  delay(100);

  SPI.begin();           // Init SPI bus
  mfrc522.PCD_Init();    // Init MFRC522
 
}

int value = 0;
String readIDold;
void loop() 

{ 
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    delay(50);
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    delay(50);
    return;
  }
  // Show some details of the PICC (that is: the tag/card)
  Serial.print(F("Card UID:"));
//  dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
  Serial.println();
  

  String readID = "s";
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    readID += mfrc522.uid.uidByte[i];
  }
    
 
  
  }
 
  


// Helper routine to dump a byte array as hex values to Serial
void dump_byte_array(byte *buffer, byte bufferSize) {
  for (byte i = 0; i < bufferSize; i++) {
    Serial.print(buffer[i] < 0x10 ? " 0" : " ");
    Serial.print(buffer[i], HEX);
  }
}

http://makerbook.org/arduino/chinmoy.zip

Hi chinmoyrick,
have you tried to press twice fast the reset button.
this normally resolves 99% of the issues you have reported.

yes i do this. it show boot mode .in boot mode i can put a new sketch but every time after uploading this sketch its disappear port, just after upload .so how can i conform about that rfid reader working with mkr1000.
i can't open serial monitor after uploading. i have to conform about spi connection , pin setup work perfectly right.

I had the same problem, and the solution is to read/write with RC522 on another board. I've used a Nano board with 2 RC522 readers connected via Wire to MKR1000. It works fine.

For the Wire connection, I use Nano as Master and MKR1000 as Slave, triggering the event when any card is detected.

Collateral damages:

  • You can not use FastLed library inside the event thread at MKR1000, it crash the code. The only way to control leds is to insert the commands in the main loop, controled by a semaphore thrown at the event function.

  • You can not use a 1602 LCD with MKR1000, because it crash the code. I don't know how to solve it yet. It seems that it's an issue about the SDA/SCL ports used by wire. Any idea anyone?

This happens all the time to me at least. From the IDE (1.6.12) when you upload a sketch to an MKR1000 it does disable the boot usb port and switches back to the usb port number present before the upload. AndreaRichetta is correct as well. In the IDE go to tools->ports and select the port displayed and start the serial monitor. You will see your debug info. I am pretty sure this behaviour is universal to the MKR1000 although other arduino devices do not do this.
dy3

I have a question:

What pins did you use on the MKR1000 to connect to SCK/MOSI/MISO?

I don't know if my rfid reader is dead or i am using the wrong pins.

Thanks in advance.