Stufin
Home Quick Cart Profile

M5 Stack Mini 3A Relay Unit

Buy Now on Stufin

Supply Voltage

5V

Relays

3x SPDT (Single Pole Double Throw)

Relay Rating

3A per relay

Coil Voltage

5V

Coil Current

20mA

Operating Frequency

50/60Hz

Dimensions

24mm x 24mm x 12mm

Weight

10g

Operating Temperature

-20C to 70C

Applications

The M5 Stack Mini 3A Relay Unit is suitable for a wide range of IoT applications, including

Home automation systems

Industrial control systems

Remote monitoring and control systems

Smart energy management systems

IoT prototyping and development projects

Conclusion

The M5 Stack Mini 3A Relay Unit is a versatile and reliable relay module that provides a compact and efficient solution for controlling high-power devices or loads in IoT applications. Its low power consumption, easy integration, and simple wiring layout make it an ideal choice for a wide range of projects and applications.

Pin Configuration

  • M5 Stack Mini 3A Relay Unit Pinout Documentation
  • The M5 Stack Mini 3A Relay Unit is a compact and versatile IoT module designed for controlling and switching high-power devices. It features three relays, each capable of handling up to 3A of current. Below is a detailed explanation of each pin, along with connection guidelines.
  • Pinout Structure:
  • The M5 Stack Mini 3A Relay Unit has a total of 12 pins, divided into three main categories: Relay Control, Power, and GND.
  • Relay Control Pins (6 pins):
  • 1. R1 ( Relay 1 ): This pin controls the first relay. Connect it to a digital output pin on your microcontroller to switch the relay on or off.
  • 2. R2 ( Relay 2 ): This pin controls the second relay. Connect it to a digital output pin on your microcontroller to switch the relay on or off.
  • 3. R3 ( Relay 3 ): This pin controls the third relay. Connect it to a digital output pin on your microcontroller to switch the relay on or off.
  • 4. IN1 ( Relay 1 Input ): This pin is the input signal for the first relay. Typically connected to a digital output pin on your microcontroller.
  • 5. IN2 ( Relay 2 Input ): This pin is the input signal for the second relay. Typically connected to a digital output pin on your microcontroller.
  • 6. IN3 ( Relay 3 Input ): This pin is the input signal for the third relay. Typically connected to a digital output pin on your microcontroller.
  • Power Pins (3 pins):
  • 7. VIN ( Input Voltage ): This pin is the input voltage for the relay unit. Typically connected to a power source (e.g., a battery or a wall adapter) with a voltage range of 5V to 12V.
  • 8. VCC ( Output Voltage ): This pin provides a regulated 5V output, which can be used to power your microcontroller or other components.
  • 9. GND ( Ground ): This pin is the ground connection for the relay unit. Connect it to the ground pin on your microcontroller or power source.
  • Additional GND Pins (3 pins):
  • 10. GND ( Ground ): This pin is an additional ground connection for the relay unit. Connect it to the ground pin on your microcontroller or power source.
  • 11. GND ( Ground ): This pin is an additional ground connection for the relay unit. Connect it to the ground pin on your microcontroller or power source.
  • 12. GND ( Ground ): This pin is an additional ground connection for the relay unit. Connect it to the ground pin on your microcontroller or power source.
  • Connection Guidelines:
  • When using the relay unit with an M5 Stack module, connect the R1, R2, and R3 pins to digital output pins on the M5 Stack (e.g., GPIO 22, GPIO 23, and GPIO 25).
  • Connect the IN1, IN2, and IN3 pins to digital output pins on your microcontroller, depending on your specific application.
  • Connect the VIN pin to a suitable power source, ensuring the voltage range is within 5V to 12V.
  • Connect the VCC pin to the power input on your microcontroller or other components, if necessary.
  • Connect the GND pins to the ground pin on your microcontroller, power source, or other components.
  • Remember to handle the relay unit with care, as it contains high-voltage components. Ensure proper insulation and safety measures when working with the relay unit to avoid electrical shock or damage.

