20

This practical instrument can be used to measure and record the characteristic curves of NPN and PNP bipolar transistors, N- and P-channel JFETs, and N- and P-channel MOSFETs. The circuit is based on an R8C/13 microcontroller, which transfers the measurement data to a Windows application program via USB.

This practical instrument can be used to measure and record the characteristic curves of NPN and PNP bipolar transistors, N- and P-channel JFETs, and N- and P-channel MOSFETs. The circuit is based on an R8C/13 microcontroller, which transfers the measurement data to a Windows application program via USB.

 
 
 
By Rainer Schuster

Operating principle
The operating principle of curve tracers has not changed much since the first article appeared in Elektor. The basic idea is to generate a time-dependent collector current by combining a ramp-shaped collector–emitter voltage with a base current that is increased either in discrete steps or continuously. The collector voltage is plotted on the X axis, and the collector current is plotted on the Y axis.

Control module
The curve tracer described here is built around an R8C/13 microcontroller, which is linked to a USB to serial converter (type PL2303). It does not require much comment, since the circuitry of the R8C/13 section was described earlier in the February 2006 issue and the USB controller is wired as described in the March 2006 issue. All of this is fitted on a PCB measuring only 80 x 35 mm.
Power is supplied via the USB port. Various I/O port pins, +V and ground are fed out to a 20-way socket header so the microcontroller module can also be used for other tasks.
The microcontroller can be reset whenever desired by means of Reset pushbutton S1. A set of eighteen 470-Ω resistors limit the output currents of the I/O pins to approximately 10 mA in order to protect the board against the potentially fatal consequences of a connection error.
When jumper JP1 is fitted, program code can be downloaded into the microcontroller via the USB port. One way to do this is to use the Renesas Flash Development Toolkit. The previously mentioned Elektor articles and the R8C topic on the Elektor forum provide adequate information about generating the software, downloading the hex file to the microcontroller, and installing the USB driver on the PC.

Circuit description

Generating the base current or gate–source voltage
Timer Y is operated in PWM mode to drive the base or gate of the transistor under test (TUT). See the description of the firmware for more details. The pulse rate is 2 kHz, and the pulse width can be set over a range of 0 to 100%. A Butterworth low-pass filter built around IC5a converts this signal into a variable DC voltage, which is amplified by a factor of 2 in IC5b to provide a voltage at the output of IC5b with an adjustment range of 0 to +10 V. The linearity of the output voltage can be seen clearly in the oscilloscope images.
The output voltage is inverted by IC8a to generate the base current for PNP transistors or the gate voltage for P-channel MOSFETs and N-channel JFETs. Switches S1 and S2 (IN1 and IN2) of analogue switch IC7 connect either a positive voltage or a negative voltage to the base or the gate of the TUT (see the firmware description for the associated truth table).
Switches S3 and S4 (IN3 and IN4) of IC7 are used to select the desired current range (0–10 µA, 0–100 µA, or 0–1 mA). The 0–1 mA range is always used with the ‘FET’ setting to set the gate voltage.

Generating the collector-emitter or drain–source voltage
Timer Z of the R8C/13 is also operated in PWM mode with a fixed pulse rate of 2 kHz. A Butterworth low-pass filter built around IC6 converts the pulse width into an analogue voltage and amplifies the voltage by a factor of 2 to again provide an output voltage with a range of 0 to +10 V. The voltage is inverted by IC8b to generate the collector–emitter voltage for PNP transistors or the drain–source voltage for P-channel MOSFETs and P-channel JFETs. Switching between positive and negative voltages is provided by analogue switch IC9. The current gain is provided by IC10 in combination with a transistor output stage formed by T1–T4. Resistors R34 and R35 limit the output current to approximately +/- 0.5 A.

Measuring the characteristics
The configured base current is not measured, but instead calculated by the software from the configured base–emitter voltage and the selected base current range.
In order to measure the configured collector–emitter voltage, it is first rectified by IC11 because it can be either positive or negative. After being divided by a factor of 2 by R42/R43, the rectified voltage is fed to the microcontroller A/D converter input AD0. The measurement range of 0 to +/- 10 V for the collector–emitter voltage thus corresponds to a range of 0–5 V at the A/D converter input. Diode D5 prevents the A/D input voltage from rising above 5 V in the event of a fault and protects the input from negative voltages.
The collector or drain current flows through R49 and generates a positive voltage at the output of IC12b. The output voltage ratio is 1 mV/mA. IC13 amplifies the voltage by a factor of 10 to yield a ratio of 10 mV/mA at the A/D converter input (AD1). The voltage and the A/D input is 4 V at the maximum collector or drain current of 400 mA. Here again, diode D8 prevents the A/D input voltage from rising above 5 V in the event of a fault and protects the input from negative voltages.

Power supply
The curve tracer is powered by an on-board PCB-mount transformer with two secondary windings, each rated at 15 V / 0.5 A. The rectified DC voltages of approximately +/-20 V are fed to IC2 and IC3, which produce regulated voltages of +/-15 V to power all of the analogue circuitry with the exception of the output stages. LEDs D10 and D11 indicate the presence of the supply voltages.
The +/-12 V supply voltages for the output stages are provided by IC1 and IC4, which require heat sinks. Here LEDs D9 and D12 indicate the presence of the supply voltages.

R8C firmware
The microcontroller firmware was written in C using the Renesas High-performance Embedded Workshop. The details of the development environment fall outside the scope of this article. It has been described in the R8C articles in previous issues of Elektor.

Program flow
Initialisation
Timers Y and Z are first initialised as PWM timers with a pulse rate of 2 kHz. Timer X is used to execute wait loops. The UART1 interface is initialised to 9600 baud, 8 data bits, 1 stop bit, and no parity. The interrupt for this interface is enabled with a priority of 6. The following default values are then set:

  • Maximum collector or drain current: 100 mA
  • Transistor type: NPN
  • Base current range: 10 µA
  • Number of curves: 5

