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
| Pin | Signal | Description |
|---|---|---|
| 1 | 5V | Power output |
| 2 | IO1 | Multi-function IO (SDA / MOSI / TX) |
| 3 | IO2 | Multi-function IO (SCL / SCK / RX) |
| 4 | GND | Ground |

Supported Protocols
| Protocol | Typical Applications |
|---|---|
| SPI | High-speed data transfer, external displays, sensor modules |
| I2C | Connect sensors (temperature, humidity, IMU, etc.) |
| UART | Serial communication, GPS modules, etc. |
| GPIO | General 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 Port | Microphone Module Pin |
|---|---|
| Pin 1 · 5V | VCC |
| Pin 2 · IO1 | AOUT (analog output) |
| Pin 3 · IO2 | (not connected) |
| Pin 4 · GND | GND |
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 Port | IMU Module Pin |
|---|---|
| Pin 1 · 5V | VCC |
| Pin 2 · IO1 | SDA |
| Pin 3 · IO2 | SCL |
| Pin 4 · GND | GND |
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.