
Unit Step16 is a 16-position rotary encoder control unit based on an STM32G031G8U6 microcontroller. It collects the BCD value of the rotary encoder in real time and visualizes the 0–F hexadecimal value via the on-board 7-segment display. The device communicates over I2C and allows you to configure the rotation increment direction, display operating mode, RGB LED color, and I2C address, enabling multiple encoder units to be used on the same bus. With its concise and efficient design, Unit Step16 provides reliable physical interaction and instant visual feedback, making it ideal for smart interactive devices (e.g. smart-home control panels), control interfaces (e.g. volume knobs, RGB lighting control, motor speed regulation), and STEAM education hardware prototyping and teaching.
Step 1. Create New Device

Step 2. Create Device Name
CONTINUE.
New Device Setup.
NEXT.
Step 3. Choose Device Type
ESP32.
SKIP.
Step 4. Start Edit YAML File
EDIT. We can customize device functionality through YAML files.
The following is the core part of the code. Relevant references and explanations are provided below.
external_components:
- source: github://m5stack/esphome-yaml/components
components: unit_step16
refresh: 0s
unit_step16:
id: my_step16
i2c_id: bsp_iic
address: 0x48 i2c:
- id: bsp_iic
scl: GPIO32
sda: GPIO26
scan: True sensor:
- platform: unit_step16
unit_step16_id: my_step16
name: "Encoder Value"
update_interval: 100ms
on_value:
then:
- logger.log:
format: "Encoder value changed to: %.0f"
args: [ 'x' ] output:
- platform: unit_step16
id: led_brightness_output
unit_step16_id: my_step16
channel: led_brightness
- platform: unit_step16
id: rgb_brightness_output
unit_step16_id: my_step16
channel: rgb_brightness
- platform: unit_step16
id: rgb_red_output
unit_step16_id: my_step16
channel: rgb_red
- platform: unit_step16
id: rgb_green_output
unit_step16_id: my_step16
channel: rgb_green
- platform: unit_step16
id: rgb_blue_output
unit_step16_id: my_step16
channel: rgb_blue light:
- platform: rgb
id: step16_rgb_light
name: "Step16 RGB Light"
red: rgb_red_output
green: rgb_green_output
blue: rgb_blue_output
restore_mode: ALWAYS_ON
default_transition_length: 0s
- platform: monochromatic
id: step16_led_display
name: "Step16 LED Display"
output: led_brightness_output
restore_mode: ALWAYS_ON
default_transition_length: 0s
number:
- platform: template
name: "RGB Brightness"
min_value: 0
max_value: 100
step: 1
optimistic: true
initial_value: 50
on_value:
then:
- output.set_level:
id: rgb_brightness_output
level: !lambda 'return x / 100.0;' INSTALL again to flash and wait for it to complete.
SAVE and INSTALL in the top-right corner, then choose Manual Download in the popup.
Factory format (Previously Modern)
CONNECT to connect to the device.

INSTALL

Settings -> Device & services to check the device.
Discover section.