Configuring the base current range
The base current range is set using I/O pins P1.2 and P1.3 as follows:

P1.2P1.3Base current range
1110 µA
01100 µA
101 mA

Configuring the transistor type
The polarity of the base current or gate voltage and the collector–emitter or drain–source voltage are set using I/O pins P1.0, P1.1, P1.6 and P1.7.

Main program loop
The main program loop constantly polls the UART1 serial interface to see whether any characters have been received. This interface is connected to the PC via the USB to serial adapter (PL2303). The protocol described below has been implemented for data transmission.
Each command consists of a command code (a letter in the range A to Z) optionally followed by one or more parameters, which are always written as ASCII character strings separated by commas. The defined command string terminators are CR (0x13) and LF (0x10). This protocol applies to transmissions in both directions (from the PC to the curve tracer module and from the curve tracer module to the PC), although the curve tracer module does not send commands to the PC on its own initiative. It can only send replies in response to requests from the PC.

Initiation of curve measurement
The curve measurement process starts with the configuration of the output parameters.
For bipolar transistors, the base current range is set to 10 µA and the base–emitter voltage (UBE) is set to 0. For MOSFETs, the base current range is set to 1 mA and the gate–source voltage (UGS) is set to 0. For JFETs, UGS is set to the maximum level, which is +10 V for P-channel JFETs or –10 V for N-channel JFETs. The collector-emitter voltage (UCE) or drain–source voltage (UDS) is set to the maximum value (+10 V or –10 V), and curve tracing is started.
The base current (IB) or gate-source voltage (UGS) is increased until the maximum collector or drain current is reached. With bipolar transistors, the base current range is also incremented if the maximum collector current has not been reached. With JFETs, UGS is reduced until the maximum drain current is reached.
If the maximum collector or drain current is not reached with the maximum value of IB or UGS, curve tracing is terminated and the error message ‘M1’ is sent to the PC. The message ‘M2’ is sent if the maximum collector or drain current is reached with a very low value of IB or UGS, which can occur with a shorted transistor. This message is also sent if too many curves are set with the “K” command. After the base current or gate–source voltage corresponding to the maximum collector or drain current has been calculated, the delta (increment value) is calculated from the base current and the number of curves to be measured (delta = IB(max) divided by number of curves). The previously mentioned error message is also sent if the increment is zero.
The actual measuring process begins if no error has been detected. For each value of IB or UGS, the collector-emitter or drain–source voltage is swept from 0 to 10 V while the associated collector or drain current is measured. The results are sent to the PC in the following format:

P,,
N,

curve_no.: the number of the curve presently being measured;
IB: xbase current or gate–source voltage (0–10 V);
Range: base current range; 0 = 10 µA, 1 = 100 µA, 2 = 1 mA;
UCE: collector–emitter voltage; range 0–1024 (0–10.24 V);
IC: collector or drain current; range 0–1024 (0–512 mA).

The base current is calculated as follows:

Range = 10 µA: base current = IB * 0.025 [µA];
Range = 100 µA: base current = (IB – 14) / 2.3 [µA] if IB >= 14; otherwise base current = 0;
Range = 1 mA: base current = (IB – 16) / 2.6 * 10 [µA] if IB >= 16; otherwise base current = 0.

After all the values have been transferred, the curve tracer module sends ‘O’ to the PC, which can then process the data and display the curves.

Downloading the firmware
The Renesas High-performance Embedded Workshop generates a Motorola (!) hex file (Curve_Tracer.mot), which can be downloaded via the USB interface with the aid of the Flash Development Toolkit.
To enable downloading, fit jumper JP1 on the microcontroller board and press the Reset button. After the firmware has been downloaded, remove the jumper and press the Reset button again.

Application program
The application program provides the user interface for the curve tracer module and is written in Visual Basic 6.0. All program components were packaged using the VB6 Packaging Wizard. They can be installed in any desired folder by running the Setup.exe program. The application program can run under Windows 2000, XP, and Vista. All DLL files and ActiveX components are registered during installation, except for the Prolific driver for the USB to serial converter. This driver must be installed by running PL-2303 Driver Installer.exe.
The Curve_Tracer.exe program can be started after the curve tracer module is connected to a USB port of the PC.

Functions
The window appears after the program starts up and establishes a connection to the curve tracer module. The following functions are available in this window:

  • Recording the characteristic curves of NPN and PNP transistors, N-channel and P-channel MOSFETs, and N-channel and P-channel JFETs.
  • Exporting curve data to Excel and importing curve data from Excel.
  • Checking transistor matching.
  • Printing curve charts or embedding them in other applications.

The program has an extensive Help function, so the operation of the program is not described in detail here.

Construction
As can be seen from the schematic diagrams, the hardware is divided between two PCBs. The small microcontroller board holds the R8C/13 and the PL2303, along with the associated components. The main board contains the rest of the hardware, including the transformer.
All of the components on the microcontroller board are SMDs, so a reasonable amount of soldering experience is necessary for assembly. The main board is more roomy, and all of the components have leads or pins. The two 12-V voltage regulators, as well as power transistors T3 and T4, are fitted with heat sinks. Here you must take care that the heat sinks of the two transistors do not touch. It’s a good idea to use a piece of insulating material here.
The microcontroller board plugs into a 20-pin DIL socket on the main board. The assembled board set can be fitted in a suitable enclosure, such as the Bopla type E450 FVL. Various types of transistor sockets can be fitted to the enclosure to provide connections for the transistors, although a set of three short leads terminated in alligator clips is also a workable solution.