Robots often need a small control signal from a microcontroller to switch a much larger current through a motor, pump, lamp, or solenoid. Two common switching devices are mechanical relays and MOSFETs. A relay uses moving metal contacts, while a MOSFET uses an electric field inside a semiconductor.
Choosing the right switch affects speed, efficiency, noise, lifetime, and how well the robot can control motor power.
Understanding Robotics: Relay vs MOSFET Switching
A relay does more than open or close a circuit. Its coil creates magnetism that pulls an armature, which moves the contacts. This physical motion takes milliseconds and causes contact bounce.
During bounce, contacts may make and break several times before settling. That is usually harmless for a simple light, yet it can create electrical noise in a sensitive robot. Contacts wear a little each time they open under load.
A motor is especially hard on them because its current tries to keep flowing and forms an arc across the opening gap. Relay data sheets therefore list separate ratings for resistive loads and inductive loads. A relay rated for a large current with a heater may be rated for much less current with a motor.
A MOSFET has no contacts to wear, but it must be chosen and driven carefully. The gate threshold voltage does not mean the device is fully on. It only marks the point where a very small current begins to flow under test conditions.
A microcontroller output might be three point three volts or five volts, so students should find an N channel MOSFET with an on resistance specified at that exact gate voltage. If the gate voltage is too low, the MOSFET stays partly on. It then behaves like a resistor, gets hot, and wastes battery energy.
Its heating rises with the square of current. Doubling current makes this particular loss four times larger when resistance stays the same.
Motors draw far more current at startup than during normal spinning. This is called stall current because the same high current occurs if the shaft cannot turn. A switching circuit must survive that current, not just the current printed for normal operation.
Wires, connectors, battery cells, and circuit board tracks need the same check. Place a flyback diode across a DC motor or solenoid so it provides a safe route for current when the switch turns off. Without it, the magnetic field collapses and can produce a damaging voltage spike.
The diode must be connected in the direction that blocks normal supply current. For a low side MOSFET circuit, the controller ground and power ground need a solid common connection so the gate signal has a reliable reference.
PWM changes average motor power by turning a MOSFET on and off repeatedly. The motor winding smooths much of this pulsing current, while the spinning rotor adds inertia. Switching is not perfectly lossless because a MOSFET spends a brief time between fully off and fully on.
During that interval it has both voltage across it and current through it, which creates heat. A suitable PWM frequency balances audible noise, switching heat, motor behavior, and microcontroller limits. Add a resistor in series with the gate to limit sharp current pulses from the controller.
Add a pull down resistor from gate to ground so the MOSFET stays off while the controller starts up. In real robot builds, a fuse close to the battery and short power wiring often prevent more damage than an advanced control program can fix.
Key Facts
- Relay contacts are controlled by an energized coil, so the input and output can be electrically isolated.
- A MOSFET acts like a voltage-controlled switch, with gate voltage controlling current from drain to source.
- MOSFET conduction loss is approximately P = I^2 RDS(on), where RDS(on) is the on-resistance.
- A relay coil needs a flyback diode because an inductor produces a voltage spike when current is interrupted.
- PWM motor speed control requires fast switching, so MOSFETs are usually preferred over relays.
- For a low-side N-channel MOSFET switch, the motor connects to +V and the MOSFET switches the path to ground.
Vocabulary
- Relay
- A relay is an electromechanical switch that uses a coil-generated magnetic field to open or close metal contacts.
- MOSFET
- A MOSFET is a transistor that uses gate voltage to control current through a semiconductor channel.
- Flyback diode
- A flyback diode is a protective diode placed across an inductive load to safely carry current when the switch turns off.
- PWM
- PWM, or pulse width modulation, controls average power by rapidly switching a load on and off with a chosen duty cycle.
- RDS(on)
- RDS(on) is the small resistance between drain and source when a MOSFET is fully turned on.
Common Mistakes to Avoid
- Using a relay for high-frequency PWM motor control is wrong because relay contacts are mechanical and will chatter, heat, wear, and fail quickly.
- Connecting a MOSFET gate directly to an unknown control voltage is risky because the device may not fully turn on unless the gate-source voltage is high enough for the chosen current.
- Forgetting the flyback diode on a motor, relay coil, or solenoid is wrong because inductive voltage spikes can damage the transistor, microcontroller, or switch contacts.
- Ignoring current and power ratings is wrong because both relay contacts and MOSFETs can overheat or fail if the motor stall current exceeds their safe limits.
Practice Questions
- 1 A MOSFET switches a 4.0 A motor and has RDS(on) = 0.050 ohm. Calculate the MOSFET conduction power loss using P = I^2 RDS(on).
- 2 A 12 V relay coil has resistance 240 ohm. Find the coil current using I = V/R, and calculate the coil power using P = VI.
- 3 A robot motor must be speed-controlled using PWM at 20 kHz. Explain whether a relay or a MOSFET is the better switch, and give two reasons based on switching speed, wear, or efficiency.