# Wiring Adafruit Feather ESP32-S3 with the Waveshare 4.2" e-Paper Module (SKU 13353, 400×300, b/w). The pin numbers are also constants in [`src/board.py`](#board). ## Display (SPI) | Display | Feather | GPIO | Function | |---------|---------|------|----------------------------------------------------| | VCC | 3V | – | 3.3 V supply | | GND | GND | – | Ground | | DIN | MO | 35 | SPI MOSI (data to the display) | | CLK | SCK | 36 | SPI clock | | CS | D10 | 10 | Chip select, active low | | DC | D9 | 9 | Low = command, high = data | | RST | D6 | 6 | Reset, active low | | BUSY | D5 | 5 | Display busy (input) | | PWR | D11 | 11 | Supply switch (only newer modules with a 9-pin cable) | MISO is not needed; the display sends no data back. ## Already in use | Function | GPIO | Note | |------------------------------|------|----------------------------------------------| | I²C SDA (MAX17048) | 3 | Fuel gauge at address 0x36 | | I²C SCL (MAX17048) | 4 | | | I²C power | 7 | Must be high for the fuel gauge to run | | Onboard LED (D13) | 13 | Left free | | USB detection (A5) | 8 | Voltage divider, see below | A0–A4 (GPIO 18, 17, 16, 15, 14) are still free, for buttons for instance. ## USB detection A voltage divider tells the board directly whether USB power is present: ``` USB ──[68 kΩ]───┬── A5 (GPIO 8) │ GND ──[100 kΩ]──┘ ``` It brings the 5 V of the Feather's "USB" pin down to about 3.0 V (3.1 V at 5.25 V), within the ADC's range (up to about 3.1 V with 11 dB attenuation) and safely above the level the pin needs to count as high (about 2.5 V): plugging in USB then wakes the board from deep sleep at once. The board counts it as USB power from 4.0 V before the divider. Current only flows while USB is plugged in, and then from USB, so it does not drain the battery. A5 is on ADC1, which works alongside the WLAN. Enable it with [`USB_SENSE_PIN`](#defaults.USB_SENSE_PIN) `= 8` in `src/config.py`; other resistors need [`USB_SENSE_DIVIDER`](#defaults.USB_SENSE_DIVIDER). A 100 kΩ/100 kΩ divider (ratio 2) measures fine, but at 2.5 V it is too close to the threshold to wake the board reliably. `http://epaper.local/battery` shows the measured USB voltage (`usb_volts`) for checking. Without the divider the board guesses USB power from the fuel gauge (charging, or full and stable); that takes a few minutes, and the battery recovering after a long awake phase can read as charging.