H-Bridge 1: Building an H-bridge motor driver on a breadboard using TIP120 and TIP125 Darlington transistors

H-Bridge 1: Building an H-bridge motor driver on a breadboard using TIP120 and TIP125 Darlington transistors

This tutorial will guide you through building an H-bridge motor driver using TIP120 and TIP125 Darlington transistors on a breadboard. This setup is ideal for controlling the direction and speed of a DC motor, which is essential for various robotics and automation projects. By the end of this tutorial, you will be able to control a motor with both clockwise and counter-clockwise rotations, along with speed modulation.

In this guide, we will utilize an Arduino for controlling the motor. The H-bridge configuration allows for reversing the motor's direction by controlling the input signals sent to the transistors. This is a crucial aspect for many applications, such as robotic arms or mobile robots that require precise motor control. For further clarification, please refer to the video (in video at 00:00).

Hardware Explained

The main components of this project include TIP120 and TIP125 transistors, which are used as switches to control the motor's operation. The TIP120 is a NPN Darlington transistor, and the TIP125 is a PNP Darlington transistor. Together, they form the H-bridge configuration, allowing us to control the direction of the current flowing through the motor.

In this setup, the PWM (Pulse Width Modulation) signal is used to control the speed of the motor. The transistors switch on and off rapidly to create an average voltage that determines the motor speed. The EN pins enable or disable the transistors, ensuring the motor operates only when required.

Datasheet Details

Manufacturer Texas Instruments
Part number TIP120
Logic/IO voltage 5–15 V
Supply voltage 60 V
Output current (per channel) 5 A
Peak current (per channel) 30 A
PWM frequency guidance 1 kHz max
Input logic thresholds 2.5 V (high), 0.8 V (low)
Voltage drop / RDS(on) / saturation 1.2 V
Thermal limits 175 °C
Package TO-220
Notes / variants Available as TIP125

 

  • Ensure proper heat sinking for high current applications.
  • Use PWM signals to control motor speed effectively.
  • Verify transistor orientation to prevent circuit damage.
  • Pay attention to voltage ratings to avoid exceeding limits.
  • Use decoupling capacitors to stabilize voltage supply.

Wiring Instructions

555 Relay Timer of 20A 0-10 minutest on breadboard wiring
555 Relay Timer of 20A 0-10 minutest on breadboard wiring

To wire the H-bridge motor driver, first connect the VCC pin from the TIP120 and TIP125 to the 5V supply on your Arduino. Connect the GND pin to the ground. The PWM control pins, PWM1 and PWM2, should be connected to digital pins 9 and 3 on the Arduino, respectively. The enable pins, EN1 and EN2, will connect to digital pins 8 and 2.

Next, connect your motor's terminals to the collector pins of the TIP120 and TIP125 transistors. Ensure that the motor is compatible with your power supply. If using additional components such as diodes for flyback protection, place them in parallel with the motor terminals to prevent damage from back EMF. If you are using different Arduino models, verify the pin mappings for PWM and enable signals.

Code Examples & Walkthrough

const int PWM1= 9; //pin with ~
const int EN1= 8;
const int PWM2= 3; //pin with ~
const int EN2= 2;

In the setup, we define the control pins for the PWM signals and enable pins. The pinMode function sets these pins as output to control the transistors that drive the motor.

void loop() {
  Motor(CW, 50); //in CW at 50% speed
  delay(5000);
  stop(); // stops the motor
  delay(2000);
}

This loop function demonstrates the operation of the motor. It first runs the motor in a clockwise direction at 50% speed for 5 seconds, then stops for 2 seconds. The Motor function is called with direction and speed parameters, controlling the behavior of the motor based on those inputs.

void Motor(boolean direction, int speed=0) {
  int speedPWM = map(speed, 0, 100, 0, 255);
  if(direction) {
    analogWrite(PWM1, speedPWM); // Set speed for CW
  } else {
    analogWrite(PWM2, speedPWM); // Set speed for CCW
  }
}

The Motor function takes a boolean direction and an integer speed. It maps the speed percentage to a PWM value and uses analogWrite to set the appropriate pin for motor control. This function is crucial for altering motor direction and speed dynamically.

Demonstration / What to Expect

Upon completion of the wiring and uploading the code, you should observe the motor rotating clockwise at 50% speed for 5 seconds, followed by a stop. After a delay, it will rotate counter-clockwise at 80% speed for another 5 seconds. Common pitfalls include incorrect wiring and exceeding voltage ratings, which can damage the transistors or motor.

Video Timestamps

  • 00:00 - Introduction
  • 01:30 - Hardware Overview
  • 03:15 - Wiring Instructions
  • 05:00 - Code Walkthrough
  • 08:45 - Demonstration

Images

H-Bridge Project with TIP120 TIP125 Wiring diagram
H-Bridge Project with TIP120 TIP125 Wiring diagram
Schematic for TIP120, TIP125 H-bridge
schematic for TIP120 TIP125 H-Bridge
H-Bridge Project with TIP120 TIP125 3
H-Bridge Project with TIP120 TIP125 3
555 Relay Timer of 20A 0-10 minutest on breadboard wiring
555 Relay Timer of 20A 0-10 minutest on breadboard wiring
371-Arduino code for H-Bridge Project with TIP120/TIP125 Transistors
Language: C++
Copied!

Files📁

Other files