Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,550
» Latest member: neurobalancetec
» Forum threads: 4,337
» Forum posts: 21,344

Full Statistics

Online Users
There are currently 15 online users.
» 0 Member(s) | 6 Guest(s)
Amazonbot, Applebot, Bing, PetalBot, bot

Latest Threads
KCS debounce option for K...
Forum: KC868-A16
Last Post: tech1977
1 hour ago
» Replies: 0
» Views: 14
[arduino code examples fo...
Forum: F32
Last Post: admin
9 hours ago
» Replies: 0
» Views: 15
[arduino code examples fo...
Forum: F32
Last Post: admin
9 hours ago
» Replies: 0
» Views: 14
KC868-A16 wiring diagram
Forum: KC868-A16
Last Post: admin
Yesterday, 09:31 PM
» Replies: 24
» Views: 22,059
N20 energy
Forum: N20
Last Post: admin
Yesterday, 09:29 PM
» Replies: 1
» Views: 20
Automatic Modbus Sensor p...
Forum: "KCS" v3 firmware
Last Post: admin
Yesterday, 09:27 PM
» Replies: 4
» Views: 115
[arduino code examples fo...
Forum: CO16
Last Post: admin
Yesterday, 04:33 AM
» Replies: 0
» Views: 20
KC868-A8 PCB V1.7 - Maxim...
Forum: KC868-A8
Last Post: admin
11-16-2026, 09:29 AM
» Replies: 1
» Views: 53
Device change after damag...
Forum: Getting Started with ESPHome and Home Assistant
Last Post: grayweird
11-16-2026, 04:43 AM
» Replies: 2
» Views: 775
CT Clamp Compatibility
Forum: KC868-M16 / M1 / MB / M30
Last Post: admin
11-14-2026, 11:38 PM
» Replies: 16
» Views: 3,843

  KinCony MT4 – 4CH ESP32 DC Motor Driver released
Posted by: admin - 07-11-2026, 03:01 AM - Forum: News - No Replies

KinCony MT4 ESP32-S3 4 Channel DC Motor Controller
Overview
KinCony MT4 is a professional 4 Channel DC Motor Controller based on the ESP32-S3-WROOM-1 (N16R8) module. It is designed for smart home automation, industrial automation, DIY IoT projects, motorized curtains, electric valves, linear actuators, robotic systems and other DC motor control applications.
MT4 integrates 4 independent DC motor drivers, RS485, 433MHz RF receiver, IR receiver, I²C expansion interface, 1-Wire GPIO, WiFi, Bluetooth, USB-C, and a Tuya WiFi module into one compact DIN Rail controller.
Whether you are a developer, system integrator, or smart home enthusiast, MT4 provides multiple firmware options, including KinCony KCS v3, ESPHome, Tasmota, Arduino, ESP-IDF, and MicroPython.


[Image: MT4-1.jpg]
Features
  • ESP32-S3-WROOM-1 (N16R8) Dual-Core Processor
  • 4 Channel DC Motor Driver (L298N)
  • Supports Forward / Reverse / Stop control
  • Maximum 2A load per motor channel
  • Built-in WiFi & Bluetooth
  • Built-in Tuya WiFi module
  • RS485 interface (Modbus supported by KCS firmware)
  • USB Type-C programming interface
  • 433MHz RF Receiver
  • IR Receiver
  • I²C Expansion Port
  • 2 Channel 1-Wire GPIO
  • DIN Rail installation with plastic enclosure
  • Open-source hardware platform
  • Supports Arduino IDE
  • Supports ESP-IDF
  • Supports MicroPython
  • Supports ESPHome
  • Supports Tasmota
  • Home Assistant MQTT Auto Discovery
  • Apple HomeKit support (KCS v3 firmware)

Applications
KinCony MT4 is suitable for various automation projects, including:
  • Motorized Curtains
  • Roller Blinds
  • Window Openers
  • Electric Valves
  • Linear Actuators
  • Smart Furniture
  • Automatic Doors
  • Smart Agriculture
  • Industrial Automation
  • DIY IoT Projects
  • Home Automation Systems

Technical Specifications
Item
SpecificationModel
KinCony MT4
Processor
ESP32-S3-WROOM-1 (N16R8)
Power Supply
DC 12V
Motor Driver
L298N
Motor Outputs
4 Channels
Maximum Motor Current
2A per Channel
Communication
WiFi / Bluetooth
Interfaces
RS485, USB-C, IR Receiver, 433MHz RF Receiver, I²C Expansion
GPIO
2 Channel 1-Wire GPIO
Installation
DIN Rail
PCB Size
87 × 93 mm

Hardware Interfaces
Outputs
  • 4 × DC Motor Outputs
  • Maximum Load: 2A per channel
Inputs
  • 2 × 1-Wire GPIO
  • Built-in pull-up resistors
Buttons
  • S1 – ESP32 Reset
  • S2 – Download Mode (GPIO0)
  • S3 – Tuya Configuration Button
Communication Interfaces
    • WiFi
    • Bluetooth
    • RS485
    • USB Type-C
    • 433MHz RF Receiver
    • IR Receiver
    • I²C Expansion Interface
[Image: KinCony-MT4-smart-controller-diagram.jpg]

Print this item

  [arduino code examples for MT4]-06 IR receiver decode
Posted by: admin - 07-11-2026, 02:21 AM - Forum: MT4 - No Replies

Code:
/*
* SimpleReceiver.cpp
*
* Demonstrates receiving ONLY NEC protocol IR codes with IRremote
* If no protocol is defined, all protocols (except Bang&Olufsen) are active.
*
*  This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
************************************************************************************
* MIT License
*
* Copyright (c) 2020-2025 Armin Joachimsmeyer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
************************************************************************************
*/

#include <Arduino.h>
#include <IRremote.hpp> // include the library

uint8_t sender_pins[] = {47, 48};
uint8_t receiver_pin = 15;

int sender_pin_num = sizeof(sender_pins) / sizeof(sender_pins[0]);
uint8_t sender_pin_idx = 0;
uint8_t receive_cnt = 0;
uint8_t sCommand = 0x34;
uint8_t sRepeats = 0;

void setup() {
    Serial.begin(115200);
    IrReceiver.begin(receiver_pin, false);
    IrSender.begin(sender_pins[0]);

    xTaskCreate(
      sendIr,    // Function that should be called
      "Send IR",   // Name of the task (for debugging)
      4096,            // Stack size (bytes)
      NULL,            // Parameter to pass
      1,               // Task priority
      NULL             // Task handle
  );
}

void sendIr(void * parameter) {
 
  delay(2000);
  IrSender.setSendPin(47);
  IrSender.sendNEC(0x00, sCommand, sRepeats);
  Serial.printf("send by pin: %d\n", 47);
  delay(2000);

  IrSender.setSendPin(48);
  IrSender.sendNEC(0x00, sCommand, sRepeats);
  Serial.printf("send by pin: %d\n", 48);

  delay(2000);
  vTaskDelete(NULL);
}

void loop() {
  if (IrReceiver.decode()) {
      Serial.println("recv data");
      if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
          Serial.println(F("Received noise or an unknown (or not yet enabled) protocol"));
          // We have an unknown protocol here, print extended info
          IrReceiver.printIRResultRawFormatted(&Serial, true);

          IrReceiver.resume(); // Do it here, to preserve raw data for printing with printIRResultRawFormatted()
      } else {
          IrReceiver.resume(); // Early enable receiving of the next IR frame

          IrReceiver.printIRResultShort(&Serial);
          IrReceiver.printIRSendUsage(&Serial);
      }
  } else {
    // Serial.println("no data");
  }
}
arduino ino file download: 

.zip   SimpleSendReceiver.zip (Size: 1.62 KB / Downloads: 219)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   SimpleSendReceiver.ino.merged.zip (Size: 194.06 KB / Downloads: 230)

Print this item

  [arduino code examples for MT4]-05 RS485 communication test
Posted by: admin - 07-11-2026, 02:19 AM - Forum: MT4 - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* RS485 Communication Test
*
* This program is a simple test for RS485 communication using ESP32-S3.
* It will send a message over RS485 and then read incoming messages.
* The TXD pin is defined as GPIO 16 and RXD pin is defined as GPIO 17.
*/

#include <HardwareSerial.h>

// Define RS485 pins
#define RS485_RXD 7
#define RS485_TXD 6

// Create a hardware serial object
HardwareSerial rs485Serial(1);

void setup() {
  // Start serial communication for debugging
  Serial.begin(115200);
  while (!Serial);

  // Initialize RS485 Serial communication
  rs485Serial.begin(9600, SERIAL_8N1, RS485_RXD, RS485_TXD);
 
  Serial.println("RS485 Test Start");
}

void loop() {
  // Send a test message
  rs485Serial.println("Hello from KinCony");

  // Wait for a short period
  delay(1000);

  // Check if data is available to read
  if (rs485Serial.available()) {
    String receivedMessage = "";
    while (rs485Serial.available()) {
      char c = rs485Serial.read();
      receivedMessage += c;
    }
    // Print the received message
    Serial.print("Received: ");
    Serial.println(receivedMessage);
  }

  // Wait before sending the next message
  delay(2000);
}
arduino ino file download: 

.zip   RS485-Test.zip (Size: 754 bytes / Downloads: 268)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   RS485-Test.ino.merged.zip (Size: 185.84 KB / Downloads: 287)

Print this item

  [arduino code examples for MT4]-04 DC motor control by L298N driver chip
Posted by: admin - 07-11-2026, 02:18 AM - Forum: MT4 - No Replies

Code:
/*
* Language: English | Русский: ../RU/DIR_DIR_PWM/ | Қазақ: ../KZ/DIR_DIR_PWM/
*
* This code demonstrates motor control using the AlashMotorControlLite library.
* It sets different rotation speeds for the motor with delays between them.
* Code written for Alash engineering.
*/
#include "AlashMotorControlLite.h"
// Create motor object with DIR_DIR_PWM mode and pins inA = 4, inB = 5, PWM = 6
AlashMotorControlLite motor(DIR_DIR_PWM, 39, 46, 9);
void setup() {
}
void loop() {
  motor.setSpeed(100); // Set forward rotation speed
  delay(3000); // Delay 3 seconds

  motor.setSpeed(0); // Stop motor
  delay(3000); // Delay 3 seconds

  motor.setSpeed(-100); // Set reverse rotation speed
  delay(3000); // Delay 3 seconds

  motor.setSpeed(0); // Stop motor
  delay(3000); // Delay 3 seconds
}
arduino ino file download: 

.zip   motor.zip (Size: 560 bytes / Downloads: 269)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:

.zip   motor.ino.merged.zip (Size: 184.36 KB / Downloads: 222)

Print this item

  [arduino code examples for MT4]-03 Read free GPIO state
Posted by: admin - 07-11-2026, 02:16 AM - Forum: MT4 - No Replies

Code:
/*
  Made by KinCony IoT: https://www.kincony.com

  Monitor GPIO0, GPIO18, GPIO8
  Print to Serial when state changes
*/

#define PIN_0   0
#define PIN_18  18
#define PIN_8   8

int lastState0;
int lastState18;
int lastState8;

void setup() {
  Serial.begin(115200);

  pinMode(PIN_0, INPUT_PULLUP);
  pinMode(PIN_18, INPUT_PULLUP);
  pinMode(PIN_8, INPUT_PULLUP);

  lastState0  = digitalRead(PIN_0);
  lastState18 = digitalRead(PIN_18);
  lastState8  = digitalRead(PIN_8);

  Serial.println("GPIO Monitor Started");
}

void loop() {

  int state0 = digitalRead(PIN_0);
  if (state0 != lastState0) {
    Serial.print("GPIO0 changed to: ");
    Serial.println(state0);
    lastState0 = state0;
  }

  int state18 = digitalRead(PIN_18);
  if (state18 != lastState18) {
    Serial.print("GPIO18 changed to: ");
    Serial.println(state18);
    lastState18 = state18;
  }

  int state8 = digitalRead(PIN_8);
  if (state8 != lastState8) {
    Serial.print("GPIO8 changed to: ");
    Serial.println(state8);
    lastState8 = state8;
  }

  delay(10);
}
arduino ino file download: 

.zip   Free-GPIO.zip (Size: 539 bytes / Downloads: 204)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:

.zip   Free-GPIO.ino.merged.zip (Size: 180.26 KB / Downloads: 245)

Print this item

  [arduino code examples for MT4]-02 Ethernet W5500 chip work with TCP Server mode
Posted by: admin - 07-11-2026, 02:15 AM - Forum: MT4 - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* This Arduino program sets up an ESP32-S3 with a W5500 Ethernet module
* as a TCP server. It listens on port 4196 and echoes back any string
* received from a client.
*
* Hardware connections:
* - CLK: GPIO42
* - MOSI: GPIO43
* - MISO: GPIO44
* - CS: GPIO41
* - RST: GPIO1
* - INT: GPIO2
*
* Static IP address: 192.168.3.55
* Subnet Mask: 255.255.255.0
* Gateway: 192.168.3.1
* DNS: 192.168.3.1
*/

#include <SPI.h>
#include <Ethernet.h>

// Define the W5500 Ethernet module pins
#define W5500_CS_PIN  41
#define W5500_RST_PIN 1
#define W5500_INT_PIN 2
#define W5500_CLK_PIN 42
#define W5500_MOSI_PIN 43
#define W5500_MISO_PIN 44

// MAC address for your Ethernet shield (must be unique on your network)
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// Static IP address configuration
IPAddress ip(192, 168, 3, 55);       // Static IP address
IPAddress subnet(255, 255, 255, 0);   // Subnet mask
IPAddress gateway(192, 168, 3, 1);    // Default gateway
IPAddress dns(192, 168, 3, 1);        // DNS server address

// Create an EthernetServer object to handle TCP connections
EthernetServer server(4196);

void setup() {
  // Initialize serial communication
  Serial.begin(115200);
  while (!Serial) {
    ; // Wait for serial port to connect
  }

  // Initialize the W5500 module
  pinMode(W5500_RST_PIN, OUTPUT);
  pinMode(W5500_INT_PIN, INPUT);
  digitalWrite(W5500_RST_PIN, LOW);  // Reset the W5500 module
  delay(100);                       // Wait for reset to complete
  digitalWrite(W5500_RST_PIN, HIGH); // Release reset

  // Initialize SPI with the correct pin definitions
  SPI.begin(W5500_CLK_PIN, W5500_MISO_PIN, W5500_MOSI_PIN);

  // Set up the Ethernet library with W5500-specific pins
  Ethernet.init(W5500_CS_PIN);

  // Start the Ethernet connection with static IP configuration
  Ethernet.begin(mac, ip, dns, gateway, subnet);

  // Print the IP address to the serial monitor
  Serial.print("IP Address: ");
  Serial.println(Ethernet.localIP());

  // Start listening for incoming TCP connections
  server.begin();
}

void loop() {
  // Check for incoming client connections
  EthernetClient client = server.available();
  if (client) {
    Serial.println("New client connected");

    // Read data from the client and echo it back
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        server.write(c);
      }
    }

    // Close the connection when done
    client.stop();
    Serial.println("Client disconnected");
  }
}
arduino ino file download: 

