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:
- Base (B): Connect this pin to one of Arduino’s PWM pins through a current-limiting resistor. The current flowing into this pin determines whether the transistor switches on or off.
- Collector (C): Connect this pin to the negative terminal of the high-power device.
- Emitter (E): Connect this pin to ground.
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
- Arduino board
- TIP120 Transistor
- 1N4004 Diode - To protect the circuit from reverse voltage.
- 1K Resistor - To limit current to the Base pin.
- DC Motor
- 5-60V Power Supply (according to your motor)
TIP120 Circuit Setup
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.
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]
Power the motor:
- Connect the positive terminal of the motor to the positive terminal of the 12V power supply.
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
- Diode Placement: The 1N4004 diode is crucial in circuits with inductive loads like motors or solenoids. These devices generate a reverse voltage spike when turned off, which can damage the transistor. The diode, placed in parallel to the load, allows this reverse current to safely dissipate instead of flowing back into the transistor.
Note: Ensure the diode’s stripe (cathode) is facing the positive terminal of the load. Incorrect placement will prevent the load from operating correctly.
Heat Management: When switching high currents, the TIP120 can generate significant heat. To avoid overheating, use a heat sink.
Limitations of the TIP120:
- DC Only: The TIP120 is suitable for controlling DC devices. It should not be used for AC circuits.
- Current and Voltage Limits: The transistor is limited to 60V and 5A. For applications that require switching higher currents or voltages, or for AC loads, consider using a relay instead.
- PWM Control: The TIP120 works well with Arduino’s PWM outputs, allowing you to control the speed of motors, the brightness of lights, and other variables by rapidly switching the transistor on and off.