XIAO ESP32-C6 PCB Design


Can you add add a 330ohm resistor on the data line between the ESP and the JST connector for the LED strip.
Yes. The board has just been rerouted successfully; I’ll now insert a 330 Ω series resistor between the XIAO data pin and LED connector, place it close to the JST data pin, reroute the affected net, and recheck ERC/DRC.
Added R1, 330 Ω in series between XIAO GPIO21/D3 and the LED JST data pin. It uses a compact 0603 footprint placed on the bottom side near the LED connector.
I also rebuilt the routing after your board resize. Final checks show zero airwires, dangling traces, or open ERC/DRC issues.
What connector do I need to order to place into the J2 holes?
J2 is a JST VH-series, 3-position, 3.96 mm-pitch connector.
For the PCB, order:
  • JST B3P-VH(LF)(SN) — vertical through-hole board header
For the mating cable, order:
  • VHR-3N — 3-position receptacle housing
  • SVH-21T-P1.1 — crimp terminals, one per wire
Pinout:
  1. +5 V
  2. LED data
  3. GND
Use suitably heavy wire for the LED power current; for a 3 A run, approximately 18–20 AWG is appropriate.

Firmware Getting Started
PlatformIO
platformio.ini

Ini


[env:xiao_esp32c6]
platform = espressif32
board = seeed_xiao_esp32c6
framework = arduino
lib_deps = fastled/FastLED@^3.7.8
monitor_speed = 115200
src/main.cpp

Cpp


#include <Arduino.h>
#include <Wire.h>
#include <FastLED.h>

static constexpr uint8_t LED_PIN = D3;      // GPIO21
static constexpr uint8_t IMU_INT_PIN = D2;  // GPIO2
static constexpr uint8_t SDA_PIN = D4;      // GPIO22
static constexpr uint8_t SCL_PIN = D5;      // GPIO23
static constexpr uint8_t MPU_ADDR = 0x68;
static constexpr uint16_t NUM_LEDS = 40;
static constexpr uint8_t BRIGHTNESS = 96;   // Must remain current-limited
CRGB leds[NUM_LEDS];

uint8_t mpuRead8(uint8_t reg) {
  Wire.beginTransmission(MPU_ADDR);
  Wire.write(reg);
  if (Wire.endTransmission(false) != 0) return 0xFF;
  if (Wire.requestFrom(MPU_ADDR, (uint8_t)1) != 1) return 0xFF;
  return Wire.read();
}

bool mpuWrite8(uint8_t reg, uint8_t value) {
  Wire.beginTransmission(MPU_ADDR);
  Wire.write(reg);
  Wire.write(value);
  return Wire.endTransmission() == 0;
}

bool readAccel(int16_t &ax, int16_t &ay, int16_t &az) {
  Wire.beginTransmission(MPU_ADDR);
  Wire.write(0x3B); // ACCEL_XOUT_H
  if (Wire.endTransmission(false) != 0) return false;
  if (Wire.requestFrom(MPU_ADDR, (uint8_t)6) != 6) return false;
  ax = (int16_t)((Wire.read() << 8) | Wire.read());
  ay = (int16_t)((Wire.read() << 8) | Wire.read());
  az = (int16_t)((Wire.read() << 8) | Wire.read());
  return true;
}

void setup() {
  Serial.begin(115200);
  pinMode(IMU_INT_PIN, INPUT);
  Wire.begin(SDA_PIN, SCL_PIN);
  Wire.setClock(400000);

  FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(BRIGHTNESS);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 2500); // LED budget only
  FastLED.clear(true);

  delay(100);
  const uint8_t who = mpuRead8(0x75); // WHO_AM_I, expected 0x68
  Serial.printf("MPU WHO_AM_I: 0x%02X\n", who);
  if (who == 0x68) {
    mpuWrite8(0x6B, 0x00); // PWR_MGMT_1: wake, internal clock
    mpuWrite8(0x1C, 0x00); // ACCEL_CONFIG: ±2 g
  }
}

void loop() {
  int16_t ax, ay, az;
  if (readAccel(ax, ay, az)) {
    Serial.printf("accel %d %d %d\n", ax, ay, az);
    uint8_t hue = (uint8_t)map(constrain(ax, -16384, 16384), -16384, 16384, 0, 255);
    fill_solid(leds, NUM_LEDS, CHSV(hue, 255, BRIGHTNESS));
    FastLED.show();
  }
  delay(50);
}
Final Pin Mapping

Table


FunctionXIAO pinESP32-C6 GPIONet
WS2812B dataD321LED_DATA_3V3_GPIO21_D3
MPU SDAD422I2C_SDA_GPIO22_D4
MPU SCLD523I2C_SCL_GPIO23_D5
MPU INTD22IMU_INT_GPIO2_D2
GPIO21/22/23/2 avoid the module's BOOT GPIO9 and exposed D0/GPIO0 boot-sensitive function. Startup order: serial → INT input → Wire → FastLED/current limit → WHO_AM_I → wake/configure MPU-6050.
  • PlatformIO

  • Final Pin Mapping