Open Lennyz1988 opened 7 years ago
Hi @sjoerd1999 . Thank you very much for your quick response. I've tested your code but I don't get it works. I've bought too LD33V regulators but it doesn't works neither. The sensors are activated one after another like expected but they don't read the UID. I have checked the voltage received in the sensors and it is less than 3.3V (2,54V approx), i dont know if its because the output of the arduino are not 5v but between 3,23V and 3,64V.
I am using: Arduino Mega 2560, RFID sensord RC522 and LD33V regulators.
What I am doing wrong? Thank you
Using an older library version might help (I used the MFRC522 library from the Arduino IDE library manager, version 1.3.6).
When using the LD33V method, do the lights of the RFID readers turn off completely when not reading, or are they slightly dimmed? I had a problem with some versions of the RC522 where the chips did not turn off completely when disconnected from power and therefore still interfered. They should all blink one-by-one. Also make sure you connect the LD33V properly, (GND, RC522 3.3V pin, Arduino digital pin)
The RST method worked fine for me, maybe check the wiring again? Also make sure you use the right Arduino code, both methods have different code. RFIDmultiRST (1).zip
:)
I am downloading the library version 1.3.6 for testing... if not works i will test the RST method again.... Yes, the readers turn off completely when not reading, they blink one by one. And the LD33V is connected properly ... yes, Ive tested it with external 5V and the output is 3.3V. Input Voltage Min for LD33V is 4.4V and Iam checking that is not enough voltage at input, this is the most strangest thing...
Library 1.3.6 doesn't resolve the problem. Somebody know why digital output gives 3,6V instead 5V ??
Library 1.3.6 doesn't resolve the problem. Somebody know why digital output gives 3,6V instead 5V ??
How are you powering the Mega? If you power it via the Vin pin, you need at least 7V. If the digital pins only give 3.6V, you can also omit the LD33V, as the RC522 can handle voltages up to 3.6V. But it'll be better to fix the 5V problem to prevent stability issues...
I am powering trough USB for monitoring, and after I will power it with the electric transformer. If I connect only a wire the digital output is 4,4. If I connect the LD33V with the output to RFID sensor the digital output is 3,32 (and only 2,36 reaches the RFID sensor). If I connect the LD33V with the input to RFID sensor (same wire from digital output to RFID 3,3v pin through LD33V) the digital output is 3,03 (and then only 3,03 reaches the RFID sensor). I am breaking my mind with this, I don't understand it....
Many thanks @sjoerd1999 for all your help. I've got it works perfectly with 12 sensors!! Finally with RST method (that doesn't work first time I tried out)....
Many thanks @sjoerd1999 for all your help. I've got it works perfectly with 12 sensors!! Finally with RST method (that doesn't work first time I tried out)....
Gents, I am facing same issues you all described here. I need 5 RFID working although not simultaneously. I have tried to RST method without success. Joerd1999, do you mind share your code and how did you wire them? I need to finalise my school project. many thanks.
Gents, I am facing same issues you all described here. I need 5 RFID working although not simultaneously. I have tried to RST method without success. Joerd1999, do you mind share your code and how did you wire them? I need to finalise my school project. many thanks.
This is the code RFIDmultiRST (1).zip Did you get one RFID reader working? What board are you using? The wiring is quite straightforward, all readers connect to the same SDA/MOSI/MISO/SCK/GND/3.3V pins. Only the RST pin of each reader goes to a unique digital pin. These RST pins are declared in the code (the RSTpins[] array). Also make sure you use library version 1.3.6, as I don't know if it works with other versions
Thanks for such quick replay. Sorry disturbing you again: I am using a MEGA 2560 and 5 x RFID-RC522 I´ve been testing with your code, just modifying SDA pin ( I ´v used pin 30 ) and adding digital pins up to 5 for each RST instead of 3 MOSI,MISO,SCLK and SDA are common connexion and from there to 50,51 and 52 and pin 30 for SDA When running I am just getting “00000000” all the time , no one RFID RC522 is reading. 3.3V are supplied by same Mega, perhaps I need and external P.Supply?
[cid:image003.jpg@01D673B3.A295B9F0]
De: sjoerd1999 notifications@github.com Enviado el: sábado, 15 de agosto de 2020 15:06 Para: miguelbalboa/rfid rfid@noreply.github.com CC: Godall, Cisco Cisco_Godall@instron.com; Comment comment@noreply.github.com Asunto: Re: [miguelbalboa/rfid] Up to 5 devices simultanious (#290)
Gents, I am facing same issues you all described here. I need 5 RFID working although not simultaneously. I have tried to RST method without success. Joerd1999, do you mind share your code and how did you wire them? I need to finalise my school project. many thanks.
This is the code RFIDmultiRST (1).ziphttps://github.com/miguelbalboa/rfid/files/5078670/RFIDmultiRST.1.zip Did you get one RFID reader working? What board are you using? The wiring is quite straightforward, all readers connect to the same SDA/MOSI/MISO/SCK/GND/3.3V pins. Only the RST pin of each reader goes to a unique digital pin. These RST pins are declared in the code (the RSTpins[] array)
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/miguelbalboa/rfid/issues/290#issuecomment-674394312, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO4SBB3PAXLCKQX4DVEACALSA2B4NANCNFSM4DBBK7HA.
Thanks for such quick replay. Sorry disturbing you again: I am using a MEGA 2560 and 5 x RFID-RC522 I´ve been testing with your code, just modifying SDA pin ( I ´v used pin 30 ) and adding digital pins up to 5 for each RST instead of 3 MOSI,MISO,SCLK and SDA are common connexion and from there to 50,51 and 52 and pin 30 for SDA When running I am just getting “00000000” all the time , no one RFID RC522 is reading. 3.3V are supplied by same Mega, perhaps I need and external P.Supply?
The 3.3V pin of the MEGA can only supply up to 50 mA of current total. Since the readers need 20mA each, you might want to use a different 3.3V power supply. (A 3.3V regulator should work fine). (this might not be needed as the inactive readers don't consume as much, but still worth a try). Please try it first with 1 or 2 readers, then scale up to 5. Also, which digital pins are you using as RST pins? Don't use pins 0 and 1, as they are used for Serial. You could also try to use the ICSP header pins for the MISO/MOSI/SCK pins, instead of 51/50/52
Thanks so much for your help. After many test here below my findings. When I use a RFID in one arruino reliability is 100 % When 2 are connected to a single arduino reliability is 90%. With 3 RFID reliability falls down to 40% And with 4 MiSO together is about 20%, with 5 is no more than 10%. As I need a very reliable system and no much time left for more experiments I have added UNO’s for each RFID and all them connected with I2C. Now my project is 100% reliable. Is a very nice felling to know that there is a community ready to help. Thanks so much.
Emès des d’iPhone
El 16 ag 2020, a les 19:13, sjoerd1999 notifications@github.com va escriure:
Thanks for such quick replay. Sorry disturbing you again: I am using a MEGA 2560 and 5 x RFID-RC522 I´ve been testing with your code, just modifying SDA pin ( I ´v used pin 30 ) and adding digital pins up to 5 for each RST instead of 3 MOSI,MISO,SCLK and SDA are common connexion and from there to 50,51 and 52 and pin 30 for SDA When running I am just getting “00000000” all the time , no one RFID RC522 is reading. 3.3V are supplied by same Mega, perhaps I need and external P.Supply?
The 3.3V pin of the MEGA can only supply up to 50 mA of current total. Since the readers need 20mA each, you might want to use a different 3.3V power supply. (A 3.3V regulator should work fine). (this might not be needed as the inactive readers don't consume as much, but still worth a try). Please try it first with 1 or 2 readers, then scale up to 5. Also, which digital pins are you using as RST pins? Don't use pins 0 and 1, as they are used for Serial. You could also try to use the ICSP header pins for the MISO/MOSI/SCK pins, instead of 51/50/52
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/miguelbalboa/rfid/issues/290#issuecomment-674552389, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO4SBB5PZYQ6PJ52MZXUY7TSBAHTPANCNFSM4DBBK7HA.
after around million of trying and trying I discovered that the correct way to connect 4 RFID RC522 is to put them in the same line on test board except SS pins and the code as usual is ReadUidMultiReader from RFID library ... like this :
Hello, I have sketched two RFIDs and two load cells. When I combined the program between 2 RFIDs and 2 loadcells, the two RFIDs were read and the first loadcell was read but the second loadcell was not read. If the two RFID programs and loadcell programs are separated then the two RFIDs run normally and the two loadcells run normally. How can I combine the two programs so that they can run normally? Thank you Two RFID Code .txt Two Strain Gauge Code.txt
Hi all. I'm about to abandon the project i'm working on, because of the issues i'm facing... but before this, i would like to be sure i'm doing things correctly. In my project i should align 4 or 5 RC522 (proto using breadboard + esp32 + 5 antennas) to create an ideal line; each rc522 is separated from the other by 0,5/1 cm because i would like to have a countinous reading line as i don't know where exactly the tag will cross my "line". So first question is: is it a problem to have the antennas so close one to another? The second question is about response time: reading distance between tag and antenna is approx 1/1,5cm (so i think it's close enough), but the tag can cross the line quickly... is there something i can do the get tag reading faster?
thanks in advance to all
I had a problem with antenna gain in a multi-reader setting. I was breadboarding with 2 readers and their physical proximity meant that the increased gain was causing the two readers to see each other's signals and get confused.
@amkamyab I had the same issue before I initialized all CS pins to HIGH before the individual setup. Otherwise all RFID devices will respond simultaneously and you get crazy firmware readings.
This did the trick for me to solve intermittent initialization. What I did was:
// ---Set up RFID Readers---
const unsigned long spi_delay = 50; // Define a delay period to avoid SPI collisions
SPI.begin(); // Initialize SPI bus
delay(spi_delay); // Wait to avoid collisions
// Warm up the Chip Select (Slave Select) pins to avoid SPI collisions in the next step
for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
pinMode(ssPins[reader], OUTPUT);
digitalWrite(ssPins[reader], HIGH); // Set to high first
}
delay(spi_delay); // Wait to avoid collisions
// Set up the card and starting condition for each reader
for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) { // Cycle through each reader
mfrc522[reader].PCD_Init(ssPins[reader], RST_PIN); // Initialize each MFRC522 card by defining the slave select and reset pins
Serial.print(F("Set up reader "));
Serial.println(reader);
delay(spi_delay); // Wait to avoid collisions
}
All of the delays are probably overkill, but after wrestling with intermittent reader initializing (about half the time one random reader would not work, but not the same one each time), I figure it's a cheap price for not messing with it.
I've done 12 (at reasonable distance ~20ft)) cat 5e.
You should have no problem with 4,5 or 6.
I'd pull CS up though - I have never had much luck beyond 3 readers with CS floating. Sky is the limit if you pullup.
Also - I don't level shift. I've seen folks doing it, it's the right thing to do, but could not pull off level shifting beyond 1 reader. Could be the quality of the shifters I was using - I don't know. That said, the readers seem to work well at 5v signals - but I understand you are doing this at your own risk as 5v is over spec.
Hey just used this bit of advice to fix my solution using 8 RC522 and its working great. I set all the CS pins to be pullups, e.g. pinMode(2, INPUT_PULLUP);
Everything is consistent and I get clear data from the devices.
Hopefully this helps others like myself digging through the ancient posts.
I've done 12 (at reasonable distance ~20ft)) cat 5e. You should have no problem with 4,5 or 6. I'd pull CS up though - I have never had much luck beyond 3 readers with CS floating. Sky is the limit if you pullup. Also - I don't level shift. I've seen folks doing it, it's the right thing to do, but could not pull off level shifting beyond 1 reader. Could be the quality of the shifters I was using - I don't know. That said, the readers seem to work well at 5v signals - but I understand you are doing this at your own risk as 5v is over spec.
Hey just used this bit of advice to fix my solution using 8 RC522 and its working great. I set all the CS pins to be pullups, e.g. pinMode(2, INPUT_PULLUP);
Everything is consistent and I get clear data from the devices.
Hopefully this helps others like myself digging through the ancient posts.
Glad it helped.
Hi guys. I found the same problems using 2 rfid mfrc522. Only one random device worked at a time from the start. Thinking there was some initialization error, I tried to find the bug in the library that was causing the devices to initialize badly. I think the problem is related to how the library handles hard reset in the initialization phase. I SOLVE the problem with this trick: I remove the reset pin from the PCD_Init function with -1 for the rst pin like PCD_Init(ss_pin,-1) and in the setup part I add some code to make one hard reset for all the RFIDs and let the PCD_Init function just make a soft reset for each device. I make a function ad hoc to initialize all the modules for calling it in the setup with the purpose to call also in the loop if some devices stop working to hard reset all and make working again.
#include <SPI.h>
#include <Wire.h>
#include <MFRC522.h>
#define num_ele(x) sizeof(x)/sizeof(x[0])
#define RST_PIN 10 // Configurable, see typical pin layout above
#define SS_PIN_A 8 // Configurable, see typical pin layout above
#define SS_PIN_B 9 // Configurable, see typical pin layout above
byte ssPins[2] = {SS_PIN_A, SS_PIN_B};
MFRC522 rfid[2]; // Create MFRC522 instance
void init_rfids(){
pinMode(RST_PIN, INPUT);
if (digitalRead(RST_PIN) == HIGH) { // The MFRC522 chip is not in power down mode.
pinMode(RST_PIN, OUTPUT); // Now set the resetPowerDownPin as digital output.
digitalWrite(RST_PIN, LOW); // Make sure we have a clean LOW state.
delayMicroseconds(2); // 8.8.1 Reset timing requirements says about 100ns. Let us be generous: 2μsl
digitalWrite(RST_PIN, HIGH); // Exit power down mode. This triggers a hard reset.
// Section 8.8.2 in the datasheet says the oscillator start-up time is the start up time of the crystal + 37,74μs. Let us be generous: 50ms.
delay(50);
}
else{
pinMode(RST_PIN, OUTPUT);
digitalWrite(RST_PIN, HIGH); // Exit power down mode. This triggers a hard reset.
delay(50);
}
for(uint8_t i=0;i<num_ele(rfid);i++){
rfid[i].PCD_Init(ssPins[i],-1); //init Rfid Modules with only soft reset
}
}
void setup() {
SPI.begin(); //init SPI bus
init_rfids();
}
void loop(){
}
I hope you can solve the problem like I do.
Hello all ! I confirm @NeonBahamutZero post above, if using multiple readers with 1 reset line and multiple CS lines, you need to modify the library to only perform 1 hard reset. Otherwise on the first hard reset, the first RFID is initialised, the code moves to the second RFID, and I think when reading the RESET line it actually trigger another RESET, leaving the first reader uninitialized.
I am posting this to describe my experience in trying to get 5 RFID devices (MFRC522) to work at the same time using 1 Arduino.
This is also relevant to these posts:
https://github.com/miguelbalboa/rfid/issues/191
https://github.com/miguelbalboa/rfid/issues/277
https://github.com/miguelbalboa/rfid/issues/263
After a lot of trial and error I got 5 devices to work simultaneously using this library.
Make sure to use quality cables! I used CAT5E UTP cables to connect the RFID devices to the Arduino.
I started with 5 cables with a total length of 40 meters. I could get 2 devices to work reliable but I could not use the other 3 devices. So I repositioned the Arduino and cut the cables to about 15 meters length total (5 cables, 3 meter each). Maybe if you would use even better quality cables you can increase the length of the cables.
Try multiple RFID cards. I noticed after a while that some cards would work on one device but were not recognized on another device.
Make sure to have 1 or 2 backup MFRC522. When I couldn't figure out why one device would not read the tags when connected, I swapped it with one of my backups and it started working. Keep in mind that the device that could not read the card still works when connected on my breadbord. So maybe there is just to much interference for that device.
So now after many hours of trial and error I got 5 devices to work reliably, without any extra components, WITHOUT a multiplexer, over a total cable length of 15 meters.
I hope this helps someone.
NOTE: I only tested that it could recognize the card UID. I did not test if it could read the actual data on the card because that's not required for my goals.