> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/benz206/SpotifyMacroBoard/llms.txt
> Use this file to discover all available pages before exploring further.

# Pin configuration

> Complete GPIO pin mapping and hardware configuration for Spotify MacroBoard

## Button pins

The MacroBoard uses seven GPIO pins for button inputs, configured with internal pull-up resistors.

<ParamField path="SHUFFLE" type="GPIO 4">
  Toggle shuffle mode on/off in Spotify playback
</ParamField>

<ParamField path="VOLUME_DEC" type="GPIO 5">
  Decrease playback volume
</ParamField>

<ParamField path="VOLUME_INC" type="GPIO 12">
  Increase playback volume
</ParamField>

<ParamField path="LOOP" type="GPIO 13">
  Toggle repeat/loop mode in Spotify
</ParamField>

<ParamField path="BACK" type="GPIO 14">
  Skip to previous track
</ParamField>

<ParamField path="PAUSE_PLAY" type="GPIO 25">
  Toggle play/pause state
</ParamField>

<ParamField path="SKIP" type="GPIO 26">
  Skip to next track
</ParamField>

## I2C pins

The OLED display uses the I2C protocol for communication.

<ParamField path="SDA" type="GPIO 21">
  I2C data line for OLED display communication
</ParamField>

<ParamField path="SCL" type="GPIO 19">
  I2C clock line for OLED display communication
</ParamField>

<Info>
  The I2C bus runs at 400 kHz for faster display updates.
</Info>

## LED pin

<ParamField path="LED" type="GPIO 18">
  WS2812B RGB LED strip data pin
</ParamField>

## RGB LED configuration

The MacroBoard uses an addressable LED strip for visual feedback.

<Accordion title="LED strip specifications">
  <ParamField path="Chip type" type="WS2812B">
    Addressable RGB LED chip
  </ParamField>

  <ParamField path="LED count" type="20">
    Number of LEDs in the strip
  </ParamField>

  <ParamField path="Color order" type="GRB">
    Green-Red-Blue color byte order
  </ParamField>

  <ParamField path="Brightness" type="230">
    Maximum brightness level (0-255)
  </ParamField>

  <ParamField path="Power limit" type="5V @ 500mA">
    Maximum voltage and current draw
  </ParamField>

  <ParamField path="Update rate" type="100 Hz">
    LED updates per second
  </ParamField>
</Accordion>

<Warning>
  Ensure your power supply can handle 500mA at 5V when running all 20 LEDs at full brightness.
</Warning>

## OLED display configuration

The display uses the SSD1306 driver with I2C communication.

<Accordion title="Display specifications">
  <ParamField path="Driver" type="SSD1306">
    OLED display controller chip
  </ParamField>

  <ParamField path="Resolution" type="128x64">
    Display width and height in pixels
  </ParamField>

  <ParamField path="I2C address" type="0x3C">
    Hardware I2C address for the display
  </ParamField>

  <ParamField path="Reset pin" type="-1">
    No hardware reset pin used (software reset only)
  </ParamField>

  <ParamField path="Clock speed" type="400 kHz">
    I2C bus frequency
  </ParamField>
</Accordion>

## Pin initialization

All button pins are configured as inputs with internal pull-up resistors enabled. The buttons should connect the GPIO pin to ground when pressed.

```cpp theme={null}
for (int i = 0; i < 7; i++) {
    pinMode(keys[i], INPUT_PULLUP);
}
```

The I2C pins are configured with pull-up resistors:

```cpp theme={null}
pinMode(SCL, INPUT_PULLUP);
pinMode(SDA, INPUT_PULLUP);
```

<Tip>
  The ESP32's internal pull-up resistors are sufficient for button debouncing and I2C communication. External pull-up resistors are not required.
</Tip>

## Hardware connections

### Button wiring

Each button should be wired as follows:

* One terminal to the GPIO pin
* Other terminal to GND
* No external resistors needed (internal pull-ups are used)

### LED strip wiring

* Data: GPIO 18
* VCC: 5V power supply
* GND: Common ground with ESP32

### OLED display wiring

* SDA: GPIO 21
* SCL: GPIO 19
* VCC: 3.3V or 5V (depending on display module)
* GND: Common ground with ESP32

<Warning>
  Ensure all components share a common ground connection with the ESP32 to prevent communication issues.
</Warning>
