
This circuit uses an Arduino Nano to control a 12V relay based on input from an IR sensor. The relay, powered by a 9V battery, can switch a connected load (NamChamDien) on or off depending on the sensor's output.
A relay is an electromechanical switch that uses an electromagnetic coil to open or close a circuit, allowing control of high-power devices with low-power signals. Relays are widely used in applications where electrical isolation, high-current switching, or remote control of circuits is required. They are essential in automation systems, home appliances, automotive electronics, and industrial equipment.

This circuit uses an Arduino Nano to control a 12V relay based on input from an IR sensor. The relay, powered by a 9V battery, can switch a connected load (NamChamDien) on or off depending on the sensor's output.

This circuit uses an ESP8266 NodeMCU to control a 12V single-channel relay, which in turn controls a 220V AC red light. The relay is powered by a 5V DC source, and the ESP8266 is used to switch the relay on and off via its D1 pin, allowing for remote or automated control of the AC light.

This circuit uses an ESP8266 NodeMCU microcontroller to control a 12V single-channel relay, which in turn switches an AC-powered red light on and off. The relay's control input (IN) is connected to a digital output (D1) on the ESP8266, allowing the microcontroller to activate the relay. The relay's normally open (NO) contact is used to complete the circuit for the red light when the relay is energized, and the power for the relay's coil and the microcontroller is supplied by a 5V DC source.

This circuit uses a Vietduino Uno to control a 5V relay, which in turn operates a 5V mini water pump powered by a 9V battery. An ultrasonic sensor connected to the Vietduino Uno is used to trigger the relay, allowing for automated control of the water pump based on distance measurements.
Below is the pin configuration for a typical 5V SPDT relay module:
| Pin Name | Description |
|---|---|
| VCC | Connects to the positive supply voltage (e.g., 5V DC). |
| GND | Connects to the ground of the power supply. |
| IN | Control signal input (e.g., from a microcontroller like Arduino). |
| COM | Common terminal for the relay switch. |
| NO | Normally Open terminal. Connects to COM when the relay is activated. |
| NC | Normally Closed terminal. Connects to COM when the relay is not activated. |
// This example demonstrates how to control a relay module with an Arduino UNO.
// The relay is connected to pin 7 of the Arduino.
#define RELAY_PIN 7 // Define the pin connected to the relay module
void setup() {
pinMode(RELAY_PIN, OUTPUT); // Set the relay pin as an output
digitalWrite(RELAY_PIN, LOW); // Ensure the relay is off at startup
}
void loop() {
digitalWrite(RELAY_PIN, HIGH); // Turn the relay on
delay(1000); // Keep the relay on for 1 second
digitalWrite(RELAY_PIN, LOW); // Turn the relay off
delay(1000); // Keep the relay off for 1 second
}
RELAY_PIN with the appropriate pin number if using a different setup.Relay Not Activating:
Relay Clicking but Load Not Working:
Voltage Spikes or Noise:
Relay Overheating:
Can I use a relay with an AC load? Yes, relays are designed to handle both AC and DC loads. Ensure the relay's ratings match the AC voltage and current requirements.
What is the difference between NO and NC terminals?
Can I control multiple relays with one microcontroller? Yes, you can control multiple relays by connecting each relay's IN pin to a separate digital output pin on the microcontroller.
Why is electrical isolation important in relays? Electrical isolation protects the control circuit (e.g., microcontroller) from high voltages or currents in the load circuit, ensuring safety and preventing damage.
By following this documentation, you can effectively use a relay in your electronic projects while ensuring safety and reliability.