EasyLoader (beta)

Current Product Don't Have Test Firmware

Note: pls, use PC chrome/edge browser, if can't connect, refresh the webpage.

1. Click connect button

2. After connected successfully, pick a firmware

3. Click the burn button

4. After burning successfully, Unplug the device and restart.

0%

Module 13.2 4IN8OUT

SKU:M122

Description

MODULE 13.2 4IN8OUT is a '4-Channel Passive Input/Switch + 8-Channel MOS Drive Output' drive module. Adopt STM32F030 as the I2C IO chip, support 9-24V DC input, with internal DC-DC circuitry to 5V.

Product Features

  • Compatible with Basic/Fire/Core2
  • Adopt STM32F030 as the IO chip, I2C communication, I2C address is changeable by modifying the register
  • 8-channel MOS Drive circuitry share the same VCC, channle load <1A
  • 4-channel Passive Input share the same GND, no active signal or >5V signal allowed
  • With internal MP1584, 9~24V -> 5V DC-DC converter

Include

  • 1x MODULE 13.2 4IN8OUT
  • 13x 2P Terminal

Application

  • Multi-channel load drive (Relay, Valva, Single-phase Motor, Singal LED)
  • Limit Switch or Button test

Specification

Spec Parameter
Input Voltage 9~24V
Output Channel 8
Input Channel 4
Output Load <1A each Channel
Communication Interface I2C
I2C Address Default 0x45, changeable by modifying the register 0xF0
Net Weight 21.9g
Gross Weight 52.5g
Product Size 54*54*13mm
Package Size 125*68*23mm

Pinmap

M5Core GPIO22 GPIO21 5V GND
4IN8OUT MODULE 13.2 SCL SDA 5V GND

Schematic

Example

Arduino

#include <M5Stack.h>
#include "MODULE_4IN8OUT.h"

MODULE_4IN8OUT module;

int _I2C_dev_scan();

void setup() {
    M5.begin(1,1,1,1);  // Init M5Stack.  初始化M5Stack

    // while (1) {
    //     _I2C_dev_scan();
    //     delay(1000);
    // }


    while (!module.begin(&Wire, 21, 22, MODULE_4IN8OUT_ADDR)) {
        Serial.println("4IN8OUT INIT ERROR");
        M5.Lcd.println("4IN8OUT INIT ERROR");
        _I2C_dev_scan();
        delay(1000);
    };
    Serial.println("4IN8OUT INIT SUCCESS");
}

// void loop() {

// }

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_GREEN);
        } else {
            // M5.Lcd.fillRect(60 + 60 * i, 0, 25, 25, TFT_BLACK);
            // M5.Lcd.drawRect(60 + 60 * i, 0, 25, 25, TFT_GREEN);
            M5.Lcd.fillRect(60 + 60 * i, 0, 25, 25, TFT_RED);
        }
        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_BLUE);
            } else {
                M5.Lcd.fillRect(20 + 35 * i, 200, 25, 25, TFT_BLACK);
                M5.Lcd.drawRect(20 + 35 * i, 200, 25, 25, TFT_BLUE);
            }
            M5.Lcd.drawString("OUT" + String(i), 18 + 35 * i, 180);
            // delay(50);
        }
    }
    // if (M5.BtnB.wasPressed()) {
    //     if (module.setDeviceAddr(0x66)) {
    //         Serial.println("Update Addr: 0x66");
    //     }
    // }
    // M5.update();

    delay(500);
}


int _I2C_dev_scan() {
    uint8_t error, address;
    int nDevices;

    Serial.println("[I2C_SCAN] device scanning...");

    nDevices = 0;
    for (address = 1; address < 127; address++ ) {
        // The i2c_scanner uses the return value of
        // the Write.endTransmisstion to see if
        // a device did acknowledge to the address.
        Wire.beginTransmission(address);
        error = Wire.endTransmission();

        if (error == 0) {
            Serial.print("[I2C_SCAN]: device found at address 0x");
            if (address < 16)
                Serial.print("0");
            Serial.print(address, HEX);
            Serial.println(" !");

            nDevices++;
        }
        else if (error == 4) {
            Serial.print("[I2C_SCAN]: unknow error at address 0x");
            if (address < 16)
                Serial.print("0");
            Serial.println(address, HEX);
        }
    }

    Serial.print("[I2C_SCAN]:");
    Serial.printf(" %d devices was found\r\n", nDevices);
    return nDevices;
}

UIFlow

FAQ

Q1: How do I remove the speaker floor noise when the M5Core is on or running?

Q2: How does M5Core2 stack modules?

Q3: A timeout error is displayed when uploading the program to the device

Q4: How to solve the phenomenon of automatic signal triggering of M5Core button A

Q5: M5 device battery life

Q6: Can multiple modules with batteries be stacked at the same time?

Q7: M5 master supports WiFi connection to 5G frequency band

Q8: The RS485 device cannot communicate normally/data is garbled. Packet loss, etc.

Q9: The difference between different masters and camera products

Q10: M5 camera image blur, how to adjust the focal length

Q11: The control RGB LED pin of FACE II BOTTOM conflicts with the I2S DOUT pin of CORE2

Q12: Does the battery run out of power quickly?

Q1: How to read the programmed firmware?

Q2: Several solutions for esp32 board download failure in Arduino IDE board management

Q3: Arduino SPIFFS file upload operation

Q4: When M5Burner burns firmware, an error pop-up window or exception occurs

Q5: Does the M5 master device support multi-language display (Chinese, English, Japanese, Russian, etc.)?

Q6: The program cannot load the SD card normally

Q7: How to use Bluetooth, HTTP, SD, WebServer, FreeRTOS and other features in Arduino IDE

Q8: How to download programs for STAMP C3U

Q9: How STAMP C3U defines UART0 output mode

Q10: Unable to connect to UIFlow Desktop IDE

Q11: NBIoT devices cannot connect to the network normally