Home Creators Posts Import Register Favorites Logout

Content

Hi folks, 

I've mentioned the PN5180 RFID sensor before (in my RFID roundup), but I've not used it in a complete project up to now, so in this video I'm hoping to address that!

RFID sensors are a commonly-used method to provide the "magic" behind any Escape Room tech puzzle that requires particular items to be placed at certain locations. A hidden tag placed in a prop is detected by a hidden sensor somewhere positioned underneath a surface or spot on the wall, for example. The problem is that the detection range for most common proximity sensors is limited to only a few centimetres, and the tag generally has to be axis-aligned to the sensor. The PN5180 RFID chip in this project is a vicinity sensor instead. That means it has a greater detection range - I reliably get around 25cm in this project - and ultimately able to provide a better player experience since it allows a greater tolerance in exactly where the item containing the tag can be positioned.

I've also tried to take this opportunity to address a few issues that people mentioned from my first RFID puzzle tutorial - namely, I've now incorporated a "reset" card that can be swiped over any sensor to reset the puzzle when complete, and I've also tried to better explain how I use RJ45 sockets to allow you to connect sensors via Cat5 ethernet cables. Finally, I'm also now using an ESP32-based controller, which is significantly faster, has more memory, and features (i.e. Bluetooth, WiFi) than an Arduino, and it runs at 3.3V which is the operating voltage for these sensors - if you're currently using an Arduino-based setup, I've tried to cover some of the factors you might want to bear in mind if you are considering upgrading to ESP32 - they're great little boards, but there's a few gotchas to watch out for!

I hope you find it useful, and as always please ask if anything is not clear or if you have any questions. I'll put up a separate post with links to the resources shortly!

And finally, I wish you all a very Merry Christmas, and a happy and peaceful New Year. 

I'll see you all in 2021. Fingers crossed! x

Files

Long-range RFID Vicinity Sensor Christmas Escape Room Puzzle Tutorial using PN5180 and ESP32

RFID ("Radio Frequency Identification") technology is widely-used in all sorts of applications - ID cards, inventory tracking, pet microchips - and it's also the "magic" behind escape room interactions where a door opens (or any other action) after players position a series of items in the correct positions to solve a puzzle. Each item has an embedded RFID tag with a unique ID, and when tags of the correct ID are positioned in front of an array of sensors, a relay is triggered which powers the desired output. Now, if we want players to suspend their disbelief that they are not really positioning props embedded with RFID cards but actually placing objects with some mystical power, we need those RFID tags to be detected as smoothly and seamlessly as possible. The sorts of RFID sensors typically used in an escape room are based on the ISO14443 protocol for proximity sensors, which require tags need to be positioned accurately within only a few centimetres of the sensor (as if holding up an ID card to a security-controlled door access panel) - and this can limit the player's experience. In this video, I'll demonstrate how you can use a PN5180 sensor that uses ISO15693 *vicinity* sensors instead: these work in almost exactly the same way as a regular RFID proximity sensor - by detecting passive tags that can be embedded in props - but have a significantly greater detection range. The setup shown can reliably detect tags up to around 20cm-30cm from each sensor, they do not have to be axis-aligned, and you can build it yourself for around $30. Timings --- 00:00:00-00:02:06 Introduction 00:02:07-00:06:09 Hardware Overview 00:06:10-00:09:01 Demonstration with Debug Output 00:09:02-00:17:42 Hardware In Detail 00:17:43-00:29:14 Wiring 00:29:15-01:03:37 Arduino IDE Code Listing 01:03:38-01:05:51 Wrapup Hardware Used --- - ESP32. I'm using an ESP32 board with a 38-pin NodeMCU-32s pinout, such as https://www.banggood.com/custlink/mvKdtuWZHH . ESP32 dev boards come in many varieties with different pin layouts. If you are using a 36-pin board, such as https://www.banggood.com/custlink/Gv3EPwWSFZ , please be sure to use the appropriate pins! - PN5180 RFID Sensors: https://www.aliexpress.com/item/32840851498.html - RJ45 Breakout Board https://www.banggood.com/custlink/33DdPfJiqo - MP3 Player https://www.banggood.com/custlink/mGmhH7WngV - 5V Relay Module https://www.banggood.com/custlink/mmGRtfrnQv (Sorry - I don't have a link to the particular Christmas lights I'm using - they came down from the loft!) Code & Wiring Downloads --- If you'd like to support me making more video tutorials explaining how to use tech in escape rooms and other playful settings, please check out my Patreon at https://www.patreon.com/playfultech, where you can also find code downloads, wiring diagrams, and additional resources for this and all my other tech projects.

