LED Control with Relay

Great—let’s use your 5 V Songle relay to switch an LED from an Arduino Uno R4 WiFi using a safe transistor driver and a flyback diode.
Parts you’ll need
Why a transistor + diode
  • According to the SRD datasheet, the 5 V coil draws about 70 mA (coil resistance ≈ 70 Ω, pull-in ≤ 75% VNOM, drop-out ≥ 10% VNOM). An Arduino GPIO cannot source that directly.
  • Best practice: drive the coil with an NPN transistor and place a flyback diode across the coil. Knowledge rule: the diode current rating should be at or above the relay’s steady-state coil current (≥ 70 mA). Both 1N4148-1 and 1N4007RLG satisfy this.
Wiring (breadboard)
  • Power and ground:
    • Arduino 5V -> relay coil pin A2 (either coil pin; coil is non-polarized).
    • Arduino GND -> transistor emitter AND the relay’s LED return resistor’s ground.
  • Transistor driver (example uses Arduino D8):
    • Arduino D8 -> MF3W-680Ω±5%-QT73 -> PN2222A base.
    • Optional: 10 kΩ from base to GND (keeps it off at boot).
    • PN2222A emitter -> GND.
    • PN2222A collector -> relay coil pin A1.
  • Flyback diode across coil:
    • 1N4148-1 cathode to 5V (coil A2), anode to transistor collector (coil A1).
  • Relay contacts to switch the LED from 5 V:
    • COM -> 5V.
    • NO -> LED anode -> CFR-12JB-52-330R -> GND.
    • When the relay energizes, NO closes to COM and the LED turns on. If you prefer LED ON by default, move from NO to NC.
Arduino sketch (example on D8)

Cpp


const int RELAY_CTRL = 8;
void setup() {
  pinMode(RELAY_CTRL, OUTPUT);
  digitalWrite(RELAY_CTRL, LOW); // keep OFF at power-up
}
void loop() {
  digitalWrite(RELAY_CTRL, HIGH); // energize relay -> LED ON
  delay(1000);
  digitalWrite(RELAY_CTRL, LOW);  // de-energize -> LED OFF
  delay(1000);
}
Notes
  • The 680 Ω base resistor targets solid saturation for the ~70 mA coil current; 1 kΩ will also usually work for this relay, but 680 Ω gives more margin.
  • Tie Arduino GND and the relay driver’s GND together. Do not power the coil from a GPIO pin—use 5V + transistor as shown.
Want me to add these exact parts into a small schematic in your Flux project so you can follow it 1:1 on a breadboard?
Confirm relay coil wiring
Ask for Flux schematic help
Use different GPIO pin
Drive multiple relays
Ask about external supply
please explain what A1 does.

@copilot please explain what A1 does.
1y
Certainly! The relay you've mentioned, the SRD-05VDC-SL-C, is a Single Pole Double Throw (SPDT) relay, which means it has one common contact (COM) that can switch between two different contacts (normally open, NO, and normally closed, NC) when the coil is energized.
A1 and A2 are the pins for the relay coil. Here’s what each pin generally does:
  • A1: One end of the relay coil. When a voltage is applied across A1 and A2, the electromagnetic coil generates a magnetic field that either makes or breaks the switch between COM and NO or COM and NC.
  • A2: The other end of the relay coil. It pairs with A1 to complete the circuit for the coil.
In practical terms:
  • Applying 5V across A1 and A2 activates the relay.
  • When deactivated, COM is connected to NC.
  • When activated, COM switches from NC to NO, connecting to NO.
So, to summarize:
  • A1 and A2 are used to energize the relay coil.
  • COM, NC, and NO are used to control the switching part of the relay.
Would you like suggestions on how to connect these in a specific circuit?
1y
Someone is typing...
2
A2
COM
NC
A1
NO


No results...

SRD-05VDC-SL-C

SRD-05VDC-SL-C thumbnail
5V 15A SPDT (1 Form C) 5 Plugin,15.6x19.2mm Power Relays ROHS #CommonPartsLibrary #Relay #SPDT

Properties

Relay

Ningbo Songle Relay

SRD-05VDC-SL-C

K

Pricing & Availability

Distributor

Qty 1

Controls