SKU:M122














Module13.2 4In8Out is a stackable 8-channel MOS driver output + 4-channel passive contact input IO expansion control module. It uses STM32F030 as the IO expansion chip, communicates via I2C protocol, supports 9 ~ 24V DC power input on an independent port, and integrates an MP1584 DC-DC circuit to provide 5V/3A power to the main controller. The 8 output channels use AO3400A MOSFETs with a common power anode, capable of directly driving loads with a maximum switching current of 1A per channel. The 4 input channels are common-ground passive contact inputs — connecting active signals or signals greater than 5V is prohibited. The module connects to the main controller via the M5-Bus interface, supports stacking expansion, and is suitable for multi-channel load driving, limit switch detection, button detection, and similar applications.
| Specification | Parameter |
|---|---|
| MCU | STM32F030F4P6 |
| Communication Interface | I2C @ 0x45 (configurable) |
| Supply Voltage | 9 ~ 24V |
| Output Channels | 8 |
| Output Current | <= 1A per channel, total <= 8A |
| Input Channels | 4 |
| Channel Interface | KF2EDGR-2.54-2P |
| Product Size | 54.0 x 54.0 x 19.7mm |
| Product Weight | 21.9g |
| Package Size | 80.0 x 55.0 x 28.0mm |
| Gross Weight | 52.5g |


| PIN | LEFT | RIGHT | PIN |
|---|---|---|---|
| GND | 1 | 2 | |
| GND | 3 | 4 | |
| GND | 5 | 6 | |
| 7 | 8 | ||
| 9 | 10 | ||
| 11 | 12 | 3V3 | |
| 13 | 14 | ||
| 15 | 16 | ||
| SDA | 17 | 18 | SCL |
| 19 | 20 | ||
| 21 | 22 | ||
| 23 | 24 | ||
| HPWR | 25 | 26 | |
| HPWR | 27 | 28 | 5V |
| HPWR | 29 | 30 |
#include <M5Unified.h>
#include "MODULE_4IN8OUT.h"
MODULE_4IN8OUT module;
void setup() {
M5.begin();
while (!module.begin(&M5.In_I2C, MODULE_4IN8OUT_ADDR)) {
Serial.println("4IN8OUT INIT ERROR");
M5.Lcd.println("4IN8OUT INIT ERROR");
delay(1000);
};
Serial.println("4IN8OUT INIT SUCCESS");
M5.Lcd.println("4IN8OUT INIT SUCCESS");
}
long interval = 0;
bool level = false;
void loop() {
for (uint8_t i = 0; i < 4; i++) {
if (module.getInput(i) == 1) {
M5.Lcd.fillRect(60 + 60 * i, 0, 25, 25, TFT_BLACK);
M5.Lcd.fillRect(60 + 60 * i, 0, 25, 25, TFT_BLUE);
} else {
M5.Lcd.fillRect(60 + 60 * i, 0, 25, 25, TFT_BLACK);
M5.Lcd.drawRect(60 + 60 * i, 0, 25, 25, TFT_BLUE);
}
M5.Lcd.drawString("IN" + String(i), 40 + 60 * i, 5);
}
M5.Lcd.drawString("4IN8OUT MODULE", 60, 80, 4);
M5.Lcd.drawString("FW VERSION:" + String(module.getVersion()), 70, 120, 4);
if (millis() - interval > 1000) {
interval = millis();
level = !level;
for (uint8_t i = 0; i < 8; i++) {
module.setOutput(i, level);
if (level) {
M5.Lcd.fillRect(20 + 35 * i, 200, 25, 25, TFT_BLACK);
M5.Lcd.fillRect(20 + 35 * i, 200, 25, 25, TFT_GREEN);
} else {
M5.Lcd.fillRect(20 + 35 * i, 200, 25, 25, TFT_BLACK);
M5.Lcd.drawRect(20 + 35 * i, 200, 25, 25, TFT_GREEN);
}
M5.Lcd.drawString("OUT" + String(i), 18 + 35 * i, 180);
delay(50);
}
}
// if (M5.BtnB.wasPressed() || M5.Touch.getDetail().wasClicked()) {
// if (module.setDeviceAddr(0x66)) {
// Serial.println("Update Addr: 0x66");
// }
// }
// M5.update();
}