I am having issues connecting the sparkfun RFID reader ( SEN-15191) to my Arduino R4. I have the qwiic connector connected between devices and the int pin on the RFID reader connected to pin 8 on the R4 (have tried pins 5,6,7,9 as well). I have the RFID reader board paired with a 12LA RFID reader. When I use “Example1_Read_Tag_Basics” code in the sparkfun library, I get the message that communication to the RFID reader was unsuccessful.
After changing those lines, I got the error “no matching function for call to 'Qwiic_Rfid::begin(TwoWire*).” The compiler gave me a note “no known conversion for argument 1 from ‘TwoWire*’ to ‘TwoWire&’” so I changed if(myRfid.begin(&Wire1) —> if(myRfid.begin(Wire1)) and this allowed the code to compile and gave me the serial message indicating myRfid.begin was successful. However, I am now getting the issue that when I scan an RFID tag, the serial monitor doesn’t print anything. I have 2 12LAs I tried using and I got them working on an Arduino R3 recently so I don’t think it’s a hardware issue.
I feel like my workaround of removing the “&” is probably where the issue lies but I am unsure how to reference the memory address without getting this error.
Ok, so I think the issue may be the pull-up issue you referred to. I found some code to do an I2C scan and the device was found on Wire1 at address 0x7D (just like it says it should be in the setup guide). With some trial and error, it seems the RFIDs are getting stuck in the buffer. If I type “1” in the serial monitor, it returns “Tag ID: 000000 Scan Time: 0.00.” If I first scan an RFID card and then type “1” in the serial monitor, it prints the TAG ID of the scanned RFID card (i.e. Tag ID: 300241163140192 Scan Time: 3.89), then typing “1” again gives the TAG ID 000000.
I am still relatively new to arduino and am a bit confused on how pull-up/pull-down works. Could you clarify what is going on here?
In simple terms: The way i2c works is that either the controller (UNO board) OR the peripheral (the RFID reader) pulls the line to GND to indicate a zero. Otherwise, they release the line. When released the voltage on the line is set high by the pull-up resistor, in order to be able for the line to be pulled LOW by the controller or peripheral later on. Without resistors, the line is floating on “whatever” voltage causing misreadings, but when the resistor value is too it might not be able to pull it low strong enough to be detected.
In this case, the UNO R4 Wire1 has 5.1K pull-up on SCl and SDA and the RFID reader 2.2K. Those are in parallel and as such the combined value is 1.54K. I consider that very low. Normally it is around 4.7K to 10K. Hence the advice to cut the links on the RFID reader.
Next to that, It might be timing and/or detection. Try adding this in loop() instead
if (Serial.available() > 0){
serialInput = Serial.read();
if (serialInput == 49){ // "1" on your keyboard is 49 in ASCII
tag = myRfid.getTag();
if (tag.toInt() != 0) {
Serial.print("Tag ID: ");
Serial.print(tag);
scanTime = myRfid.getPrecReqTime();
// If this time is too precise try:
// long time = myRfid.getReqTime();
Serial.print(" Scan Time: ");
Serial.println(scanTime);
}
else {
Serial.println("No tag detected");
}
}