.zip   Ethernet-W5500.zip (Size: 1.23 KB / Downloads: 231)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   Ethernet-W5500.ino.merged.zip (Size: 189.86 KB / Downloads: 220)

Print this item

  [arduino code examples for MT4]-01 433MHz RF receiver
Posted by: admin - 07-11-2026, 02:13 AM - Forum: MT4 - No Replies

Code:
/*
  Simple example for receiving
 
  https://github.com/sui77/rc-switch/
*/

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(digitalPinToInterrupt(38));
  Serial.print("begin test");
}

void loop() {
  if (mySwitch.available()) {
   
    Serial.print("Received ");
    Serial.print( mySwitch.getReceivedValue() );
    Serial.print(" / ");
    Serial.print( mySwitch.getReceivedBitlength() );
    Serial.print("bit ");
    Serial.print("Protocol: ");
    Serial.println( mySwitch.getReceivedProtocol() );

    mySwitch.resetAvailable();
  }
}
   
arduino ino file download:

.zip   433-decode.zip (Size: 451 bytes / Downloads: 233)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:

.zip   433-decode.ino.merged.zip (Size: 181.95 KB / Downloads: 212)

Print this item

  MT4 ESPHome yaml for home assistant without tuya
Posted by: admin - 07-11-2026, 02:10 AM - Forum: MT4 - No Replies

