A 1-Channel Relay Module is an electronic device that allows a low-power signal to control a much higher power circuit. It acts as a switch that can be controlled electronically. The module includes a relay, which is an electromechanical switch, along with components for signal amplification and isolation to ensure that the low-power control signal can operate the relay without interference. This module is commonly used in automation projects, home automation systems, and in applications where interfacing between low-level logic circuits and high-power devices is required.
Pin | Description |
---|---|
VCC | Connect to the positive supply voltage (5V) |
GND | Connect to the ground of the power supply |
IN | Control signal input from the microcontroller |
NO | Normally Open: Relay is disconnected by default, closes when activated |
COM | Common: Connects to the circuit to be controlled |
NC | Normally Closed: Relay is connected by default, opens when activated |
// Define the relay control pin
const int relayPin = 2;
void setup() {
// Set the relay pin as an OUTPUT
pinMode(relayPin, OUTPUT);
}
void loop() {
// Turn on the relay (activate the connected device)
digitalWrite(relayPin, HIGH);
delay(1000); // Wait for 1 second
// Turn off the relay (deactivate the connected device)
digitalWrite(relayPin, LOW);
delay(1000); // Wait for 1 second
}
Q: Can I control the relay module with a 3.3V signal? A: Some relay modules can be triggered with 3.3V, but it's essential to check the specifications of your specific module.
Q: Is it safe to control AC devices with a relay module? A: Yes, as long as the device's power requirements do not exceed the relay's ratings and proper safety precautions are taken.
Q: Can I use PWM to control the relay? A: No, relays require a stable HIGH or LOW signal to switch states. PWM is not suitable for relay control.
Remember to always follow safety guidelines when working with electronics, especially when controlling high-power devices.