Transistor Lesson

, ,

Use a transistor to control a larger current or voltage than the Arduino can handle.  Use the Arduino to control the transistor, and the transistor to control the load.

Choose the power supply voltage to match the voltage needed by the external load.

Choose the power supply current capacity to be greater than the current needed by the external load.

Use a PN2222 transistor for loads that take 5V to 30V, for currents up to 0.5A = 500mA.

(Image from Paul Stamatiou’s Raspberry Pi intro)

 

Use a TIP120 transistor for loads that take 5V to 60V (be careful with voltages above 24V!), for currents up to 5A.

Image from Martyn Currey: Control a Solenoid Valve with an Arduino, although, a transistor is better than a switch because it can be partway on, like a faucet.

 

Connect an LED and resistor on the breadboard.

(I changed the resistor value for the lesson, so the color stripes won’t match exactly. The resistor in the photos is 150Ω, the resistor for the lesson is 1000Ω, which is also written 1kΩ. I made that change to make the circuit simpler (two identical resistors can’t be confused), and to keep the LED from being destroyed by 12V)

Test the LED with the power supply connected as shown. If the LED doesn’t light up, try putting it in the other way around: pull it out of the breadboard, rotate it 180º, plug it back in.

Add the PN2222 transistor.

Test the circuit. Use the blue wire to connect the base bias resistor to the positive power supply, and the LED should light up. (Connect the blue wire to ground and the light should stop.)

The circuit above is good for loads up to 0.5A = 500mA. For higher current circuits, use a TIP120 to control them. The TIP120 can control up to 5A of current. Connect as below.

Test the circuit. Use the blue wire to connect the base bias resistor to the positive power supply, and the LED should light up. (Connect the blue wire to ground and the light should stop.)

To control the transistor with the Arduino, connect an additional green or black wire from the breadboard ground to the Arduino ground. Then connect the blue wire to one of the Arduino outputs.

Better blink (uses pin 7, will work with any pin): better_blink.ino

Fade (uses pin 6, will work with any pin with a ~ marker): pseudo_analog_ramp.ino

Skills

Posted on

2018-02-18

Submit a Comment