Home

Guide no. 4

A switch operated by an electromagnet: it separates the control circuit (coil) from the power circuit (contacts).

By Ada Intelisano · informaticait.it technical team

Download the PDF (A4, 2 pages) Free to print and share, without changes — CC BY-ND 4.0
In short
  • The coil draws I = V / R: a 5 V relay with a 70 Ω coil draws about 71 mA.
  • A microcontroller pin is not enough (20 mA recommended): you need a transistor or a relay module.
  • A diode must always sit across the coil (cathode to +): it protects the transistor at switch-off.
  • Contacts: COM common, NO normally open, NC normally closed.
Driving a relay with a transistor+5 VCoil1N4007NPNCEBMCU pin1 kΩCOMNONCContacts: isolatedfrom the control sideinformaticait.it

Pin high → the transistor conducts → the coil is energised and COM moves from NC to NO. The flyback diode absorbs the voltage spike the coil generates when it switches off.

Worked example. SRD-05VDC relay: 70 Ω coil → I = 5 / 70 ≈ 71 mA, power 5 × 0.071 ≈ 0.36 W. NPN transistor with forced gain 20 → IB ≈ 3.6 mA → RB = (5 − 0.7) / 0.0036 ≈ 1.2 kΩ → 1 kΩ. It also works with a 3.3 V pin (IB ≈ 2.6 mA).

Reading relay data

DataExampleWhat it means
Coil voltage5 V DCcontrol voltage; from 3 to 48 V, also AC versions
Coil resistance70 Ωsets the current drawn: I = V / R
Contact rating10 A 250 V AC
10 A 30 V DC
with DC the allowed voltage is much lower (arcing)
ConfigurationSPDT (1 changeover)COM, NO, NC; DPDT = two changeovers switched together
Drop-out voltage≥ 10% of nominal Vbelow this voltage the relay releases

Contacts at rest and with the coil energised

Coil off: COM–NC closedCOMNONClamp on NC litCoil energised: COM–NO closedCOMNONClamp on NO litinformaticait.it

Relay modules and solid-state relays

  • Relay modules already include transistor, diode and LED; some also an optocoupler.
  • Many modules are active low ("low level trigger"): the relay switches with the pin at 0.
  • On optocoupled modules the JD-VCC jumper lets you power the coil separately.
  • Solid-state relays (SSR) are silent and wear-free, but they get warm, have a small leakage current, and triac types work on AC only.

Common mistakes

  • Driving the coil directly from the pin: too much current, the pin gets damaged.
  • Forgetting the diode or fitting it backwards: in the first case the transistor fails, in the second it is a short circuit.
  • Using the contacts at full rating with motors, lamps or power supplies: the inrush current is many times the nominal one. Choose a relay with margin.
  • Treating the 230 V side like the 5 V side: clearances, insulation and a suitable enclosure are required.
Warning: connections to 230 V mains are dangerous and must be made by qualified personnel, according to local regulations.
Sources: Songle SRD-05VDC-SL-C datasheet · onsemi BC547 and 1N4007 datasheets

Useful products

Other guides

All our guides →
Loading...
Back to top