# What is an H-bridge? Sign-Magnitude and Locked Anti-Phase control of a DC motor

This article explains what is an H-bridge. Also, it describes two methods: Sign-Magnitude and Locked Anti-Phase control/driving of a DC motors using an H – bridge.
Also, it also describes a waveform of a voltage and current of a DC motor and input signals for control logic and running and breaking modes.
In the end, article explains discontinuous and continuous DC motor current mode. Tutorial describes advantages of continuous when compared to the discontinuous mode.

# What is an H-bridge?

An H-bridge consists of four switches (T1, T2, T3, and T4). See image 1. for the details. Image 1. Basic H-bridge electric schematic

Switches are usually MOSFETs, BJTs, IGBTs or similar semiconductor electronic parts.

# Basic principle of Sign-Magnitude control of a H-bridge Image 2. Sign-Magnitude control of a H-bridge

This section describes the Sign-Magnitude control of the output MOSFETs of an H-bridge. Control logic generates signals for turn on and turn off four MOSFETs (T1, T2, T3 and T4). See Image 2 for the details. Control logic is controlled by input signals PWM and Direction.

## PWM, Direction, Current and voltage waveforms of a DC motor during Sign-Magnitude control Image 3. Current and voltage waveforms of a DC motor during Sign-Magnitude control

Image 3 shows the waveform of the electric potential at points VoA and VoB, DC motor voltage (VoA-VoB) and motor current. Image also shows how motor voltage and current depends of input signals PWM and direction.

## Current equation of a DC motor with minimum and maximum values

During rotation of a DC motor shaft in one direction (for example Direction signal is high “1”) current flows from VoA to VoB. Upper MOSET T1 is always ON and VoA = Vcc. PWM signal is connected to the gate of MOSFET T4. In this case, average voltage on DC motor is controlled by T4. When T1 and T4 are turned ON, the equivalent electric circuit consist of resistor, inductor and electromotive force (emf) in series. See image 4b. The inductance of the motor does not allow the current to change instantly. The current can only rise exponentially. In static state, maximum and minimum of the current can be calculated with equations (1). Where are:
Rm – armature resistant,
τ – time constant τ = L/RM
a – duty cycle
T – period of time PWM-a
Vcc – battery power supply

## Equivalent electric schematic during charging of a motor inductance

While transistors T1 and T4 are turned on, the motor current rises. If the duty cycle is one (100%), one motor terminal is connected to Vcc and the other is connected to the GND (Ground). See image 4 for the details. The current will be constant and equal to the value (Vcc – E) / (Rm+2xRds(ON)). Rds (ON) is on state resistance (source to drain resistance) of MOSFETs T1 and T4. Images 4a and 4b. Equivalent electric schematic during charging of inductance

## Equivalent electric schematic during motor braking Images 5c and 5d. Equivalent electric schematic during a DC motor braking

When a PWM becomes inactive (logic “0”), the MOSFET T4 is switched off and the motor goes into braking mode. Because of the motor inductance the current value does not change. After the T4 is switched off, the current flows through diode D3. See images 5c and 5d. The terminals of the motor are short-circuited. It means that the current of the motor is only the consequence of the electromotive force. According to formula (1), when motor power supply is switched off, the electromotive force and the armature current will decrease exponentially.

# Basic principle of Locked Anti-Phase control of the H-bridge Image 6. Locked Anti-Phase control of a DC motor

If a DC motor drive is using Locked Anti-Phase control, only one input signal is necessary. This is PWM signal. See image 6 for the details. PWM signal from a motor controller should be connected to the signal Direction of a control logic circuit. The signal PWM of the control logic should be connected to logic high or power supply (Vcc) like in our case. PWM signal from controller carries information about a DC motor speed and direction.
Control logic generates signals for turn on and turn off four MOSFETs (T1, T2, T3 and T4).

## PWM, current and voltage waveforms  during Locked Anti-Phase control

Image 7 shows the waveform of the electric potential at points VoA and VoB, DC motor voltage (VoA-VoB) and motor current. Here you can see how motor voltage and current depends of input signal PWM. Image 7. Locked Anti-Phase control of a DC motor

