This week was pretty fascinating for me. I am currently re-thinking my final project after having some conversations about the feasibility of a smart nicotine patch. I was thinking of possibly making a system for long-range RFID scanners to help optimize construction sites, so this week I decided to try out RFID tech. Or, I was thinking about making something to be a "master key".
I began by using the ESP32C3 Xiao that I have been using in past weeks, which is optimal because of its Bluetooth connectivity. I then grabbed an RFID kit from the maker space. Specifically, it was the Mifare RC522 RF IC Card Sensor Module. I looked up the documentation for this and found it was primarily used with the Arduino Uno. I also looked up a couple of YouTube videos of people demoing it. It seemed pretty simple to set up. I used Chat GPT to help make the equivalent connections with the ESP32C3 as with the Arduino Uno.
It gave me a list of connections and helped me with some startup code. I then got a breadboard and made the relevant connections. At first, it did not work. I got an error in the terminal because the library I used did not properly implement an if statement. I adjusted the source code of the .cpp file, hoping this would resolve the issue, but it did not. I spent some time re-wiring the connections, hoping something would work, but it still didn’t.
I thought the issue might be with my soldering. So, I soldered the RFID scanner to the header I was plugging into the breadboard. I hadn’t soldered it earlier because I’m not terribly good at soldering. It took me a while, but I eventually got the hang of it (though I’m still by no means good). Bobby in my section helped me out a bit. I then used a multimeter to check the connections, and they worked! I attached the soldered RFID card to the breadboard, and finally, it worked!
It scans the sensor cards in the kit as well as my Harvard ID. Interestingly, it did not scan my MIT ID. I think this is because MIT uses NFC, which operates at a different frequency, making the two technologies incompatible.
I am interested in building a module to see the information on the cards and potentially make a multi-use scanner.
Below is the code I used to set up the RFID scanner with the ESP32C3 Xiao:
#include
#include
#define SS_PIN 10 // SDA connected to GPIO10
#define RST_PIN 7 // RST connected to GPIO7
MFRC522 rfid(SS_PIN, RST_PIN); // Create an instance of the RFID reader
void setup() {
Serial.begin(115200);
SPI.begin(6, 5, 4); // SCK, MISO, MOSI
rfid.PCD_Init(); // Initialize the RFID module
Serial.println("RFID Reader initialized.");
}
void loop() {
// Check if a card is present
if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial()) {
Serial.print("Card UID:");
for (byte i = 0; i < rfid.uid.size; i++) {
Serial.print(rfid.uid.uidByte[i], HEX);
Serial.print(" ");
}
Serial.println();
rfid.PICC_HaltA(); // Stop reading the card
}
}
For the group assignment this week, we used a force sensor to measure the input signal for both analog and digital. For analog we segmented by differnet thresholds that were returned. This is the nature of analog since it reutrns things on a specturme while, Digital is just 0 and 1. We messed around with an esp32 xiao to measure its digital and analog signals