Hello, lately I have been trying to translate the Vivokey chipscanlib into an Arduino sketch. The chipscanlib has a lot to unpack, so currently I have only worked towards Spark 2 capabilities (my implant of choice.) AT THIS TIME THE SKETCH DOES NOT WORK. But I believe it is very close… The sketch is dependent on the ArduinoJson Library and the Seeed-Studio PN532 Library. I’m not a professional coder and I don’t know how to use Github, so please take this collection of code snippets that I haphazardly threw together with a grain of salt. I tried my best to comment everything.
Written for ESP32-DEVKIT V1.
Uses the Touchpad-Wakeup to boot up when a specific capacitive pin is touched to save energy.
Success is marked by pin 22 turning on then off, and the onboard led flashing.
The default SPI clock speed of the ESP32 is too high for the PN532. The SPI clock speed is set by the PN532 library to 1/8th the CPU clock speed, this means by default the SPI clock speed will be 30MHz. The problem with this is, the PN532 has a maximum SPI clock speed of 5MHz. To fix this, we can either slow the CPU by using the Arduino IDE, or we can edit the PN532 Library to set a larger divider. Since lowering the CPU speed enough will disable WIFI/BLE communication, a larger divider is the only option. To do this, open PN532_SPI.cpp and change:
Now when the CPU clock speed is 240MHz, the SPI clock speed will be 3.75MHz. Perfect for a PN532.
Since it is the projects category, here is my setup that I dipped in resin Ft. the first PCB I ever designed: