Stufin
Home Quick Cart Profile

M5Stack Goplus2 DC Motor and Servo Driver Module (STM32F0)

Buy Now on Stufin

Microcontroller

STM32F0, 32-bit ARM Cortex-M0 MCU, operating at 48 MHz

DC Motor Control

+ 2x DC motor channels with individual enable, direction, and speed control

+ Motor voltage range2.5V to 10V
+ Motor current ratingup to 1.5A per channel

+ Overcurrent protection and thermal shutdown

Servo Motor Control

+ 2x Servo motor channels with individual control

+ Supports standard 3-pin (VCC, GND, Signal) and 4-pin (VCC, GND, Signal, Power) servo connectors

+ Servo frequency range50Hz to 400Hz

Communication Interfaces

+ UART (Serial) interface for communication with host devices

+ I2C interface for connecting sensors, displays, and other peripherals

Power Management

+ Onboard 3.3V voltage regulator for powering external devices

+ Power input range5V to 12V

Miscellaneous

+ 10-pin male header for easy connection to M5Stack modules and other devices

+ Reset button and LED indicators for power, UART, and I2C status

+ Compact size25.4mm x 25.4mm (1 inch x 1 inch)

Additional Features

Support for M5Stack development environment and UIFlow visual programming tool

Compatible with various programming languages, including C, Python, and Lua

Open-source hardware and software design for customization and community contributions

Applications

The M5Stack Goplus2 DC Motor and Servo Driver Module is suitable for a wide range of applications, including

Robotics and robotic arms

Automation systems and industrial control

IoT projects, such as home automation and smart buildings

Drone and UAV systems

Medical devices and healthcare applications

Education and prototyping platforms

Pin Configuration

  • M5Stack Goplus2 DC Motor and Servo Driver Module (STM32F0) Pinout Explanation
  • The M5Stack Goplus2 DC Motor and Servo Driver Module is a powerful and versatile module based on the STM32F0 microcontroller, designed to drive DC motors and servos. This documentation provides a detailed explanation of each pin on the module, helping users understand how to connect and utilize the module effectively.
  • Pinout Structure:
  • The M5Stack Goplus2 DC Motor and Servo Driver Module has a total of 24 pins, divided into three categories:
  • Power Pins: 4 pins
  • Signal Pins: 14 pins
  • Motor/ Servo Pins: 6 pins
  • Power Pins (4):
  • 1. VIN:
  • Function: Input voltage for the module (3.3V to 5V)
  • Description: Connect a power source (e.g., a battery or a power adapter) to this pin.
  • 2. GND:
  • Function: Ground pin for the module
  • Description: Connect the ground pin of the power source to this pin.
  • 3. 3V3:
  • Function: Onboard 3.3V voltage regulator output
  • Description: This pin provides a stable 3.3V output for external devices.
  • 4. EN:
  • Function: Enable pin for the onboard voltage regulator
  • Description: This pin is used to enable or disable the onboard voltage regulator. Connect to a logic level (HIGH or LOW) to control the regulator.
  • Signal Pins (14):
  • 1. RX:
  • Function: UART receive pin
  • Description: Connect to a serial communication device's TX pin for data reception.
  • 2. TX:
  • Function: UART transmit pin
  • Description: Connect to a serial communication device's RX pin for data transmission.
  • 3. SCL:
  • Function: I2C clock pin
  • Description: Connect to an I2C device's SCL pin for clock signals.
  • 4. SDA:
  • Function: I2C data pin
  • Description: Connect to an I2C device's SDA pin for data transfer.
  • 5. SCK:
  • Function: SPI clock pin
  • Description: Connect to an SPI device's SCK pin for clock signals.
  • 6. MISO:
  • Function: SPI master in, slave out pin
  • Description: Connect to an SPI device's MISO pin for data reception.
  • 7. MOSI:
  • Function: SPI master out, slave in pin
  • Description: Connect to an SPI device's MOSI pin for data transmission.
  • 8. CS:
  • Function: SPI chip select pin
  • Description: Connect to an SPI device's CS pin for selecting the device.
  • 9. INT:
  • Function: Interrupt pin
  • Description: This pin can be used as an interrupt input for the microcontroller.
  • 10. Reset:
  • Function: Microcontroller reset pin
  • Description: This pin is used to reset the microcontroller. Connect to a logic level (HIGH or LOW) to control the reset function.
  • Motor/ Servo Pins (6):
  • 1. M1A:
  • Function: DC motor or servo signal pin (channel 1)
  • Description: Connect to a DC motor or servo's signal wire.
  • 2. M1B:
  • Function: DC motor or servo signal pin (channel 1)
  • Description: Connect to a DC motor or servo's signal wire.
  • 3. M2A:
  • Function: DC motor or servo signal pin (channel 2)
  • Description: Connect to a DC motor or servo's signal wire.
  • 4. M2B:
  • Function: DC motor or servo signal pin (channel 2)
  • Description: Connect to a DC motor or servo's signal wire.
  • 5. VCC_M:
  • Function: Power supply pin for motors/servos
  • Description: Connect a power source (e.g., a battery) to this pin to power the motors/servos.
  • 6. GND_M:
  • Function: Ground pin for motors/servos
  • Description: Connect the ground pin of the power source to this pin.
  • Connection Structure:
  • To connect the M5Stack Goplus2 DC Motor and Servo Driver Module to your project, follow these steps:
  • 1. Connect a power source (3.3V to 5V) to the VIN pin and the corresponding GND pin.
  • 2. Connect the onboard 3.3V voltage regulator output to your project's power rail, if required.
  • 3. Connect the RX and TX pins to a serial communication device (e.g., a microcontroller or a computer) for UART communication.
  • 4. Connect the I2C pins (SCL and SDA) to an I2C device, if required.
  • 5. Connect the SPI pins (SCK, MISO, MOSI, and CS) to an SPI device, if required.
  • 6. Connect the INT pin to an interrupt input, if required.
  • 7. Connect the Reset pin to a logic level (HIGH or LOW) to control the microcontroller's reset function.
  • 8. Connect the motor/servo pins (M1A, M1B, M2A, and M2B) to the corresponding motor/servo signal wires.
  • 9. Connect the VCC_M pin to a power source, if required, to power the motors/servos.
  • 10. Connect the GND_M pin to the ground pin of the power source, if required.
  • Important Notes:
  • Make sure to connect the power pins correctly to avoid damage to the module or other components.
  • Use appropriate communication protocols and pin configurations when connecting to external devices.
  • Handle the module with care to avoid damaging the pins or the onboard components.
  • By following this documentation, you should be able to connect and utilize the M5Stack Goplus2 DC Motor and Servo Driver Module effectively in your IoT projects.

