The Full-Bridge (H-Bridge) is one of the most widely used driver circuits for controlling brushed DC motors. The key benefit of a full-bridge driver is its ability to reverse the motor’s direction of rotation without the need to manually switch the supply wires. While I have previously shared Half-Bridge and H-Bridge driver circuits, I received numerous requests for a standalone H-Bridge motor driver that could operate without relying on an external controller or board.
To address this demand, I have developed an affordable, compact, and standalone H-Bridge DC motor driver that can be integrated into a wide range of mechatronic systems. The entire system is controlled by an inexpensive ATTiny13 microcontroller, and the code is written using the Arduino IDE. All components, except for the connectors, are SMD (Surface-Mounted Devices).
This driver allows motor control in three modes: Forward, Stop, and Reverse. Users can adjust the motor’s speed in both forward and reverse directions independently using two panel-mounted potentiometers. The low ON-resistance of the MOSFETs enables the driver to handle higher currents.
For the schematic and PCB design, I used Altium Designer 22, and the Octopart search engine helped me quickly gather component data and generate the BOM (Bill of Materials). I sent the Gerber files to WellCircuits for high-quality PCB fabrication. To test the driver, I repurposed the motor from a toy car, utilizing its powerful 775 DC motor along with its gearbox.
It’s a rewarding experience to build this circuit—try it yourself and enjoy the process!
Specifications
- Input Voltage (Motor): 8-40VDC
- Supply Voltage (Controller): 12VDC
- PWM Frequency: 25KHz
- Motor Control: Forward-Stop-Reverse
- Motor Speed: [0 to 100%] Forward, [0 to 100%] Reverse
To order a fully assembled PCB board (free shipping), please contact: info@wellcircuits.com
A. Circuit Analysis
Figure 1 shows the schematic diagram of the standalone full-bridge DC motor driver. The circuit is divided into three main sections: the H-Bridge driver, the microcontroller, and the supply regulator.
Figure 1
Schematic diagram of the standalone full-bridge DC motor driver (Altium)
A-1. Microcontroller
IC1 is the ATTiny13 microcontroller [1], which controls the H-Bridge section of the circuit. C1 and C2 are decoupling capacitors that filter out noise from the power supply. R1 is a pull-up resistor for the RESET pin. ISP provides the in-circuit programming interface for IC1, while P1 and P2 are 3-pin XH connectors for the potentiometers. These potentiometers are connected to the ADC pins of the microcontroller and are used to adjust the motor’s forward/reverse speed. P3 and P4 are also 3-pin XH connectors to interface with a 3-position, 6-pin SPDT switch that controls the motor’s Forward-Stop-Reverse state. Figure 2 shows the switch I used, part number KCD4-604-6P. You may opt for a similar switch, but I particularly like this one due to its ergonomic handle.
Figure 2
The selected 3-position, 6-pin SPDT switch, KCD4-604-6P (Forward-Stop-Reverse)
A-2. Supply Regulator
REG1 is the 78L05 (SOT-89) regulator chip [2], which forms the core of the supply regulator. P5 is a 2-pin XH connector for the 12V input. R4 and C6 form a low-pass RC filter to minimize supply noise. D1 is an SMD blue LED that indicates proper supply connection, with R5 limiting the current to the LED. C7 and C8 further help reduce output noise.
A-3. H-Bridge (Full-Bridge) Driver
Q1 to Q4 are high-power D2Pack IRF3205 MOSFETs [3] that make up the H-Bridge circuit. Diodes D4 to D7 provide additional protection against reverse inductive currents from the motor. While not strictly necessary, it is recommended to include these diodes for added safety. R6, R7, R8, and R10 are current-limiting resistors for the gate pins. IC2 and IC3 are IR2104 [4] half-bridge driver ICs. C12 and C13 are decoupling capacitors, and R9 and R11 are pull-down resistors to prevent unwanted triggering of the IN pins of the driver ICs. C9 helps reduce supply noise from the motor, particularly during startup.
B. PCB Layout
Figure 3 shows the PCB layout of the device. It is a two-layer PCB, and all components are SMD, except for the connectors. This design makes the board compact and easy to integrate into various enclosures. Figure 4 shows the assembly drawings of the PCB.
Figure 3
PCB layout of the Standalone Full Bridge DC Motor Driver (Altium)
Figure 4
Assembly drawings of the PCB board
C. Code
The code was written using the Arduino IDE and the MicroCore hardware package [5] for ATTiny13. You will need to install this package to compile the code for the ATTiny13. For your convenience, I have also provided the compiled HEX file [6]. You will need an AVR ISP programmer (e.g., USBasp) to burn the HEX file onto the ATTiny13. The fuse bits must be set for a 9.6 MHz internal clock with no clock division (division = 1). Figure 5 shows the ISP programming pinout.
#include <util/delay.h>
// Clock at 9.6MHz
#define F_CPU 9600000
const int PWMPin = 1;
analog_pin_t FVOLPin = A3;
analog_pin_t RVOLPin = A