Unit EXT.IO2 is an IO expansion unit built around the STM32F030 MCU. It communicates over I²C and exposes 8 independently configurable IO pins. Each pin supports digital input/output, ADC, servo control, and RGB LED control. The I²C device address is configurable, so multiple EXT.IO2 units can coexist on the same bus to expand IO capacity further. Typical use cases include multi-channel digital/analog signal acquisition, lighting control, and servo actuation.
Stamp IO is an IO expansion board that shares the same STM32F030-based design and I²C communication protocol as Unit EXT.IO2. It provides the same 8-channel IO expansion with identical per-pin mode support.
Both devices require an external host controller connected via I²C.
The extio2 component depends on the I²C Bus component. Add it to your configuration and set the SDA/SCL pins to match your host controller.
# Example configuration entry for ESP32
i2c:
sda: GPIOXX
scl: GPIOXX
scan: true For example, when using an Atom Lite as the host controller:
# I2C Bus on Grove Port (HY2.0-4P)
i2c:
sda: GPIO26
scl: GPIO32 Add the extio2 external component and declare the hub before using any platform:
external_components:
- source: github://m5stack/esphome-yaml/components@main
components: [extio2]
refresh: 0s
extio2:
id: extio2_hub 0x45.true.1kHz. Options:2kHz1kHz500Hz250Hz125HzEXT.IO2 pins can be used anywhere ESPHome accepts a standard GPIO pin reference, such as switch, binary_sensor, and similar components.
# Digital output — switch
switch:
- platform: gpio
name: "EXT.IO2 GPIO 0"
pin:
extio2_id: extio2_hub
number: 0
mode:
output: true
# Digital input — binary sensor
binary_sensor:
- platform: gpio
name: "EXT.IO2 GPIO 1"
pin:
extio2_id: extio2_hub
number: 1 0–7.false.pullup, pulldown, and open_drain are not supported.The sensor platform reads analog values from any of the 8 ADC-capable pins.
sensor:
- platform: extio2
extio2_id: extio2_hub
name: "ADC Sensor 0"
channel: ADC_0
resolution: 12BIT
update_interval: 5s ADC_0 through ADC_7.8BIT.8BIT: 8-bit resolution, range 0–255.12BIT: 12-bit resolution, range 0–4095.60s.The output platform drives any pin as a PWM output. Duty cycle is expressed as a float from 0.0 to 1.0, mapped internally to 0–100%.
output:
- platform: extio2
extio2_id: extio2_hub
id: pwm_ch0
channel: PWM_0
light:
- platform: monochromatic
name: "PWM Light 0"
output: pwm_ch0
effects:
- pulse: PWM_0 through PWM_7.pwm_freq option. All PWM channels share the same frequency.The number platform controls servos in two modes: angle (degrees) or pulse width (microseconds).
Controls servo position by angle (0–180°).
number:
- platform: extio2
extio2_id: extio2_hub
name: "Servo 0"
type: angle
channel: SERVO_0
min_value: 0
max_value: 180
step: 3 Controls servo position by raw pulse width (microseconds).
number:
- platform: extio2
extio2_id: extio2_hub
name: "Servo 1"
type: pulse
channel: SERVO_1
min_value: 500
max_value: 2500
step: 100 angle: Control by angle.pulse: Control by pulse width.SERVO_0 through SERVO_7.0.0 (angle) or 500.0 (pulse).180.0 (angle) or 2500.0 (pulse).3.0 (angle) or 100.0 (pulse).| Mode | Unit | Min | Max | Step |
|---|---|---|---|---|
angle | ° | 0 | 180 | 3 |
pulse | µs | 500 | 2500 | 100 |
The light platform supports two modes: a single RGB LED on a specified pin, or an addressable LED strip starting from pin 0.
Controls one RGB LED on the specified pin.
light:
- platform: extio2
extio2_id: extio2_hub
name: "EXT.IO2 Light 2"
type: light
channel: LIGHT_2 Controls a consecutive run of RGB LEDs starting from pin 0. Supports all ESPHome addressable light effects.
light:
- platform: extio2
extio2_id: extio2_hub
name: "LED Strip"
type: addressable_light
num_leds: 8 light: Single RGB LED.addressable_light: Addressable LED strip.light type, enum): Pin to use, LIGHT_0 through LIGHT_7.addressable_light type, int): Number of LEDs, 1–8. Pins are assigned consecutively starting from pin 0.num_leds: 3 uses pins 0, 1, and 2. The hardware does not provide a brightness control register. Brightness is implemented via software scaling of RGB values.i2c:
sda: GPIO2
scl: GPIO1
extio2:
id: extio2_hub
address: 0x45
reset: true
pwm_freq: 1kHz
# GPIO — digital output
switch:
- platform: gpio
name: "EXT.IO2 GPIO 0"
pin:
extio2_id: extio2_hub
number: 0
mode:
output: true
# GPIO — digital input
binary_sensor:
- platform: gpio
name: "EXT.IO2 GPIO 1"
pin:
extio2_id: extio2_hub
number: 1
mode:
input: true
pullup: true
# ADC sensor
sensor:
- platform: extio2
extio2_id: extio2_hub
name: "ADC Sensor 2"
channel: ADC_2
resolution: 12BIT
update_interval: 5s
# PWM output used as monochromatic light
output:
- platform: extio2
extio2_id: extio2_hub
id: pwm_ch3
channel: PWM_3
light:
- platform: monochromatic
name: "PWM Light 3"
output: pwm_ch3
effects:
- pulse:
# Single RGB LED
- platform: extio2
extio2_id: extio2_hub
name: "RGB Light 6"
type: light
channel: LIGHT_6
# Addressable LED strip (all 8 pins)
- platform: extio2
extio2_id: extio2_hub
name: "LED Strip"
type: addressable_light
num_leds: 8
number:
# Servo — angle control
- platform: extio2
extio2_id: extio2_hub
name: "Servo 4"
type: angle
channel: SERVO_4
# Servo — pulse width control
- platform: extio2
extio2_id: extio2_hub
name: "Servo 5"
type: pulse
channel: SERVO_5