raw electronics

Introduction to the TIP120 Transistor

The TIP120 is an NPN Darlington transistor commonly used for controlling high-power devices such as motors, lights, or solenoids with microcontrollers like ESP32 or Arduino. It bridges the gap between the low-power output of an Arduino and the high-power requirements of these devices, acting as a switch that is controlled by the Arduino.

How the TIP120 Transistor Works

The TIP120 transistor features three main pins:

Note: The TIP120 is controlled by current, not voltage. This means the amount of current flowing into the Base pin determines whether the transistor switches on or off, allowing current to flow between the Collector and Emitter.

The TIP120 can handle up to 60V and 5A (with brief pulses up to 8A). If you're using the TIP120 for loads near its maximum ratings, consider adding a heat sink to dissipate heat or search for high power alternatives to TIP120. Note that the back of the TIP120 is connected to the Base pin, so if you use multiple transistors, they must not share one heat sink.

Example: Controlling a Motor with Arduino

Let’s use the TIP120 to control a motor, showcasing how you can use Arduino to manage high-power devices.

Required Components

TIP120 Circuit Setup

Motor driver using TIP120 and Arduino

  1. Connect the TIP120:

    • Base (B): Connect to Arduino PWM pin 11 through a 1K resistor.
    • Collector (C): Connect to the negative terminal of the motor.
    • Emitter (E): Connect to ground.
  2. Add the Diode:

    • 1N4004 Diode: Place across the motor terminals, with the cathode (marked with a stripe) facing the positive terminal. This prevents reverse voltage spikes from damaging the transistor.

    [Insert a close-up photo of the diode placement with an arrow showing the correct orientation]

  3. Power the motor:

    • Connect the positive terminal of the motor to the positive terminal of the 12V power supply.
  4. Connect Arduino:

    • Connect Arduino ground (GND) to the Emitter pin of the TIP120 and the ground of the power supply.

Arduino Code for Motor Control

Here’s the code that smoothly runs the motor up and down, demonstrating PWM control:

uint8_t pin = 11; // PWM pin connected to the Base of TIP120
int16_t speed = 0;
int16_t accel = 5;

void setup() {
  pinMode(pin, OUTPUT); // Set the pin as output
}

void loop() {
    analogWrite(pin, speed);
    delay(30);
    speed+= accel;
    
    if (speed >= 255) {
        accel = -accel;
        brightness = 255;
    } else if (speed <= 0) {
      accel = -accel;
      brightness = 0;
    }
}

This code smoothly increases and decreases the speed of the motor, demonstrating the control PWM gives over high-power devices.

Key Considerations for Using the TIP120

Note: Ensure the diode’s stripe (cathode) is facing the positive terminal of the load. Incorrect placement will prevent the load from operating correctly.