Skip to main content

4PIN Expansion Interface

The Beetle S1 features an XH2.54-4P multi-function expansion port supporting SPI/I2C/UART/GPIO protocols for connecting various sensors and peripherals.

Pinout

PinSignalDescription
15VPower output
2IO1Multi-function IO (SDA / MOSI / TX)
3IO2Multi-function IO (SCL / SCK / RX)
4GNDGround

4PIN pinout diagram

Supported Protocols

ProtocolTypical Applications
SPIHigh-speed data transfer, external displays, sensor modules
I2CConnect sensors (temperature, humidity, IMU, etc.)
UARTSerial communication, GPS modules, etc.
GPIOGeneral purpose I/O, relays, buttons, etc.

Application Examples

External Microphone for Sound-Reactive Apps

Connect an external microphone module via the 4PIN port to enable sound-reactive lighting apps.

Materials Needed:

  • Electret microphone module (MAX9814 or similar)
  • Dupont wires or an XH2.54-4P connector

Wiring:

Beetle S1 4PIN PortMicrophone Module Pin
Pin 1 · 5VVCC
Pin 2 · IO1AOUT (analog output)
Pin 3 · IO2(not connected)
Pin 4 · GNDGND

External IMU for Gesture Interaction

Connect an IMU (Inertial Measurement Unit) module via the 4PIN port for gesture-controlled lighting apps.

Materials Needed:

  • MPU6050 or similar IMU module
  • Dupont wires or an XH2.54-4P connector

Wiring:

Beetle S1 4PIN PortIMU Module Pin
Pin 1 · 5VVCC
Pin 2 · IO1SDA
Pin 3 · IO2SCL
Pin 4 · GNDGND

Programming Example

from machine import Pin, I2C
import time

# Initialize I2C
i2c = I2C(0, scl=Pin(3), sda=Pin(2), freq=400000)

# Scan for I2C devices
devices = i2c.scan()
print("I2C devices:", [hex(addr) for addr in devices])

For detailed programming guides, see App Development.