A 12V single channel relay is an electromechanical switch that allows you to control a high power device using a low power signal. It acts as a bridge between a control circuit (operating at low voltage) and a load circuit (operating at high voltage). This component is widely used in automation systems, home appliances, and automotive electronics where it is necessary to control devices such as motors, lights, and other high power loads.
Pin Number | Description | Notes |
---|---|---|
1 | VCC | Connect to 12V power supply |
2 | GND | Connect to ground |
3 | IN | Control signal input (TTL level) |
4 | Normally Closed (NC) | Load connected, active when relay is off |
5 | Common (COM) | Connect to load power supply |
6 | Normally Open (NO) | Load connected, active when relay is on |
// Define the relay control pin
const int relayPin = 7;
void setup() {
// Set the relay pin as an output
pinMode(relayPin, OUTPUT);
}
void loop() {
// Turn on the relay
digitalWrite(relayPin, HIGH);
delay(1000); // Wait for 1 second
// Turn off the relay
digitalWrite(relayPin, LOW);
delay(1000); // Wait for 1 second
}
Q: Can I control this relay with a 5V signal? A: Yes, the control signal is TTL compatible, which means it can be operated with a 5V signal.
Q: What is the purpose of the NC and NO pins? A: The NC pin is connected to the load when the relay is off, and the NO pin is connected when the relay is on. This allows for normally closed or normally open operations.
Q: Can I use this relay with AC loads? A: Yes, the relay can switch AC loads up to 250V, but ensure that you are qualified to work with high voltage AC safely.
Q: How can I protect my microcontroller from the relay's back EMF? A: Use a flyback diode across the relay coil, and consider using a transistor between the microcontroller and the relay if necessary.