Code:
esphome:
  name: mt4
  friendly_name: MT4

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

logger:

api:

ethernet:
  type: W5500
  clk_pin: GPIO42
  mosi_pin: GPIO43
  miso_pin: GPIO44
  cs_pin: GPIO41
  interrupt_pin: GPIO2
  reset_pin: GPIO1

web_server:
  port: 80

globals:
  - id: motor1_direction
    type: int
    restore_value: true
    initial_value: '0'
  - id: motor1_speed_value
    type: float
    restore_value: true
    initial_value: '0.5'

  - id: motor2_direction
    type: int
    restore_value: true
    initial_value: '0'
  - id: motor2_speed_value
    type: float
    restore_value: true
    initial_value: '0.5'

  - id: motor3_direction
    type: int
    restore_value: true
    initial_value: '0'
  - id: motor3_speed_value
    type: float
    restore_value: true
    initial_value: '0.5'

  - id: motor4_direction
    type: int
    restore_value: true
    initial_value: '0'
  - id: motor4_speed_value
    type: float
    restore_value: true
    initial_value: '0.5'

output:
  # Motor 1
  - platform: gpio
    id: motor1_in1
    pin: GPIO39

  - platform: gpio
    id: motor1_in2
    pin: GPIO46

  - platform: ledc
    id: motor1_pwm
    pin: GPIO9
    frequency: 1000Hz

  # Motor 2
  - platform: gpio
    id: motor2_in1
    pin: GPIO11

  - platform: gpio
    id: motor2_in2
    pin: GPIO10

  - platform: ledc
    id: motor2_pwm
    pin: GPIO12
    frequency: 1000Hz

  # Motor 3
  - platform: gpio
    id: motor3_in1
    pin: GPIO13

  - platform: gpio
    id: motor3_in2
    pin: GPIO47

  - platform: ledc
    id: motor3_pwm
    pin: GPIO14
    frequency: 1000Hz

  # Motor 4
  - platform: gpio
    id: motor4_in1
    pin: GPIO48

  - platform: gpio
    id: motor4_in2
    pin: GPIO45

  - platform: ledc
    id: motor4_pwm
    pin: GPIO21
    frequency: 1000Hz

