Hang on, that phrase sounds familiar no? That’s exactly what Bluetooth has been doing for years and years. NFC devices transmit parcels of data via radio frequencies to other NFC devices. This all happens behind-the-scenes and instantaneously (depending on the strength of the WiFi signal) guarantees the end user a seamless experience. The server will then authenticate the request and prompt the reader to perform some relevant action, be it unlocking a door, communicating with a bank server, unlocking a subway turnstile, etc. Most readers only cache a small amount of information and have a method of communicating with the primary server-since storing all the relevant user info on a reader would be impractical, insecure, and would result in too bulky a product. Signal Relaying Back to the ServerĪfter the reader reads the ID, based on the use case, the reader will then communicate this information back to the host server over local network or WiFi. Depending on what type of token it is, the nature of this string will change: If it’s a simple ID reader, then the string is a unique identifier for the user if it’s a transit card then it’s an ID, but on the back end the reader needs to record the charge and update its server, and if it’s a contactless payment card, then it’s an ID with many added layers of encryption and security to protect the user’s bank information (in this case, only a dedicated and approved reader could decrypt the information relevant to the bank details, any other reader would only be able to read a simple ID string). mfrc522.The NFC reader induces a magnetic current in the token and, in turn, the token transmits the relevant string of characters. Serial.println(“Disconnecting from server”) Ĭlient.stop() // DISCONNECT FROM THE SERVER String jsonData = “” Ĭlient.println(“POST /api/services/input_text/set_value?api_password= HTTP/1.1”) Ĭlient.println(“Content-Type: application/json”) Serial.print("RFID Detected with UID: ") We start by connecting to a WiFi network Serial.println(F(“Scan PICC to see UID, SAK, type, and data blocks…”)) Mfrc522.PCD_DumpVersionToSerial() // Show details of PCD - MFRC522 Card Reader details PinMode(BUILTIN_LED2, OUTPUT) // Initialize the BUILTIN_LED2 pin as an outputĭigitalWrite(BUILTIN_LED1, LOW) // Turn the LED ON by making the voltage LOWĭigitalWrite(BUILTIN_LED2, HIGH) // Turn the LED off by making the voltage HIGH PinMode(BUILTIN_LED1, OUTPUT) // Initialize the BUILTIN_LED1 pin as an output MFRC522 mfrc522(SS_PIN, RST_PIN) // Create MFRC522 instance #define SS_PIN 15 // Configurable, see typical pin layout from HappyBubbles NFC #define RST_PIN 2 // Configurable, see typical pin layout from HappyBubbles NFC Sweeet!Ĭonst short int BUILTIN_LED1 = 2 //GPIO2Ĭonst short int BUILTIN_LED2 = 16 //GPIO16 I put these all together in an afternoon and now have a NFC reader which triggers a Spotify playlist on my Bose speakers. I went with input_text to receive the UID. Full library + example is available for ESP8266. I gave up trying to flash existing BINs out there so instead wrote my own and this turned out to be much easier than expected.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |