Using MFRC522v2 library 2.06
Start your code here
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4604
ho 0 tail 12 room 4
load:0x40078000,len:15488
load:0x40080400,len:4
load:0x40080404,len:3180
entry 0x400805b8
= (unknown)
WARNING: Communication failure, is the MFRC522 properly connected?
Scan PICC to see UID, SAK, type, and data blocks…
This line in the code throws up warning?
MFRC522Debug::PCD_DumpVersionToSerial(mfrc522, Serial);
The rest of the code works fine and reads the Tab/Card and dumps the info OK.
Start your code here
Card UID: 81 70 11 03
Card SAK: 08
PICC type: MIFARE 1KB
Sector Block 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 AccessBits
15 63 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF [ 0 0 1 ]
62 6A 65 6E 6E 69 65 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
14 59 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF [ 0 0 1 ]
58 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
57 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
56 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
~~~~~~~~~~~~~
1 7 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF [ 0 0 1 ]
6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
0 3 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF [ 0 0 1 ]
2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
0 81 70 11 03 E3 08 04 00 62 63 64 65 66 67 68 69 [ 0 0 0 ]
**********
Also I have been trying to increase the range of the MFRC522 as it’s about 1cm.
Looking on line I have found different options but none of them compile, (all with errors)
//MFRC522::PCD_GetAntennaGain();
//MFRC522::PCD_SetAntennaGain(mfrc522.PCD_RxGain_max);
// mfrc522.PCD_SetAntennaGain(mfrc522.PCD_RxGain_max);
//mfrc522.PCD_SetRegisterBitMask(mfrc522.RFCfgReg, (0x07<<4));
//mfrc522.PCD_ClearRegisterBitMask(RFCfgReg, (0x07<<4));
//mfrc522.PCD_SetRegisterBitMask(RFCfgReg, (gain<<4));mfrc522.PCD_RxGain_max;
//mfrc522.PCD_WriteRegister(0x26 , 0x7F);
Looking in the one of the libraries MFRC522v2.h there is:
void PCD_SetAntennaGain(byte mask);
and also in MFRC522Constants.h
RxGain_max = 0x07 << 4 // 111b – 48 dB, maximum, convenience for RxGain_48dB
So I don’t know what the correct procedure is.
Can anyone help?
Thank you
Hi.
The issue may be because it may take some time to initialize a communication with the module. After a bit, it should initialize properly and so you can scan the card just fine.
As for the communication range, it is normal for RFID to have a short communication range. We haven’t tried or searched a method to increase it.
is there a particular reason why you would like to increase the communication range?
Regards,
Sara
I want to use it through a wooden garage door which is 2.cm thick. it just isn’t near enough.
Great project though and I will keep moving it forward.
Ok.
Then, let me know if you found a way to increase the distance via software.
Regards,
Sara
Hi, Just for info I have managed to increase one of my boards. Information below.
ESP32 RFID RC522 Gain.
I have tried 3 different boards from Ali-express and it works from 18dB to 48dB, values 0 to 112
This only seemed to work with a board with HW-126 stamped on it, another card was stamped V133
that didn’t work and the 3rd board no additional stamp worked but not as good as HW-126.
The main difference was the size of all the capacitors on the boards. The HW-126 board which worked the best, the caps were 3 times the size of the other 2.
Sorry I don’t know why that is…
Below results and additional code I used for void initRFIDReader() {
Distance Card Tab
18dB = 0 .5cm –
23dB = 16 1.5cm .5cm
33dB = 64 (Default) 2.8cm 2.0cm
38dB = 80 3.5cm 2.7cm
43dB = 96 3.8cm 2.7cm
48Db = 112 (max) 4.0cm 3.0cm
Start your code here
void initRFIDReader() {
mfrc522.PCD_Init(); // Init MFRC522 board.
delay(200);
MFRC522Debug::PCD_DumpVersionToSerial(mfrc522, Serial);
Serial.print(“READ: mfrc522.PCD_GetAntennaGain() = “); Serial.println(mfrc522.PCD_GetAntennaGain());
Serial.print(“mfrc522.PCD_GetVersion() = “); Serial.println(mfrc522.PCD_GetVersion());
Serial.println(“SET: mfrc522.PCD_SetAntennaGain(112);”);
MFRC522Constants::RxGain_48dB; // compiles but doesn’t set the gain
mfrc522.PCD_SetAntennaGain(112); // changes gain to max
Serial.print(“READ: mfrc522.PCD_GetAntennaGain() = “); Serial.println(mfrc522.PCD_GetAntennaGain());
Serial.println(F(“Scan PICC to see UID”));
}
Taken 2 weeks to get to this point..
I hope that helps..
Great.
Thanks for letting me know.
It will definitely be useful for our readers.
I’ll add a note in the tutorial about this.
I’ll mark this issue as resolved now.
Regards,
Sara
Hi, I read the tutorial which is very interesting. Regarding the trailer sector you say that if altered it could brick the tag or card. For security reasons I would like to change the KeyA, can I write a new value in place of the 6 bytes put in FF leaving the rest of the sector unchanged?
I program with VsCode + PlatformIO, s.o. Ubuntu.
Thanks
Hi.
Yes. You can write to KeyA.
But, make sure you remember the key later.
Don’t forget that then you need to change the code to use that key for authentication.
Regards,
Sara