CH422G I/O Expander

The CH422G component allows you to use the CH422G I/O expander in ESPHome. It uses an I²C Bus for communication. The I²C address is not configurable as the CH422G has a separate address for each internal register.

Once configured, you can use any of the 12 available GPIO pins in many places a GPIO pin is required. Within ESPHome they can be used in place of internal GPIO pins in many of ESPHome’s components such as the GPIO Binary Sensor or GPIO Switch. They are not usable for PWM or other situations requiring an internal GPIO pin.

Pins 0-7 correspond to the bidirectional I/O (segment) pins on the CH422G. Pins 8-11 correspond to the OC (digit) output pins 0-3.

Note

This I/O Expander chip is used in several Waveshare ESP32-S3 display boards.

# Example configuration entry
ch422g:
  - id: ch422g_hub

# Individual outputs
switch:
  - platform: gpio
    name: CH422G Pin 0
    pin:
      ch422g: ch422g_hub
      number: 0
      mode:
        output: true
      inverted: false

Configuration variables:

  • id (Required, ID): The id to use for this ch422g component.

Pin configuration variables:

  • ch422g (Required, ID): The id of the ch422g component of the pin.

  • number (Required, int): The pin number. Valid numbers are 0-11.

  • inverted (Optional, boolean): If the pin state should be inverted. Defaults to false.

  • mode (Optional, string): A pin mode to set the pin at. One of INPUT or OUTPUT, or OUTPUT_OPEN_DRAIN.

Open drain mode is supported only on pins 8-11. Input is supported only on pins 0-7.

See Also