Comments

RJ Hemy

Can you possibly add some code to these RFID puzzles that allows us to swap a card out with a push of a button similar to the toggle switch game?

Doug

What Mp3 module do you use for this project?

myst

hi Alastair can you tell me what code is needed to accept iso 14443 tags with card thanks so much

Steve Schoenberger

Hey Alastair, I got code up and running. However, after card reads nothing solves. The reset card reads but does nothing. When my cards are read they are read as CAFFA035301004E0, the correct card in the code looks like this 0xCA,0xFF,0xA0,0x35,0x30,0x10,04E0. Would this cause it to not solve?

Daniel S Vance

Where can I find the code I used to see it but not here any more

Gabriel MacKelligon

Hello. Can you make project just to read tag from PN5180? Let's say we use or same ESP32 or ESP12? And do they read tag of bank's cards? As I know they support ISO14443 Thanks.

Roy Johnson

Greetings and salutations Alastair. I'm on day three and if you have the time. I need an assist. I'm using a ESP32, DY-HV20T, one PN5180 and three ISO15693 cards. Since I'm still learning I was trying to use your code to do this: Read one card play a specific sound. Read card two play a random sound. Read card three play a random sound. That's all. I'm confident everything is wired properly because I first made sure I duplicated your puzzle and it worked, so awesome! I'm struggling with the coding for sure. I placed the player.playSpecified(6); under the digitalWrite(relayPin, LOW) in the void onPuzzleSolved but just the relay activates. No sound is played. Thank you, hugs and high fives!

John Irvine

Hi Alastair I am trying to use multiple ID Tags for the reset. Having just one isn’t practical for my escape room. Each game master really needs their own. Would you be willing to show me what code needs to be changed to add multiple reset ID cards? Also I would like to have a solution when I need to replace a broken prop and I don’t want to recode the ESP32 for the solution ID Tag. One solution is reprogrammable ID cards. Do you know if such a thing exists for ISO15693 cards? Thank you!

Daniel S Vance

Hello after building any trying. I found if only using 2 sensors any longer cat cable over 10 feet would cause it to be unstable. if one sensor I could go 15 feet. 3 sensors when try 6 feet works 90 percent of the time. when doing for 3 had to split to a 2 and a 1 if needed 6feet cat cables. I tried going to cat 8 for the shielding in case it was noise it did not make a difference. Do you know should I be able to use longer cat cables and it be stable? I use a 30 amp stepper power supply and a 2a voltage regulator to send 5V to the esp32. I even tried pushing the voltage up to 5.2V no change.

Chester Rino

I always have a problem where as soon as i connect more then one rfid sensor, they stop reading. One wrks fine, but a second one just screws it up. I think its somehow muddying up the SPI signal to the microcontroller. Any idea how to remedy this? Could it be that im using rfid sensors from ebay and they are a bit dodgy?

Jonathan Bauduin

On the diagram , I count 9 wires , but rj45 count 4 pair so 8 wires , so in this case rj45 is no usable right ? or you need to have , one cable for the GND , per haps? Am i right ?

Jolyon Jenkins

Thanks for the thorough run-down. For now I'm sticking with Arduino and using the pro mini which also runs at 3.3V. I can get the library example to work, but the read distance is disappointingly low - about 3cm. I am using small disc tags of about 1cm diameter. Have you (or anyone) experimented with using the glass tubes (the ones meant for pets)? I can't source any in the UK and don't want to fork out for a big batch from China unless I'm sure they'll work better.

