Microcontroller based Diode and Bipolar Junction Transistor (BJT) tester using PIC16F688


Most of the digital multimeters these days have built-in features for testing diodes and sometimes transistors. The purpose of this project is to demonstrate a simple way to construct a testing device for diodes and bipolar junction transitors (BJTs) using a microcontroller. The testing algorithm is based on a simple fact that a working PN junction conducts current in only one direction. A PIC16F688 microcontroller is used in this project that switches the bias voltage across the PN junctions of diode and transistors, and determines if a particular junction is normal, open or short.

PIC16F688 Diode Tester


The logic behind testing a diode is straightforward. A diode is a PN junction that allows the conduction of current only in one direction. Therefore, a good diode will conduct current in only one direction. If it does in both the directions, it means the diode is short, and if it does in neither direction, it is open. The circuit implementation of this logic is shown below.

This concept can be easily extended to test a transistor by realizing that a transistor consists of two PN junctions: one betwen the base and the emitter (BE junction), and the another between the base and the collector (BC junction). If both the junctions conduct in only one direction, the transistor is normal, otherwise it is faulty. We can also identify the type (PNP or NPN) of the transistor by considering the direction of the current conduction. Three I/O pins of a microcontroller are required to implement the testing algorithm for a transistor.

The test sequence for a transistor would go like this.

  1. Set D2 High and read D1 and D3. If D1 is High, BE junction conducts, otherwise not. If D3 is High, BC junction conducts, otherwise not.
  2. Set D1 High and read D2. If D2 is High, EB junction conducts, otherwise not.
  3. Set D3 High and read D2. If D2 is High, CB junction conducts, otherwise not.

Now, if only the BE and BC junctions conduct, the transistor is of NPN type and is working fine. And, if only the EB and CB junctions conduct, the transistor is still normal but the transistor type is PNP. All other cases (like EB and BE both conduct, or BC and CB both not conducting, etc.) indicate the transistor is not good.

Circuit Diagram and Description

The circuit diagram for this project is pretty simple. It has two push button switches for inputs, named Select and Detail. Pressing the Select button allows to choose between the diode and transistor testings, and the Detail button is active only in case of transistor testing and displays the details of the test results like the transistor type and both the junction status. The three legs of a test transistor (E, B, and C) are grounded through 1 K resistors, and the two PN junctions will be tested through RA0, RA1, and RA2 port pins of a PIC16F688 microcontroller. The testing of a diode requires only two pins, and will use the E and C pins. That’s why they have alternate labels, D1 and D2, in the circuit diagram.


For more detail: Microcontroller based Diode and Bipolar Junction Transistor (BJT) tester using PIC16F688

Current Project / Post can also be found using:

  • b566a transistor PIC
  • mikrokontroller com/tranzistor

Leave a Comment

= 3 + 8

Read previous post:
temperature sensor
A Digital temperature meter using an LM35 temperature sensor using PIC16F688

Introduction A digital thermometer is a good choice of project for beginners who just stepped in to the world of...

Scroll to top