A transistor is an electronic gate, which allows current to flow through it given the correct input. Transistors are needed to help power electronic components which need more than the 5 volts from the Arduino, by acting as a switch. (They can also be used to amplify voltage or current, but this article will talk about the switch function.) There are two types of transistors, NPN and PNP, which accomplish the same goal, but through different methods.


A transistor has 3 leads: a collector, a base, and an emitter. With an

NPN: , the current flows from the collector through the base to the emitter, if there is sufficient voltage being put sent into the base. With a

PNP, it is the opposite – voltagecurrent flows from the emitterthrough the base to the to the collector, if there is no voltage being put sent into the base.(the opposite of PNP) 



For more information about the difference between the two, check out this link: difference between NPN and PNP transistor


Transistors can be used in countless ways. A few examples are including alarms, and speakers, motors, solenoids, and high-power light components.

For our AntiTheft bike, we used a transistor in our alarm circuit. This allowed us to send apply 18V into to the alarm and to produce a louder siren.




Transistors are generally available from the Inc’s supply, but, if you want to purchase them online, they are very cheap – only about 50 cents each. Here are some purchase links:




Specialty transistors are available for specific uses. For example, here is a NPN transistor, which works especially well with audio –


We decided to use a transistor because the alarm wasn’t loud enough when it was only powered by the Arduino. We used an NPN in our circuit.




  1. Finding a transistor

This is actually one of the hardest parts of the process, as transistors are not labeled NPN or PNP. They only have a number/code on the back. You can Google this code and hopefully will be directed to a supplier’s site, which will tell you what type of transistor it is.



2. Identifying your leads

The base is almost always the middle lead, with the collector and emitter being the two outside leads. You can “guess” which lead is which and troubleshoot from there. However, to avoid issues later, it is best to test them with a multimeter to make sure. Here are some useful tutorials:



3. Building the transistor circuit

Once you have your leads identified, you can now build your circuit

NPN Connect the base to a digital pin on the Arduino.

Connect the battery to the power wire of your component (motor, alarm, etc.). Connect the ground wire of your component to the collector of the transistor. Ground both the emitter and the battery into the Arduino (via the breadboard).


PNP Connect the base to a digital pin on the Arduino.

Connect the battery to the emitter and the power wire of your component to the collector.

Ground both the battery and the ground wire of your component into the Arduino (via the breadboard).





If your transistor circuit is not functioning, here are some troubleshooting tips:

-Make sure you are using the right transistor for your circuit

-Make sure you have correctly identified the base, collector, and emitter leads

-(If you are powering the Arduino using a battery and not a computer…) make sure you are not powering the Arduino with more than 5V. If you are, extra voltage can “leak” out of the Arduino through the pins, and mess up your circuit.