script:
  # Motor 1
  - id: motor1_forward
    then:
      - output.turn_on: motor1_in1
      - output.turn_off: motor1_in2
      - output.set_level:
          id: motor1_pwm
          level: !lambda "return id(motor1_speed_value);"

  - id: motor1_reverse
    then:
      - output.turn_off: motor1_in1
      - output.turn_on: motor1_in2
      - output.set_level:
          id: motor1_pwm
          level: !lambda "return id(motor1_speed_value);"

  - id: motor1_stop
    then:
      - output.turn_off: motor1_in1
      - output.turn_off: motor1_in2
      - output.set_level:
          id: motor1_pwm
          level: 0%

  # Motor 2
  - id: motor2_forward
    then:
      - output.turn_on: motor2_in1
      - output.turn_off: motor2_in2
      - output.set_level:
          id: motor2_pwm
          level: !lambda "return id(motor2_speed_value);"

  - id: motor2_reverse
    then:
      - output.turn_off: motor2_in1
      - output.turn_on: motor2_in2
      - output.set_level:
          id: motor2_pwm
          level: !lambda "return id(motor2_speed_value);"

  - id: motor2_stop
    then:
      - output.turn_off: motor2_in1
      - output.turn_off: motor2_in2
      - output.set_level:
          id: motor2_pwm
          level: 0%

  # Motor 3
  - id: motor3_forward
    then:
      - output.turn_on: motor3_in1
      - output.turn_off: motor3_in2
      - output.set_level:
          id: motor3_pwm
          level: !lambda "return id(motor3_speed_value);"

  - id: motor3_reverse
    then:
      - output.turn_off: motor3_in1
      - output.turn_on: motor3_in2
      - output.set_level:
          id: motor3_pwm
          level: !lambda "return id(motor3_speed_value);"

  - id: motor3_stop
    then:
      - output.turn_off: motor3_in1
      - output.turn_off: motor3_in2
      - output.set_level:
          id: motor3_pwm
          level: 0%

  # Motor 4
  - id: motor4_forward
    then:
      - output.turn_on: motor4_in1
      - output.turn_off: motor4_in2
      - output.set_level:
          id: motor4_pwm
          level: !lambda "return id(motor4_speed_value);"

  - id: motor4_reverse
    then:
      - output.turn_off: motor4_in1
      - output.turn_on: motor4_in2
      - output.set_level:
          id: motor4_pwm
          level: !lambda "return id(motor4_speed_value);"

  - id: motor4_stop
    then:
      - output.turn_off: motor4_in1
      - output.turn_off: motor4_in2
      - output.set_level:
          id: motor4_pwm
          level: 0%