In the period when the PWM is active (PWM = 1), the MOSFETs T1 and T4 are switched on and T2 and T3 are switched off. The voltage on the motor VoA – VoB = Vcc (VoA = Vcc and VoB = GND). When the PWM signal goes into the inactive state logic “0” (PWM = 0), then the MOSFETs T1 and T4 are switched off, and T2 and T3 are switched on. The voltage on the DC motor is VoA – VoB = -Vcc (VoA = GND and VoB = Vcc).
If the duty cycle of the PWM signal is 0.5 (50%) logic high and low are equal length. In this case the shaft of the motor is stopped. At the same period of the time the Vcc and -Vcc voltage is supplied to the terminals of the motor. The mean value of the motor voltage is zero.
When the duty cycle increases from 0.5 to 1, the motor speed rises from zero to the maximum in one direction. When the duty cycle decreases from 0.5 to 0, the motor speed rises from zero to maximum in the opposite direction.

## The equations for the maximum and minimum of a DC motor current

In the case of a Locked Anti-Phase control, the motor current is rising or falling according to the same exponential law as in a Sign-Magnitude control. The maximum and minimum of the current can be calculated with equations (1).

# Continuous and Discontinuous DC motor current mode

## Discontinuous DC motor current mode Image 8. Waveforms of a PWM, motor voltage (VoA-VoB) and current in discontinuous current mode

In the absence of PWM signal, the final value of the motor current would be zero. If the terminals of the motor remain at the same potential, the motor is in a “stiff” state. If the motor current drops to zero before the MOSFET T4 is turning on again, the motor operates in the discontinuous current mode. Waveform of PWM, motor voltage (VoA-VoB) and current in a discontinuous current mode are presented on Image 8.

## Continuous DC motor current mode

If the motor current does not reach the zero value before the MOSFET T4 is switched on again, it operates in the current continuous mode. Waveforms of PWM, motor voltage and current in the continuous current mode are plotted on Image 9. Image 9. Waveforms of PWM, motor voltage (VoA-VoB) and current in discontinuous current mode

However, the current will decrease until the moment when PWM becomes active again. At this moment, the minimum current is reached according to equations (1) from our tutorial “Sign-Magnitude control of a DC motor”.
When the motor is operating in a discontinuous mode, the peaks of motor current are higher than when the motor is running in a continuous mode. If the motor current is not continuous then torque and speed are also not continuous. For better operation, DC motor torque should be constant. It is possible to decrease current peaks with increasing PWM frequency. In this case, the value of current also increases and decreases, but since the period is smaller, the fluctuation of the current will be lower. The current waveform depends of armature inductance. If it is higher, the peaks are lower. Another way is to add an additional inductance in series with armature inductance to the motor. This experiment was performed with an additional inductance of 150mH and the current shape was better. Calculations require an inductance of at least 500mH in order to improve the shape of the motor current.

## Waveforms of measured MAXON RE35 DC motor current

In this example H-bridge drives runs RE35 DC Motor with permanent magnet designed by MAXON.

### The measured current of the motor during acceleration without load

The measured current of the motor during acceleration without load is shown on Image 9. Image 9. The measured current of the motor during acceleration without load, 200mV/div, 500uS/div

Images shows that the motor runs in a discontinuous mode. For measurement oscilloscope DSO 3062A by Agilent Technologies (Keysight Technologies) was used. Measuring is performed on the resistor 0R1 at a PWM frequency of 1 kHz. Image 1 from tutorial DC motors – driver for motion of an autonomous robot shows the resistor 0R1. Maximum values can be quite large. At nominal load of the RE 35 motor, the current is about 4A. However, the maximum value of the current may exceed 15A. In image 7, the maximum current value is about 5A.

### The measured current of the motor during maximum speed without load

The measured current of the MAXON RE35 motor during max speed without load is shown on Image 10. Image 10. The measured current of the motor during acceleration without load, 200mV/div, 500uS/div

# Advantages of an H-bridge control using Raspberry Pi, MikroElektronika, Arduino and similar platforms.

As you could see in the previous chapter, low PWM frequency (such as 1kHz) for an H-bridge control can cause discontinuous current mode.  As discontinuous electric current mode has its disadvantages, solution is using platforms such as Raspberry Pi, Arduino, MikroElektronika Hardware and Software Embedded Tools, etc. which can produce PWM frequency higher than 1kHz. DC motor driver can work with lower electric current peaks and constant motor torque.

This DC motor driver was used for moving an autonomous robot for EUROBOT competition. For more details about the robot motor driver visit our tutorial “DC motors – driver for motion of an autonomous robot”.

More details about the DC motor we presented in our tutorials: DC motors – Basic characteristics and mathematical model and DC Motors – current, voltage, speed, power, losses and torque relationships.