Learn how to use the BC547 NPN transistor as a switch. In this post we’ll go over how to use the BC547 transistor to switch a bright LED Flash on and off. We will first switch the BC547 using a push button, and then will transition to test with an Arduino.
The BC547 is an NPN bipolar junction transistor (BJT). BJTs can be used to amplify analog signals, but they can be used as switches as well. Here we’ll show how to use as a switch.
The example to show this will be based on lighting a bright LED that will need a voltage and current larger than what an Arduino UNO IO pin can supply. Transistors operating as switches work by allowing a large current to flow through the collector when a small current flows through the base. In this example the LED operates between 9V – 14.8V at a current of 15mA, which is above the voltage and current of the Arduino UNO (see below).


LED Specs:
Voltage: 9V – 14.8V
Current when lit: 15mA

Arduino UNO Specs:
I/O Pins Voltage: 5V
Current per I/O Pin: 20mA

BC547 Standalone application
Before jumping to wiring the transistor to an Arduino, let’s try it on a standalone application where we activate the transistor with a push button. The circuit and beard board diagram below show how we’ll setup our circuit.
In this example, the current ib represents the current that will be pulled from the Arduino UNO, while ic will be the current pulled from a separate power source. For this specific example, a 4.7kohm is being recommended and we’ll use a standard 12V voltage source to power the LED. Before doing some math to show why we are using that resistor, let’s check some specific specs of the 2N2222 transistor.
*Note that the LED flash used in this example is a ready-to-use component with a built-in resistor, which is why a separate resistor is not needed.
BC547 Transistor Specs
Minimum current gain = 110
*The gain factor (also known as Beta) is the factor by which ib will be amplified.
*Note that Beta = ic/ib.
Min Saturation voltage VBE = 0.7V
Max Saturation voltage VCE = 0.6V
Now let’s do some math!
Let’s first assess the voltage drop from 12V to GND, and determine the minimum LED voltage we should expect based on the maximum expected voltage between the collector and the emitter (VCE ).
Let’s first assess the voltage drop from 12V to GND, and determine the minimum LED voltage we should expect based on the maximum expected voltage between the collector and the emitter (VCE ).

After solving for VLED_Min, we saw that the result was within the bounds of the LED operating voltage (9V – 14.8V), so we are good. Now, let’s assess the voltage drop from 5V to GND, and determine the value of the current ib.

We can see that the current ib is less than the maximum that the Arduino I/O pins can support, which is good. Now, let’s confirm the minimum current that we will be able to flow through the resistor based on the minimum current gain (remember this was 35 from the transistor specs).

The value above is higher than the current stated in the LED specs (15mA), this means that even at the lowest transistor current gain, we can still pull the required current to light up the LED.
BC547 Testing
Now, let’s actually test this and setup a multimeter to compare the calculated values to actual values.
Base Current
Measured value: 0.89mA
Expected value: 0.915mA
*Close enough
Collector Current
Measured value: 19.4mA
Expected value: 15mA
*Still acceptable. LED is pulling what it needs (LED spec sheet might not be super accurate).


Integrating the BC547 to the Arduino UNO

Arduino Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
//Arduino Code - BC547 int Button = 2; //GPIO 2 --- Digital Input coming from button int LED = 6; //GPIO 6 --- Digital Output to Transistor int Button_State = 0; //Variable to handle the push button state void setup() { // put your setup code here, to run once: pinMode(Button, INPUT); //Step pin as input pinMode(LED, OUTPUT); //Step pin as output } void loop() { // put your main code here, to run repeatedly: Button_State=digitalRead(Button); if (Button_State == 1){ digitalWrite(LED, HIGH); } else{ digitalWrite(LED, LOW); } } |
Testing BC547 with Arduino

Components used in this example
*As an Amazon & Ebay Associate I earn from qualifying purchases.
Component | Link | Comments |
Arduino UNO | https://amzn.to/3uYVAMC https://ebay.us/veZdKX | |
Hilitchi Transistors Assortment Kit | https://amzn.to/3gf2nOl https://ebay.us/8BLbQA | Includes BC547 transistor |
Electronic Component Kit | https://amzn.to/3gj4r7O https://ebay.us/AdnfMw | Includes 4.7kOhm resistor, push button, and jumper wires |
Amprobe AM-510 Multimeter | https://amzn.to/32mV4Mf https://ebay.us/uwo7sC | |
Amprobe TL35B Test Leads with Alligator Clips | https://amzn.to/3dp5m4M https://ebay.us/OM4r4B | |
Breadboard (Elenco 9440) | https://amzn.to/3x23dnq https://ebay.us/FcwSdb |