I have a SparkFun Qwiic RFID breakout board (with ID-12LA reader) attached to an ESP32 ‘Feather’ board from Adafruit.
It runs an Arduino sketch that simply takes the tag information and sends it as keyboard input to the computer it’s attached to.
95% of the time, this works as intended. However, there is glitch that happens when a tad is scanned but the Arduino will send “-1-1-1-1-1-1-1” to the computer, over and over again. Sometimes this stops and the tag number is submitted, but often I have to unplug the device from the computer.
I have tried different things with the code, like slowing things down with delays, and removing the “print.serial” instruction… but this glitch still happens.
Here is the code running on the arduino board:
#include <Wire.h>
#include "Keyboard.h"
#include "SparkFun_Qwiic_Rfid.h"
#define RFID_ADDR 0x7D // Default I2C address
// Interrupt Pin on pin 5.
const int intPin = 5;
String tag;
int ledPIN = 13;
Qwiic_Rfid myRfid(RFID_ADDR);
void setup()
{
pinMode(ledPIN, OUTPUT);
// Begin I-squared-C
Wire.begin();
//Serial.begin(50000);
if (myRfid.begin())
Serial.println("Ready to scan some tags!");
else
Serial.println("Could not communicate with the Qwiic RFID Reader!!!");
// Put the interrupt pin in a known HIGH state.
pinMode(intPin, INPUT_PULLUP);
// Want to clear tags sitting on the Qwiic RFID card?
Keyboard.begin();
}
void loop()
{
digitalWrite(ledPIN, HIGH);
// If the pin goes low, then a card has been scanned.
if (digitalRead(intPin) == LOW) {
tag = myRfid.getTag();
delay(50);
//Serial.println(tag);
Keyboard.println(tag);
delay(50);
Keyboard.press(KEY_LEFT_CTRL);
delay(50);
Keyboard.press('a');
Keyboard.releaseAll();
Keyboard.end();
digitalWrite(ledPIN, LOW);
}
delay(1000); // Geeze, woah! Slow it down mate.
}
When I tried this, the reader’s light blinked as if it read a tag, but it took about 10 seconds for anything to show up, and when it did, it was “-1-1-1-1-1-1” repeatedly.
And I am pretty sure I damaged the i2c traces to the point where I can’t add bridge the pads with solder…so that’s not great.
If I used a Qwiic wire to connect to the board, I still have an issue with the i2c traces being cut, correct?
Correct…but it’s pretty hard to damage beyond use (unless the whole pads are ripped off…even then you can still wire in a resistor and use the PTH’s SDA/SCL)
Share a photo of what it looks like and we’ll go from there
What I’m referring to: Instead of using an on-board resistor, you can just wire a comparable resistor to the alternate pins…usually you need to snip the legs off the IC and solder the resistor between the header’s pad and the snipped legs
The resistors should be wired as pull-ups. Take one resistor, connect one end to the SDA header pin. Take the other end and connect it to the 3V3 header pin.
Take the second resistor, connect one end to SCL, and the other end to 3V3