Jolyon Jenkins

Having bought some - the answer is - they're not much better

Adrian Plaw

Hi Alastair, Not sure what I am doing wrong but I cant seem to get any cards read, tried the card and the button inc with the PN5180. 15:20:33.111 -> ets Jun 8 2016 00:22:57 15:20:33.111 -> 15:20:33.111 -> rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT) 15:20:33.111 -> configsip: 0, SPIWP:0xee 15:20:33.111 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 15:20:33.111 -> mode:DIO, clock div:1 15:20:33.111 -> load:0x3fff0018,len:4 15:20:33.111 -> load:0x3fff001c,len:1044 15:20:33.111 -> load:0x40078000,len:10124 15:20:33.111 -> load:0x40080400,len:5856 15:20:33.156 -> entry 0x400806a8 15:20:33.249 -> C:\Users\adrian\Downloads\arduino-rfid-PN5180\arduino-rfid-PN5180.inoJun 19 2021 15:20:33.249 -> Reader #0 15:20:33.249 -> Initialising... 15:20:33.249 -> Resetting... 15:20:33.249 -> Enabling RF field... 15:20:33.295 -> Setup Complete

Adrian Plaw

I just have one reader connected at the moment, tried a different reader, same issue. Its an old ESP32-Wroom-32 and not the 32D. (a 32D arriving tomorrow) I am wondering if its the cards supplied with them. On my phone they show up as ISO 14443-3A - so having just re-watched your video this may be the case they only supply the proximity card. thank you

Jérémy Pellegrin

Hi Alastair, Thank you for your creation. I have a question, is it possible to replace one of the four PN5180 by one RC522 (just one of them) ? Or modification are necessary ? thank for your help

Anastasia Thanukos

Hi Alastair, Thank you for this fun project! I've got it all working and modified the code to suit my needs. However, I can only get ~10cm range on detection for the cards and only ~5cm on the fobs -- and that's when they are optimally aligned with the sensor. Any ideas for me? Thank you! Anna

Anastasia Thanukos

Hi Alastair and Katelyn, I did not figure it out. But I do get a better range using the cards rather than the fobs -- and if you shine a bright light through the card, you can see there is a bit to trim off safely around the antenna if you want to make your tag smaller. That has gotten me a sufficient range for my project. @Alastair, I got mine from the link you posted and also ordered some from two different sources Amazon and have the same problem. I have the problem even when the card is just hooked up on my desk in prototype with nothing nearby or surrounding it. And I also though it might be short on amps so I tried giving the sensor its own 5V power source with 3A max output. So I'm stymied!

Anastasia Thanukos

Katelyn, my passive tags are from the same source as the sensors -- though I consistently received fobs that don't work for PN5180 (I've seen lots of reports of this on other boards - so I ordered a separate batch of fobs that work), they did send cards that work. My project is installed inside a prop already, but I'll set it up again in prototype and add the code later this week, unless Katelyn can easily do this.

mike Johnson

Hi Alastair and all others, I am completely new to all this so forgive me if this is a very basic question but I am trying to read cards using a PN5180 reader connected to an ESP32 (DIOT ESP32 DEVKIT V1 and Just CANNOT get it to read cards or fobs. I have 13.56Mhz (ISO 14443) cards as well as 125 Khz EM 4305, T5577 cards as well as the 2 cards that came with the Reader, But not getting anything from any of them. Help please!!

Jolyon Jenkins

Thanks so much for the library. I would really like some code that lets you program the ISO15693 tags with a string (and then later read that string), rather than using the unique id of that tag. How easy would that be?

Xiao ping Chen

Hi Alastair, I have become your paid member. I'm interest in your project--"RFID Vicinity Sensor Tutorial (PN5180 and ESP32)". I use the same RFID board as you used: it is PN5180-NFC (R1.1-170710) as a card reader. I also use ESP32 (ESP32-PICO-MINI-02) to be a host MCU to read a card. Can you share me your ESP32 codes and system diagram? Where can I download the all document including the ESP32 codes of this project? Best regards, Xiao Chen