button:
  - platform: template
    name: "Motor1 Forward"
    on_press:
      - globals.set:
          id: motor1_direction
          value: '1'
      - script.execute: motor1_forward

  - platform: template
    name: "Motor1 Reverse"
    on_press:
      - globals.set:
          id: motor1_direction
          value: '-1'
      - script.execute: motor1_reverse

  - platform: template
    name: "Motor1 Stop"
    on_press:
      - globals.set:
          id: motor1_direction
          value: '0'
      - script.execute: motor1_stop

  - platform: template
    name: "Motor2 Forward"
    on_press:
      - globals.set:
          id: motor2_direction
          value: '1'
      - script.execute: motor2_forward

  - platform: template
    name: "Motor2 Reverse"
    on_press:
      - globals.set:
          id: motor2_direction
          value: '-1'
      - script.execute: motor2_reverse

  - platform: template
    name: "Motor2 Stop"
    on_press:
      - globals.set:
          id: motor2_direction
          value: '0'
      - script.execute: motor2_stop

  - platform: template
    name: "Motor3 Forward"
    on_press:
      - globals.set:
          id: motor3_direction
          value: '1'
      - script.execute: motor3_forward

  - platform: template
    name: "Motor3 Reverse"
    on_press:
      - globals.set:
          id: motor3_direction
          value: '-1'
      - script.execute: motor3_reverse

  - platform: template
    name: "Motor3 Stop"
    on_press:
      - globals.set:
          id: motor3_direction
          value: '0'
      - script.execute: motor3_stop

  - platform: template
    name: "Motor4 Forward"
    on_press:
      - globals.set:
          id: motor4_direction
          value: '1'
      - script.execute: motor4_forward

  - platform: template
    name: "Motor4 Reverse"
    on_press:
      - globals.set:
          id: motor4_direction
          value: '-1'
      - script.execute: motor4_reverse

  - platform: template
    name: "Motor4 Stop"
    on_press:
      - globals.set:
          id: motor4_direction
          value: '0'
      - script.execute: motor4_stop

