Change of Plans
I initially wanted to use the "SparkFun Simultaneous RFID Reader - M6E Nano", however my local Sparkfun resellers do not plan to bring in any stock. I chose that RFID reader because it was a UHF long range RFID reader which will be needed if my smart inventory system is placed in a large storage space. It is unfortunate that I couldn't get one. Many other UHF RFID readers on the market are meant for industrial use and I cannot possibly afford it (costing from a few hundreds to thousands of dollars). I wanted to at least have a fully working prototype, so I had to look for alternatives.
Furthermore, I realised that the Cypress PSoC 6 Kit does not have a lot of GPIOs left. This is because the LCD display module takes up most of the pins. I found out there are no exposed hardware UART pins, SPI pins or I2C pins. (Technically, I can share I2C with the one for the KitProg).
With the constrain on the pins, I decided to choose the MFRC522 RFID Reader module which requires only SPI. SPI is very easy to bit-bang and I am familiar with the MFRC522 because I have used once when I first started with Arduino programming.
Testing the MFRC522 Module
I first verified that my module works using the Arduino examples.
And it works, so I ported the Arduino C++ library to a C library so I can use it with my Cypress PSoC.
As for wiring, I tapped off VDD and GND from the Pmod connector. I wanted to avoid soldering, so I used long socket pins to make a friction fit.
For the SPI pins, I connected it as follows:
- MOSI = P6_2
- MISO = P6_3
- SCK = P9_6
- SDA = P9_7
- RST = P13_7
Shown in the above picture is the debug screen. The RFID card UID is being read.
That is it for today. The hardware is 100% completed for this project. The next post will be to have the RFID reader upload the card detected to AWS. I will then simulate an inventory with RFID tags and make a demo video for you to see soon!