Code Examples

M5 Stack Mini 3A Relay Unit Documentation
Overview
The M5 Stack Mini 3A Relay Unit is a compact and versatile relay module designed for use with the M5 Stack ecosystem. This module features three SPDT (Single Pole Double Throw) relays, each capable of handling up to 3A of current. The relays are controlled by the M5 Stack's GPIO pins, allowing for easy integration into a wide range of IoT projects.
Pinout
The M5 Stack Mini 3A Relay Unit has the following pinout:
| Pin | Function |
| --- | --- |
| VCC | Power supply (3.3V or 5V) |
| GND | Ground |
| S1, S2, S3 | Relay control pins (connected to M5 Stack GPIO) |
| COM1, COM2, COM3 | Relay common pins |
| NO1, NO2, NO3 | Relay normally open pins |
| NC1, NC2, NC3 | Relay normally closed pins |
Connections
To use the M5 Stack Mini 3A Relay Unit, connect the VCC pin to the power supply (3.3V or 5V) and the GND pin to ground. Connect the relay control pins (S1, S2, S3) to the corresponding GPIO pins on the M5 Stack. The COM, NO, and NC pins connect to the load being controlled.
Code Examples
### Example 1: Basic Relay Control
This example demonstrates how to control a single relay using the M5 Stack Mini 3A Relay Unit.
```c
#include <M5Stack.h>
// Define relay control pins
const int relayPin = 2; // Replace with the desired GPIO pin
void setup() {
  // Initialize relay pin as output
  pinMode(relayPin, OUTPUT);
}
void loop() {
  // Turn relay on
  digitalWrite(relayPin, HIGH);
  delay(1000);
// Turn relay off
  digitalWrite(relayPin, LOW);
  delay(1000);
}
```
### Example 2: Relay Control with Button Press
This example demonstrates how to control a relay using the M5 Stack Mini 3A Relay Unit and a button press.
```c
#include <M5Stack.h>
// Define relay control pins and button pin
const int relayPin = 2; // Replace with the desired GPIO pin
const int buttonPin = 21; // Replace with the desired GPIO pin
void setup() {
  // Initialize relay pin as output and button pin as input
  pinMode(relayPin, OUTPUT);
  pinMode(buttonPin, INPUT);
}
void loop() {
  // Read button state
  int buttonState = digitalRead(buttonPin);
// If button is pressed, toggle relay state
  if (buttonState == HIGH) {
    static bool relayState = false;
    relayState = !relayState;
    digitalWrite(relayPin, relayState ? HIGH : LOW);
  }
  delay(50);
}
```
### Example 3: Relay Control with Wi-Fi using M5 Stack
This example demonstrates how to control a relay using the M5 Stack Mini 3A Relay Unit and Wi-Fi connectivity using the M5 Stack.
```c
#include <M5Stack.h>
#include <WiFi.h>
// Define relay control pins and Wi-Fi credentials
const int relayPin = 2; // Replace with the desired GPIO pin
const char ssid = "your_ssid";
const char password = "your_password";
WiFiServer server(80);
void setup() {
  // Initialize relay pin as output
  pinMode(relayPin, OUTPUT);
// Connect to Wi-Fi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  Serial.println("Connected to WiFi");
  server.begin();
}
void loop() {
  // Listen for HTTP requests
  WiFiClient client = server.available();
  if (client) {
    String request = client.readStringUntil('
');
    if (request.indexOf("relay=on") != -1) {
      digitalWrite(relayPin, HIGH);
    } else if (request.indexOf("relay=off") != -1) {
      digitalWrite(relayPin, LOW);
    }
    client.stop();
  }
  delay(50);
}
```
Note: These examples assume you have the M5 Stack and M5 Stack Mini 3A Relay Unit properly connected and configured. Make sure to adjust the pin numbers and Wi-Fi credentials according to your specific setup.