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.
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
constint RELAY_CTRL =8;voidsetup(){pinMode(RELAY_CTRL, OUTPUT);digitalWrite(RELAY_CTRL, LOW);// keep OFF at power-up}voidloop(){digitalWrite(RELAY_CTRL, HIGH);// energize relay -> LED ONdelay(1000);digitalWrite(RELAY_CTRL, LOW);// de-energize -> LED OFFdelay(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?
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?
dxg
copilot