A relay module is an electronic device that acts as a switch, which can be controlled by an external circuit. It allows a low-power signal to control a much higher power circuit. Relay modules are commonly used in applications where it is necessary to control a high power or high voltage load with a low voltage, such as home appliances, industrial machines, and automation systems.
Pin Name | Description |
---|---|
VCC | Connects to the power supply voltage (e.g., 5V) |
GND | Connects to the ground of the power supply |
IN | Input signal that activates the relay (active LOW or HIGH depending on the module) |
NO | Normally Open contact, closes when relay is activated |
NC | Normally Closed contact, opens when relay is activated |
COM | Common contact, connects to NO or NC |
// 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 (assuming active LOW)
digitalWrite(relayPin, LOW);
delay(1000); // Wait for 1 second
// Turn off the relay
digitalWrite(relayPin, HIGH);
delay(1000); // Wait for 1 second
}
Q: Can I control a relay module directly with an Arduino?
Q: What is the purpose of the NC contact?
Q: How can I control multiple relay modules with an Arduino?
Remember to always follow safety guidelines when working with high voltage and current.