number:
  - platform: template
    name: "Motor1 Speed"
    id: motor1_speed
    min_value: 0
    max_value: 100
    step: 1
    optimistic: true
    restore_value: true
    initial_value: 50
    set_action:
      - globals.set:
          id: motor1_speed_value
          value: !lambda "return x / 100.0;"
      - if:
          condition:
            lambda: "return id(motor1_direction) == 1;"
          then:
            - script.execute: motor1_forward
      - if:
          condition:
            lambda: "return id(motor1_direction) == -1;"
          then:
            - script.execute: motor1_reverse

  - platform: template
    name: "Motor2 Speed"
    id: motor2_speed
    min_value: 0
    max_value: 100
    step: 1
    optimistic: true
    restore_value: true
    initial_value: 50
    set_action:
      - globals.set:
          id: motor2_speed_value
          value: !lambda "return x / 100.0;"
      - if:
          condition:
            lambda: "return id(motor2_direction) == 1;"
          then:
            - script.execute: motor2_forward
      - if:
          condition:
            lambda: "return id(motor2_direction) == -1;"
          then:
            - script.execute: motor2_reverse

  - platform: template
    name: "Motor3 Speed"
    id: motor3_speed
    min_value: 0
    max_value: 100
    step: 1
    optimistic: true
    restore_value: true
    initial_value: 50
    set_action:
      - globals.set:
          id: motor3_speed_value
          value: !lambda "return x / 100.0;"
      - if:
          condition:
            lambda: "return id(motor3_direction) == 1;"
          then:
            - script.execute: motor3_forward
      - if:
          condition:
            lambda: "return id(motor3_direction) == -1;"
          then:
            - script.execute: motor3_reverse

  - platform: template
    name: "Motor4 Speed"
    id: motor4_speed
    min_value: 0
    max_value: 100
    step: 1
    optimistic: true
    restore_value: true
    initial_value: 50
    set_action:
      - globals.set:
          id: motor4_speed_value
          value: !lambda "return x / 100.0;"
      - if:
          condition:
            lambda: "return id(motor4_direction) == 1;"
          then:
            - script.execute: motor4_forward
      - if:
          condition:
            lambda: "return id(motor4_direction) == -1;"
          then:
            - script.execute: motor4_reverse
   
