H-BRIDGE BASED DC MOTOR DIRECTION CONTROL USING RELAY SIMULATION IN PROTEUS

Photo of author

By Jackson Taylor

Home » Hardware » H-BRIDGE BASED DC MOTOR DIRECTION CONTROL USING RELAY SIMULATION IN PROTEUS

As an Amazon Associate we earn from qualifying purchases.

A DC motor turns in the direction set by the polarity of the voltage across it. Swap the two wires and it spins the other way. An H-bridge is the circuit that does this swap electrically, so you don’t have to touch the wiring. This article explains how to build an H-bridge from relays, how it controls motor direction, and how to simulate it in Proteus before using real parts.

The video above walks through the simulation. The sections below cover the theory and the setup so you can follow along or rebuild it yourself.

What an H-bridge does

An H-bridge gets its name from its shape. The motor sits in the middle (the crossbar of the “H”), and four switches sit on the four arms. By closing different pairs of switches, you connect the motor terminals to the supply in either polarity.

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video
  • Forward: the top-left and bottom-right switches close, so current flows through the motor in one direction.
  • Reverse: the top-right and bottom-left switches close, so current flows the opposite way.
  • Stop: all switches open, or both motor terminals are tied to the same potential.

Closing both switches on the same side at once connects the supply directly to ground. This is a short circuit and must never happen. Good designs make it impossible.

Why use relays for the switches

Relays are a simple way to learn H-bridge behavior. The contacts are electrically isolated from the control side, you can see which contact is active, and they work with a wide range of motor voltages. They are also easy to simulate.

They do have drawbacks. Relays are mechanical, so they are slower than transistors, they wear out, and they cannot do PWM speed control. For direction control alone, they are a good fit.

If you want a simpler look at the bridge alone, see our H-bridge using relay simulation article.

See also
Best Compact Camera for Safari: 5 Picks by Zoom, Weight and Bush-Flight Limits

Components for the Proteus simulation

You can build this circuit with a small set of parts from the Proteus library:

  • Two changeover (SPDT) relays, or one dual-pole relay with the contacts wired accordingly
  • One DC motor (the Proteus MOTOR model works)
  • Two NPN transistors to drive the relay coils (a general-purpose type such as 2N2222 or BC547 is common)
  • Two diodes (such as 1N4007), placed across the relay coils as flyback protection
  • Two base resistors, one for each transistor
  • Two switches or buttons for direction input
  • A DC supply and ground

Pick a relay coil voltage that matches your supply, and check the relay model’s properties in Proteus if the contacts do not switch as expected.

How the relay H-bridge is wired

With two changeover relays, each relay forms one side of the “H”. Wire them like this:

  1. Connect the common terminal of relay 1 to one motor terminal, and the common terminal of relay 2 to the other.
  2. Connect the normally open (NO) contact of both relays to the positive supply.
  3. Connect the normally closed (NC) contact of both relays to ground.

Each relay therefore connects its motor terminal to ground when off and to the positive supply when on. This gives you the following states:

  • Both relays off: both motor terminals are at ground, so the motor is stopped.
  • Relay 1 on, relay 2 off: terminal A is positive and terminal B is ground, so the motor turns one way.
  • Relay 2 on, relay 1 off: the polarity is reversed, so the motor turns the other way.
  • Both relays on: both terminals are positive, so the motor is stopped.

This layout cannot short the supply, which is a major advantage over a bridge built from four independent switches.

Driving the relay coils

A switch or microcontroller pin cannot usually drive a relay coil directly. Use a transistor as the driver:

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works
  1. Connect the relay coil between the supply and the transistor’s collector.
  2. Connect the emitter to ground.
  3. Connect the base to the control input through a resistor.
  4. Place a diode across the coil, with the cathode on the supply side.
See also
BOOST CONVERTER USING ARDUINO - SIMULATION IN PROTEUS

The diode absorbs the voltage spike that appears when the coil turns off. Proteus may not complain if you leave it out, but real hardware will suffer, so include it in the simulation as well.

Running the simulation in Proteus

1. Build the schematic

Place the parts, wire the relays as above, and connect the two driver stages. Add a switch to the base resistor of each transistor, with a source of logic high for the “on” state.

2. Start the simulation

Press play. With both switches open, the motor should be still. Close the first switch, and the motor should turn in one direction. Open it, close the second, and the motor should reverse.

3. Test the edge cases

Close both switches together to confirm the motor stops rather than causing a fault. Toggle quickly between directions to see how the circuit reacts. In real hardware, it is better to stop the motor briefly before reversing it, to reduce stress on the contacts and the motor.

Controlling the bridge with a microcontroller

Once the manual version works, you can replace the switches with two output pins from an Arduino or similar board. The driver transistors stay in place, so the board only supplies a small base current. Our accelerometer based wheel chair using Arduino project applies the same idea, using a relay H-bridge to drive motors from sensor input.

The same principle appears in other motor projects. For example, reversing the control of a PSC AC motor uses relays to switch winding connections instead of motor polarity. If you work with other motor types, Arduino and servo motor interfacing shows a different approach, and step and direction control covers stepper drivers.

Common problems and fixes

  • Motor does not move: check that the relay coil voltage matches the supply and that the transistor is receiving base current.
  • Motor always runs one way: check that the NO and NC contacts are not swapped on one of the relays.
  • Relays do not click: confirm the ground connection and the transistor’s emitter wiring.
  • Simulation warnings about contacts: check the relay model’s pin layout and properties.
See also
LM1084 -3.3

Relay or transistor H-bridge?

Relays suit learning projects, low switching rates and higher voltages where isolation is useful. For speed control, frequent reversing, or compact designs, a transistor or MOSFET bridge, or a ready-made motor driver chip, is the better choice because it supports PWM and has no moving parts.

FAQ

Can I control the speed of the motor with this circuit?

Not in a practical way. Relays are too slow and wear out quickly if switched rapidly, so they are best for on/off and direction control. Use a transistor-based driver for PWM speed control.

Why does the H-bridge need flyback diodes?

A relay coil is an inductor. When current through it is cut, it produces a voltage spike that can damage the driver transistor. A diode across the coil gives that current a safe path.

What happens if both relays turn on at the same time?

In the wiring described here, both motor terminals connect to the positive supply, so there is no voltage across the motor and it stops. The supply is not shorted.

Can I use the same design on real hardware?

Yes, but check the relay’s contact rating against the motor’s running and stall current, and use proper flyback protection. Motors draw more current at start-up than when running.

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works