Code Examples

M5Stack Goplus2 DC Motor and Servo Driver Module (STM32F0) Documentation
Overview
The M5Stack Goplus2 DC Motor and Servo Driver Module is a versatile IoT component designed to control and drive DC motors and servos. Built around the STM32F0 microcontroller, this module provides a compact and easy-to-use solution for robotics, automation, and other applications requiring motor control.
Key Features
Controls up to 2 DC motors (bidirectional) and 2 servos (180)
 STM32F0 microcontroller with 32-bit ARM Cortex-M0 core
 3.3V and 5V voltage regulator outputs
 Support for I2C, UART, and SPI communication protocols
 Breadboard-friendly design with Grove connectors
Pinout
| Pin | Function | Description |
| --- | --- | --- |
| VCC | Power | 3.3V or 5V power input |
| GND | Ground | Ground connection |
| SDA | I2C Data | I2C data line |
| SCL | I2C Clock | I2C clock line |
| RX | UART Receive | UART receive line |
| TX | UART Transmit | UART transmit line |
| M1A | Motor 1 A | DC motor 1 A phase output |
| M1B | Motor 1 B | DC motor 1 B phase output |
| M2A | Motor 2 A | DC motor 2 A phase output |
| M2B | Motor 2 B | DC motor 2 B phase output |
| SVO1 | Servo 1 | Servo 1 output |
| SVO2 | Servo 2 | Servo 2 output |
| INT | Interrupt | Interrupt input for motor and servo control |
Code Examples
### Example 1: Controlling a DC Motor using Arduino Library
This example demonstrates how to control a DC motor using the M5Stack Goplus2 module with the Arduino library.
```c
#include <M5Goplus2.h>
M5Goplus2 motorModule;
void setup() {
  motorModule.begin(); // Initialize the module
}
void loop() {
  motorModule.setMotorSpeed(MOTOR1, 50); // Set motor 1 speed to 50%
  delay(1000);
  motorModule.setMotorSpeed(MOTOR1, -50); // Set motor 1 speed to -50% (reverse direction)
  delay(1000);
  motorModule.setMotorSpeed(MOTOR1, 0); // Stop motor 1
  delay(1000);
}
```
### Example 2: Controlling a Servo using M5Stack Library
This example demonstrates how to control a servo using the M5Stack Goplus2 module with the M5Stack library.
```python
import m5
m5.begin() # Initialize the M5Stack
while True:
  m5.servo_write(m5.SV1, 0) # Set servo 1 to 0
  m5.delay(1000)
  m5.servo_write(m5.SV1, 90) # Set servo 1 to 90
  m5.delay(1000)
  m5.servo_write(m5.SV1, 180) # Set servo 1 to 180
  m5.delay(1000)
```
### Example 3: Controlling a DC Motor and Servo using I2C Communication (MicroPython)
This example demonstrates how to control a DC motor and servo using I2C communication with the M5Stack Goplus2 module using MicroPython.
```python
import machine
import utime
i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4)) # Initialize I2C interface
while True:
  i2c.writeto(0x1E, b'x01x01x01x01') # Set motor 1 speed to 50% and servo 1 to 90
  utime.sleep(1)
  i2c.writeto(0x1E, b'x01x01x02x02') # Set motor 1 speed to -50% and servo 1 to 0
  utime.sleep(1)
  i2c.writeto(0x1E, b'x01x01x00x00') # Stop motor 1 and servo 1
  utime.sleep(1)
```
Notes
The module's I2C address is 0x1E by default, but it can be changed by modifying the ADDR pin.
 The module's UART baud rate is 115200 by default, but it can be changed using the `setBaudrate()` function.
 The module's motor and servo control signals are active-low, meaning a logic low signal enables the motor or servo.
Troubleshooting
Make sure to connect the module to a power source and ground properly.
 Verify that the module is properly connected to the microcontroller or other components.
 Check the module's I2C address and baud rate settings match the configuration.
 Use a logic analyzer or oscilloscope to debug the communication signals.