A relay is an electromechanical switch that uses an electromagnetic coil to open or close a circuit. It allows a low-power signal to control a high-power circuit, making it an essential component in many electronic and electrical systems. Relays are widely used in applications such as home automation, industrial control systems, automotive electronics, and power distribution systems. They provide electrical isolation between the control circuit and the high-power circuit, ensuring safety and reliability.
Below are the general technical specifications for a standard single-pole single-throw (SPST) relay. Specifications may vary depending on the specific relay model.
The pin configuration of a typical 5V SPDT relay is as follows:
Pin Name | Description |
---|---|
Coil+ | Positive terminal of the electromagnetic coil. |
Coil- | Negative terminal of the electromagnetic coil. |
COM | Common terminal for the relay switch. |
NO | Normally Open terminal. Connected to COM when the relay is activated. |
NC | Normally Closed terminal. Connected to COM when the relay is not activated. |
Below is an example of how to control a 5V relay using an Arduino UNO:
// Define the pin connected to the relay module
const int relayPin = 7;
void setup() {
pinMode(relayPin, OUTPUT); // Set the relay pin as an output
digitalWrite(relayPin, LOW); // Ensure the relay is off at startup
}
void loop() {
digitalWrite(relayPin, HIGH); // Turn the relay on
delay(1000); // Keep the relay on for 1 second
digitalWrite(relayPin, LOW); // Turn the relay off
delay(1000); // Keep the relay off for 1 second
}
Note: Ensure the relay module is connected to the Arduino's ground (GND) and the relay's control pin is connected to the specified relayPin
.
Relay Not Switching:
Chattering or Buzzing Noise:
Load Not Turning On/Off:
Microcontroller Resetting When Relay Activates:
Q: Can I use a relay to switch AC loads?
Q: What is the purpose of the flyback diode?
Q: Can I control a relay directly from a microcontroller pin?
Q: How do I choose the right relay for my application?