Stufin
Home Quick Cart Profile

M5 Stack Catch Unit (SG92R)

Buy Now

Pin Configuration

  • M5 Stack Catch Unit (SG92R) Pinout Description
  • The M5 Stack Catch Unit (SG92R) is a compact, high-performance servo control module designed for IoT applications. Here's a detailed explanation of each pin on the module:
  • 1. VCC (5V Power Input)
  • Function: Power supply for the module
  • Description: This pin supplies 5V power to the module. Connect it to a 5V power source, such as a battery or a USB connection.
  • 2. GND (Ground)
  • Function: Ground reference
  • Description: This pin provides a common ground reference for the module. Connect it to the ground of your power source or system.
  • 3. SDA (I2C Data)
  • Function: I2C data pin
  • Description: This pin is used for I2C communication. It transmits and receives data between the module and other I2C devices.
  • 4. SCL (I2C Clock)
  • Function: I2C clock pin
  • Description: This pin provides the clock signal for I2C communication. It synchronizes data transmission and reception between the module and other I2C devices.
  • 5. RX (UART Receive)
  • Function: UART receive pin
  • Description: This pin receives serial data from a UART transmitter. It can be connected to the TX pin of a UART device.
  • 6. TX (UART Transmit)
  • Function: UART transmit pin
  • Description: This pin transmits serial data to a UART receiver. It can be connected to the RX pin of a UART device.
  • 7. PWM (Servo Control Signal)
  • Function: Pulse Width Modulation (PWM) signal output
  • Description: This pin outputs a PWM signal to control the servo motor. The PWM signal determines the position and speed of the servo.
  • 8. VEXT (External Power Input)
  • Function: External power input for servo motor
  • Description: This pin can be used to power the servo motor directly from an external power source. It's recommended to use this pin when the servo motor requires a higher current or voltage than the module can provide.
  • 9. SG92R Signal (Servo Motor Control Signal)
  • Function: Signal pin for SG92R servo motor
  • Description: This pin connects to the signal wire of the SG92R servo motor. It receives the PWM signal from the module and controls the servo motor's movement.
  • Connection Structure:
  • To connect the M5 Stack Catch Unit (SG92R) to your project, follow these steps:
  • 1. Connect VCC to a 5V power source.
  • 2. Connect GND to the ground of your power source or system.
  • 3. Connect SDA to the SDA pin of your I2C device (e.g., a microcontroller).
  • 4. Connect SCL to the SCL pin of your I2C device.
  • 5. Connect RX to the TX pin of your UART device (e.g., a serial terminal).
  • 6. Connect TX to the RX pin of your UART device.
  • 7. Connect PWM to the signal wire of your servo motor (if using an external servo motor).
  • 8. Connect VEXT to an external power source (if using an external power source for the servo motor).
  • 9. Connect SG92R Signal to the signal wire of the SG92R servo motor (if using the integrated servo motor).
  • Note:
  • Make sure to use the correct polarity and voltage when connecting the power supply to the module.
  • When using I2C communication, ensure that the SDA and SCL pins are correctly connected to the corresponding pins on your I2C device.
  • When using UART communication, ensure that the RX and TX pins are correctly connected to the corresponding pins on your UART device.
  • When using an external servo motor, ensure that the PWM signal is correctly connected to the signal wire of the servo motor.
  • When using an external power source for the servo motor, ensure that the VEXT pin is correctly connected to the power source.

Code Examples

M5 Stack Catch Unit (SG92R) Documentation
Overview
The M5 Stack Catch Unit (SG92R) is a robotic servo controller module designed for the M5 Stack ecosystem. It integrates a high-torque SG92R servo motor and a built-in switching circuit, allowing for precise control and monitoring of robotic mechanisms. This module is ideal for IoT projects that require precise motion control, such as robotics, automation, and robotic arms.
Hardware Specifications
Servo Motor: SG92R
 Operating Voltage: 3.3V - 6V
 Torque: 1.2 kgcm
 Speed: 0.12 sec/60
 Communication Protocol: I2C
 Dimensions: 54.2 x 25.4 x 12.8 mm
Software Interface
The M5 Stack Catch Unit (SG92R) can be controlled using the M5 Stack's UIFlow or Arduino IDE. The module communicates with the microcontroller using the I2C protocol.
Code Examples
### Example 1: Basic Servo Control using UIFlow
This example demonstrates how to control the servo motor using UIFlow.
```python
import m5
# Initialize the Catch Unit module
catch_unit = m5.CatchUnit(0x1E)
# Set the servo motor to 0
catch_unit.servo_write(0)
# Wait for 1 second
m5.delay(1000)
# Set the servo motor to 90
catch_unit.servo_write(90)
# Wait for 1 second
m5.delay(1000)
# Set the servo motor to 180
catch_unit.servo_write(180)
```
### Example 2: Servo Control with Arduino IDE
This example demonstrates how to control the servo motor using the Arduino IDE.
```cpp
#include <M5 CatchUnit.h>
// Define the Catch Unit module
M5_CatchUnit catchUnit;
void setup() {
  // Initialize the Catch Unit module
  catchUnit.begin();
}
void loop() {
  // Set the servo motor to 0
  catchUnit.servoWrite(0);
  delay(1000);
// Set the servo motor to 90
  catchUnit.servoWrite(90);
  delay(1000);
// Set the servo motor to 180
  catchUnit.servoWrite(180);
  delay(1000);
}
```
### Example 3: Advanced Servo Control using MicroPython
This example demonstrates how to control the servo motor using MicroPython and implement a more complex motion sequence.
```python
import machine
import utime
# Initialize the Catch Unit module
catch_unit = machine.I2C(sda=machine.Pin(21), scl=machine.Pin(22), freq=400000)
catch_unit addr = 0x1E
# Define a function to set the servo motor position
def set_servo_position(pos):
  catch_unit.writeto(0x1E, b'x00' + bytes([pos]))
# Define a motion sequence
motion_sequence = [
  (0, 1000),  # 0, 1 second
  (90, 500),  # 90, 0.5 seconds
  (180, 1000),  # 180, 1 second
  (0, 500)  # 0, 0.5 seconds
]
# Run the motion sequence
for pos, delay_ms in motion_sequence:
  set_servo_position(pos)
  utime.sleep_ms(delay_ms)
```
These code examples demonstrate the basic usage of the M5 Stack Catch Unit (SG92R) module in various programming environments. The module can be used in more complex IoT projects, such as robotic arms, robotic grippers, and automation systems.