Skip to content

Latest commit

 

History

History
92 lines (64 loc) · 6 KB

File metadata and controls

92 lines (64 loc) · 6 KB

Hardware Setup Guide

This document describes how to connect the MFRC522 RFID reader to the ESP32 Cheap Yellow Display (CYD) and details the hardware modifications required to support battery vs. USB power detection.

The RFID modules communicate via SPI. To keep the screen functional and high-performance, we connect the reader to the VSPI bus (SD card slot pins), while the display operates on the HSPI bus.

1. Choosing an NFC Module

Warning

Firmware Matching Required: You must flash the firmware variant that matches your purchased module. If you wire a PN5180 but flash the MFRC522 variant (or vice versa), the reader will fail to initialize on boot. You can select your correct module in the Web Installer's dropdown menu before flashing.

Two modules are supported. Choose based on the tags you intend to use:

Feature MFRC522 PN5180
ISO14443A ✅ Yes (NTAG, Mifare) ✅ Yes (NTAG, Ultralight)
ISO15693 ❌ No ✅ Yes (ICODE SLIX)
OpenSpool ✅ ISO14443A only ✅ Full support
OpenPrintTag ✅ ISO14443A only ✅ Full support
OpenTag3D ✅ ISO14443A only ✅ Full support
Bambu Lab ☑️ Read-only ☑️ Read-only
Snapmaker ☑️ Read-only ☑️ Read-only

Wiring Reference

Please wire your chosen RFID module to the CYD as follows:

RFID Pin CYD Pin Location Description
3.3V / 5V 3.3V / 5V Power rail (see note)
GND GND Ground / 6th pin from left
SDA (CS/NSS) IO5 2nd pin from left
MOSI IO23 3rd pin from left
SCK IO18 5th pin from left
MISO IO19 7th pin from left
RST IO22 Available on P3/CN1 connector
BUSY* IO27 Available on P3/CN1 connector

*Note: BUSY pin is only required for the PN5180 module. Also, while the MFRC522 runs on 3.3V, the PN5180 module requires 5V on its VCC pin to provide enough power for the antenna driver (TVDD) to read ISO15693 tags reliably.

(Note: With the board oriented as shown in the image below, Pin 1 is on the far left.)

Location of pin 1

I soldered tiny wires from a ribbon cable directly to the pins on the back of the CYD. I strongly recommend using a microscope to do this, as the pins are very small and close together. I also recommend tinning the wires before soldering to make it easier.

spi_pins_soldered

2. Power Detection & Battery Modification

Warning

The Power Management feature and Battery support are not yet implemented in the firmware!

Standard CYD boards do not have an onboard battery charging circuit or a dedicated way to detect if the board is powered via USB (5V) or an external battery.

To support the Power Management feature (which turns off the display on USB or enters deep sleep on battery after 60 seconds), you need to modify the board to allow the ESP32 to measure the incoming voltage.

Voltage Divider Mod

The easiest approach to measure voltage without modifying the CYD board itself is to use IO35, which is purely an ADC input pin physically broken out on the CYD's P3/CN1 external connector.

  1. Wire a Voltage Divider externally from the main power rail (V-In / 5V rail) to the IO35 pin on the CYD connector:
    • Connect a 100kΩ resistor from the main power rail (e.g. your battery/USB input junction) to IO35.
    • Connect a second 100kΩ resistor from IO35 to GND.
  2. How it works:
    • When powered by USB (5V), the 100k/100k divider presents roughly 2.5V to the IO35 ADC pin.
    • When powered by a Lithium Battery (3.7V - 4.2V), the voltage drops to roughly 1.85V - 2.1V.
    • The PowerManager automatically reads the analog value on IO35. By comparing this voltage gap, it easily determines if you are docked to USB or running purely on the battery. With 100kΩ resistors, the phantom power draw is practically zero (just 25µA), greatly extending your device's deep sleep battery life!

Waking from Deep Sleep

When running on battery power, the device will eventually enter Deep Sleep to conserve energy.

  • To wake up: Press the physical RST (Reset) button located on the back or side of the CYD. This hardware interrupts the ESP32 and restarts the boot cycle, immediately jumping back to the Scanning interface.

3. 3D Printed Case

You can find 3D printable case files for this project inside the cad/ directory at the root of the repository:

4. CYD Hardware Versions (1-USB vs. 2-USB)

There are two main versions of the "Cheap Yellow Display" on the market:

  • Original (1-USB): Features a single Micro-USB port for power and programming.
  • Newer (2-USB / ESP32-2432S028R): Features two USB ports (one Micro-USB and one USB-C).

Color & Gamma Fix for 2-USB Version

The 2-USB version often uses a different display panel that appears with inverted colors (e.g., black appears white) and washed-out gamma by default.

To fix this, connect to the Serial Terminal and run: set cyd2usb 1

After running the command, restart the device. The firmware will then apply the correct color inversion and a specific gamma correction table to make the display look vibrant and correct.