An ESP-IDF firmware example for controlling and monitoring external digital I/O through two I2C expanders. The application combines a six-output activation sequence with periodic input/output state logging using FreeRTOS tasks.
This repository is a focused board-integration exercise, with the configuration and sequence implemented in main/main.c.
- Initializes an I2C master bus and separate input and output expanders.
- Configures eight input bits and six output bits.
- Drives output bits 0–5 low, one at a time, with a one-second delay between writes.
- Starts a monitoring task after the output sequence. It reads the expander states and logs the lower six bits with inverted logic, using a 100 ms task delay between iterations.
Current sequence: the statements that return outputs high are commented out, so the sequence leaves the six output bits low. The final serial message saying that all outputs are off does not reflect the implemented sequence. Review this behavior before connecting loads.
| Item | Value |
|---|---|
| Target | ESP32 |
| Recorded ESP-IDF version | 5.4.0 in dependencies.lock and sdkconfig |
| Language / runtime | C / FreeRTOS |
| I2C controller | I2C_NUM_0 |
| SDA / SCL | GPIO 4 / GPIO 15 |
| Input expander address | 0x22 |
| Output expander address | 0x24 |
| Output sequence | Bits 0–5, active-low logic |
The application uses Espressif's esp_io_expander_ht8574 component. The local header main/esp_io_expander_ht8574.h defines the board-specific addresses above and documents a PCF8574-style address adaptation. Confirm the actual board, address straps, supply levels, and wiring before using this configuration on hardware.
With an ESP-IDF 5.4 development environment activated:
git clone https://github.com/olivarescroc/VCU_NET_HT8574_TEST.git
cd VCU_NET_HT8574_TEST
idf.py buildThe checked-in configuration targets esp32. Dependencies are declared in main/idf_component.yml, with the recorded versions in dependencies.lock.
main/main.c— bus initialization, expander setup, output sequence, and monitoring task.main/esp_io_expander_ht8574.h— local expander declarations and address definitions.managed_components/— Espressif I/O expander components included with the project.respaldos/— earlier source snapshots.
This is a bench integration example. A hardware validation report and production-readiness evidence are not included.
The project uses the Espressif ESP-IDF project structure and Espressif I/O expander components. Existing source files retain Espressif copyright notices and Apache-2.0 SPDX identifiers. See the included component licenses for their terms: