Introduction
In this tutorial we will study how to drive a relay using a transistor
🛠️ Components Needed
Arduino Uno R3
LU-5-R Relay (5V)
BC547 Transistor (NPN)
1kΩ Resistor (for the Transistor Base)
1N4007 Diode (Flyback/Freewheeling diode)
External Power Source (Battery or Power Supply)
🔌 Circuit and Connections
The BC547 acts as a "bridge" that allows a small signal from the Arduino to control the heavy current of the relay coil.
1. The Transistor Connections:
Emitter (E): Connect directly to Arduino GND.
Base (B): Connect through a 1kΩ resistor to Arduino Digital Pin 13.
Collector (C): Connect to one side of the Relay Coil.
2. The Relay & Diode:
Coil Side A: Connect to the Transistor Collector.
Coil Side B: Connect to the 5V supply.
Flyback Diode (1N4007): Place this across the relay coil pins (Silver stripe toward the 5V side). This prevents the "star" warning sparks from inductive kickback.
3. The Load Side (LU-5-R Pins):
Connect your light bulb or motor to the COM and NO pins as usual.
💻 Arduino Code
You can use the simple Blink code to test this circuit.
pinMode(13, OUTPUT); // Sends signal to BC547 Base
}
void loop() {
digitalWrite(13, HIGH); // Transistor turns ON, Relay clicks
delay(1000);
digitalWrite(13, LOW); // Transistor turns OFF, Relay releases
delay(1000);
}
🔍 Why do we need the BC547?
An Arduino pin can only output about 20mA of current. A typical LU-5-R relay coil needs about 70mA to 100mA to stay closed.
If you connect it directly, you might damage your Arduino
The BC547 amplifies the small current from Pin 13 to a level high enough to power the coil safely.
💡 Pro-Tips for Kerala Students
Check the Pins: For the BC547, looking at the flat side, the pins are Collector-Base-Emitter (CBE) from left to right.
Safety: This transistor circuit is the industry standard for driving loads. Whether you are in a lab in Kottayam or building a home automation system, always use a transistor driver for relays.