yaml file download:

.txt   HA_4_motor.txt (Size: 9 KB / Downloads: 178)

Print this item

  MT4 ESP32-S3 IO pins define
Posted by: admin - 07-11-2026, 02:09 AM - Forum: MT4 - No Replies

IIC Bus:

SDA:GPIO5
SCL:GPIO4

24C02 EPROM i2c address: 0x50

-----------------

Ethernet (W5500) I/O define:

clk_pin: GPIO42
mosi_pin: GPIO43
miso_pin: GPIO44
cs_pin: GPIO41

interrupt_pin: GPIO2
reset_pin: GPIO1

--------------------
RS485:
RXD:GPIO7
TXD:GPIO6

Tuya module:
RXD:GPIO17
TXD:GPIO16

Tuya network button: Tuya module's P28
Tuya network LED: Tuya module's P16
--------------------
1-Wire-TEP1:GPIO18
1-Wire-TEP2:GPIO8

--------------------

433MHz RF receiver: GPIO38
IR receiver: GPIO15

DL(download) button: GPIO0
---------------------
Motor1:
IN1-1: GPIO39
IN1-2: GPIO46
PWM1: GPIO9

Motor2:
IN2-1: GPIO11
IN2-2: GPIO10
PWM2: GPIO12

Motor3:
IN3-1: GPIO13
IN3-2: GPIO47
PWM3: GPIO14

Motor4:
IN4-1: GPIO48
IN4-2: GPIO45
PWM4: GPIO21

   

Print this item

  B32M maximum voltage
Posted by: audiotek10 - 07-09-2026, 07:51 AM - Forum: DIY Project - Replies (5)

The power supply is always shown as 12-24V 

I want to use this in a motorhome/RV and we have 24V LiFePO4 batteries. This can charge up to 28.8V. Is this safe with the B32M? How strict is the limit?

Print this item