Actuators & Control · Study deck

Relays and Solenoids: Drivers and Protection

A coil stores energy and sends it back when switched off.

Motor Max is your guide for this deck.

relayssolenoids
Motor Max, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: Different bodies can provide the same electrically controlled switching capability, but the isolation technology, current path, terminals, protection parts, and mounting method determine where each relay form belongs.
  • Explain: Step 4: Verify mechanical life against application: Both relays exceed the required lifespan, but contact degradation from inrush current will shorten this significantly if undersized.
  • Explain: The software command is small, but the coil current, contact rating, flyback path, and default state decide whether the physical action is safe.
  • Explain: Once the relay pattern is clear, a solenoid is the same electrical problem with motion instead of contacts.
iotclass.org

Major section

Start With the Story

The coil stored energy that had nowhere safe to go.

  • An actuator means a part that turns an electrical command into physical action.
  • GPIO means general purpose input/output.
  • A GPIO pin is a small digital connection on a controller; it must not power a heavy coil directly.

Key terms

Relays and solenoids
Relays and solenoids are useful because they make clean on/off actions.
iotclass.org

Major section

Start With the Story (continued)

This runway does not prove that every relay or solenoid suits the load.

  • The deeper sections explain ratings, drivers, isolation, flyback protection, heating, switching life, and mechanical limits.
  • Think of a water valve that opens only when the controller energizes a coil, then snaps shut when power is removed.
  • The software command is small, but the coil current, contact rating, flyback path, and default state decide whether the physical action is safe.
iotclass.org

Major section

Never Connect Relay Coil Directly to GPIO!

Most relay coils draw 50-100mA, far exceeding the 20-40mA GPIO limit.

  • Different bodies can provide the same electrically controlled switching capability, but the isolation technology, current path, terminals, protection parts, and mounting method determine where each relay form belongs.
One-channel electromechanical relay breakout with logic header, indicator, relay can, and screw terminals
One-channel electromechanical relay breakout with logic header, indicator, relay can, and screw terminals
iotclass.org

Major section

Solenoid Control

Once the relay pattern is clear, a solenoid is the same electrical problem with motion instead of contacts.

  • Solenoids provide linear push/pull motion for locks, valves, and latches.
  • The visible valve motion is evidence from a chain of energy conversions, not proof that coil current alone guarantees movement.
An industrial butterfly valve with a pneumatic actuator and electrically controlled solenoid valve mounted on top
An industrial butterfly valve with a pneumatic actuator and electrically controlled solenoid valve mounted on top
iotclass.org

Major section

Solid-State Relays (SSR)

With coil protection handled, the next choice is which switching technology best matches the load and cycle pattern.

  • For silent, high-speed, and maintenance-free switching, use solid-state relays.
  • No moving contact means quiet, fast cycling, but leakage, on-state voltage drop, load type, and heatsinking remain part of the switching decision.
A black solid-state relay module with screw terminals, control markings, and status LED
A black solid-state relay module with screw terminals, control markings, and status LED
iotclass.org

Major section

Design Example: Smart Sprinkler Controller

The exact component choices vary by product, but the engineering tradeoffs are stable.

  • The engineering challenge: Each irrigation zone uses a 24V AC solenoid valve drawing 250-500 mA inrush current.
  • The controller must switch up to 16 zones, survive outdoor temperature extremes (-20C to +50C), and last 10+ years with daily cycling.
  • Lesson for IoT designers: solid-state switching is not always chosen for raw electrical superiority.

Why it matters

A Wi-Fi-connected irrigation controller is a useful relay and solenoid design example because it must switch many outdoor valve coils, survive wiring faults, and avoid nuisance noise in a home installation.

iotclass.org

Major section

12V Motor Relay Sizing

Scenario: You are designing an IoT greenhouse controller that switches a 12V DC ventilation fan on and off based on temperature readings.

  • The fan motor is rated for 5A continuous operation.
  • Relay B: 15A assumed inrush / 28A measured = 0.54× margin (undersized -- contacts will arc and weld!).
  • Step 4: Verify mechanical life against application: Both relays exceed the required lifespan, but contact degradation from inrush current will shorten this significantly if undersized.

Numbers to remember

5AThe fan motor is rated for 5A continuous operation.
iotclass.org

Deck summary

Key takeaways

The coil stored energy that had nowhere safe to go.

  • This runway does not prove that every relay or solenoid suits the load.
  • Most relay coils draw 50-100mA, far exceeding the 20-40mA GPIO limit.
  • Once the relay pattern is clear, a solenoid is the same electrical problem with motion instead of contacts.
  • With coil protection handled, the next choice is which switching technology best matches the load and cycle pattern.
iotclass.org

Retrieval practice

Recall check

Motor Max says: answer from memory, then check your reasoning.

Q1An ESP32 must switch a 5 V relay coil rated at 80 mA. What is the safest interface design?

AUse a transistor or MOSFET driver with a flyback diode across the relay coil
BConnect the relay coil directly to a GPIO pin because both use 5 V logic
CPut the flyback diode in series with the relay contact terminals
DUse a pull-up resistor only, because relays provide electrical isolation
Show answer

Answer: A Relay and solenoid coils are inductive loads, so microcontrollers should drive them through a transistor or MOSFET stage with flyback protection.

iotclass.org

Print reference

Answers

Answer key.

  1. A · Relay and solenoid coils are inductive loads, so microcontrollers should drive them through a transistor or MOSFET stage with flyback protection.
iotclass.org