Transistor Curve Tracer




Introduction: Transistor Curve Tracer

I've always wanted a transistor curve tracer. It's the best way of understanding what a device does.Having built and used this one, I finally understand the difference between the various flavours of FET.

It's useful for

  • matching transistors
  • measuring the gain of bipolar transistors
  • measuring the threshold of MOSFETs
  • measuring the cutoff of JFETs
  • measuring the forward voltage of diodes
  • measuring the breakdown voltage of Zeners
  • and so on.

I was very impressed when I bought one of the wonderful LCR-T4 testers by Markus Frejek and others but I wanted it to tell me more about the components so I started to design my own tester.

I began by using the same screen as the LCR-T4 but it doesn't have a high enough resolution so I changed to a 320x240 2.8" LCD. It happens to be a colour touch-screen which is nice. The curve tracer runs on an Arduino Pro Mini 5V Atmega328p 16MHz and is powered by 4 AA cells.

Step 1: How to Use It

When you switch on the curve tracer, the main menu screen is displayed.

Select the kind of device by touching one of "PNP NPN", "MOSFET" or "JFET". You can test diodes in the "PNP NPN" mode.

Put the Device Under Test (DUT) into the ZIF socket. The menu screen shows you which pins to use. PNPs, p-channel MOSFETS and n-channel JFETS go in the left side of the socket. NPNs, n-channel MOSFETS and p-channel JFETS go in the right side of the socket. Close the ZIF socket.

After a second or so, the tester will realise that it has a component and will start to draw the curves.

For a PNP or NPN transistor it plots Vce (the voltage between the collector and emitter) versus the current flowing into the collector. A line is drawn for each different base current - e.g. 0uA, 50uA, 100uA, etc. The gain of the transistor is shown at the top of the screen.

For a MOSFET it plots Vds (the voltage between the drain and source) versus the current flowing into the drain. A line is drawn for each different gate voltage - 0V, 1V, 2V, etc. The turn-on threshold of the FET is shown at the top of the screen.

For a JFET it plots Vds (the voltage between the drain and source) versus the current flowing into the drain. A line is drawn for each different gate voltage - 0V, 1V, 2V, etc. With depletion JFETs, current flows when the gate voltage is equal to the source voltage. As the gate voltage is changed to be further from the drain voltage, the JFET turns off. The cut-off threshold of the FET is shown at the top of the screen.

The most interesting part of a MOSFET or JFET curve is around the turn-on or cut-off voltage plus or minus a few hundred mV. In the main menu, touch the Setup button and the Setup screen will be shown. You can select the minimum and maximum gate voltage: more curves will be drawn in that region.

For a PNP or NPN transistor, the Setup screen allows you to select the minimum and maximum base current

With diodes, you can see the forward voltage and with Zeners, the reverse breakdown voltage. In the image above, I've combined the curves of several diodes.

Step 2: How It Works

Let's consider an NPN transistor. We're going to draw a graph of the voltage between the collector and emitter (x-axis is Vce) versus the current flowing into the collector (y-axis is Ic). We'll draw one line for each different base current (Ib) - e.g. 0uA, 50uA, 100uA, etc.

The emitter of the NPN is connected to 0V and the collector is connected to a 100ohm "load resistor" and then to a voltage that slowly increases. A DAC controlled by the Arduino sweeps that test voltage from 0V to 12V (or until the current through the load resistor reaches 50mA). The Arduino measures the voltage between the collector and emitter and the voltage across the load resistor and draws a graph.

This is repeated for each base current. The base current is generated by a second 0V-to-12V DAC and a 27k resistor. The DAC produces 0V, 1.35V (50uA), 2.7V (100uA), 4.05V (150uA), etc. (Actually, the voltage has to be a little higher because of Vbe - assumed to be 0.7V.)

For a PNP transistor, the emitter is connected to 12V and the collector is connected to a 100ohm load resistor and then to a voltage that slowly decreases from 12V to 0V. The base current DAC steps down from 12V.

An n-channel enhancement MOSFET is similar to an NPN. The source is connected to 0V, the load resistor is connected to the drain and to a voltage sweeping from 0V to 12V. The DAC that was controlling the base current now controls the gate voltage and steps 0V, 1V, 2V, etc.

A p-channel enhancement MOSFET is similar to an PNP. The source is connected to 12V, the load resistor is connected to the drain and to a voltage sweeping from 12V to 0V. The gate voltage steps 12V, 11V, 10V, etc.

An n-channel depletion JFET is slightly more difficult. You would normally imagine the source connected to 0V, the drain connected to a varying positive voltage and the gate connected to a varying negative voltage. A JFET normally conducts and is turned off by a negative gate voltage.

The curve tracer can't generate negative voltages so the n-JFET drain is connected to 12V, the source is connected to a 100ohm load resistor and then to a voltage that slowly decreases from 12V to 0V. We want Vgs (the gate-source voltage) to step from 0V, -1V, -2V, etc. We want Vgs to remain constant as Vds (the drain-source voltage) varies. So the Arduino sets the voltage at the load resistor then adjusts the gate voltage DAC until Vgs is the required value. It then sets a new voltage at the load resistor and again adjusts the gate voltage, etc.

(The curve tracer can't measure the voltage applied to the gate but it knows what it's told the DAC to do and that's accurate enough. Of course, this only measures the negative-gate part of the JFET response; if you want to see the positive-gate part, treat it as a MOSFET.)

A p-channel depletion JFET is treated similarly but the 0-to-12V values are all inverted.

(The curve tracer does not specifically deal with depletion MOSFETs or enhancement JFETs but you could treat them as depletion JFETs and enhancement MOSFETs.)

Once it has completed the graph the curve tracer calculates the gain, threshold or cut-off of the transistor.

For bipolar transistors, the Arduino looks at the average spacing of the horizontal lines of the curves. As it draws the curve for base current, it notes the collector current when Vce is equal to 2V. The change in collector current is divided by the change in base current to give the gain. The gain of a bipolar is a vague concept. It depends on how you measure it. No two makes of multimeter will give the same answer. Generally, all you're asking is "is the gain high?" or "are these two transistors the same?".

For MOSFETs, the Arduino measures the turn-on threshold. It sets the load voltage to 6V then gradually increases Vgs until the current through the load exceeds 5mA.

For JFETs, the Arduino measures the cut-off voltage. It sets the load voltage to 6V then gradually increases (negative) Vgs until the current through the load is less than 1mA.

Step 3: The Circuit

Here is a brief description of the circuit. A more complete description is in the attached RTF file.

The curve tracer needs three voltages:

  • 5V for the Arduino
  • 3.3V for the LCD
  • 12V for the test circuit

The circuit must convert make these different voltages from the 4 AA cells.

The Arduino is connected to a 2-channel DAC to produce the various test voltages. (I tried using the Arduino PWM as a DAC but it was too noisy.)

The DAC produces voltages in the range 0V to 4.096V. These are converted into 0V to 12V by op-amps. I couldn't find any through-hole rail to rail op-amps that can source/sink 50mA, so I used an LM358. The output of an LM358 op-amp cannot go higher than 1.5V below its supply voltage (i.e. 10.5V). But we need the full range of 0-12V.

So we use an NPN as an open-collector inverter for the output of the op-amp.

The advantage is that this home-made "open-collector op-amp" output can go right up to 12V. Feedback resistors around the op-amp amplify the 0V to 4V from the DAC to 0V to 12V.

The voltages at the Device-Under-Test (DUT) vary between 0V and 12V. The Arduino ADCs are limited to 0V to 5V. Potential dividers do the conversion.

Between the Arduino and the LCD are potential dividers that drop 5V to 3V. The LCD, the touch screen and the DAC are controlled by the SPI bus.

The curve tracer is powered from 4 AA cells which give 6.5V when new and can be used down to around 5.3V.

The 6V from the cells is dropped to 5V with a very low dropout regulator - a HT7550 (if you don't have one then a 5V zener and a 22ohm resistor is not too much worse). The current consumption of the 5V supply is around 26mA.

The 6V from the cells is dropped to 3.3V with a low-dropout regulator - the HT7533. The current consumption of the 3.3V supply is around 42mA. (A standard 78L33 would work but it has a 2V dropout so you'd have to throw away your AA cells sooner.)

The 6V from the cells is boosted to 12V with a SMPS (Switched Mode Power Supply). I simply bought a module from eBay. I had real trouble finding a decent converter. The bottom line is, don't use an XL6009 converter, it's an absolute menace. As the battery goes flat and falls below 4V the XL6009 goes crazy and produces up to 50V which would fry everything. The good one I used is:

It's tiny and is about 80% efficient. Its input current consumption is around 5mA when waiting for a DUT to be inserted and momentarily up to 160mA when drawing the curves.

As the AA cells are discharged the voltages vary, the software compensates by using reference voltages. The Arduino measures the 12V supply. The Arduino ADC uses its "5V" supply as a reference voltage but that "5V" is calibrated accurately against the Arduino's internal 1.1V reference voltage. The DAC has an accurate internal reference voltage.

I like the way the LCR-T4 has a button to turn it on and turns itself off automatically with a timeout. Unfortunately, the circuit introduces a voltage drop which I can't afford when powering from 4 AA cells. Even re-designing the circuit to use a FET wasn't sufficient. So I'm using a simple on/off switch.

Step 4: The Software

The Arduino sketch is attached here. Compile and upload it to the Pro Mini in the usual way. There are lots of descriptions of how to upload programs on the web and in other Instructables.

The sketch starts by drawing the main menu then waits for you to insert a component or touch one of the buttons (or send a command from the PC). It tests for component insertion once a second.

It knows you have inserted a component because, with the base/gate voltage set to half way (DAC = 128) and the load resistor voltage set to 0V or 12V, a current of several mA flows through one or other of the load resistors. It knows when the device is a diode because changing the base/gate voltage does not change the load current.

It then draws the appropriate curves and switches the base and load currents off. It then tests once a second until the component is unplugged. It knows the component is unplugged because the load current falls to zero.

The ILI9341 LCD is driven by my own library called "SimpleILI9341". The library is attached here. It has a standard set of drawing commands very similar to all such libraries. Its advantages over other libraries are that it works (some don't!) and it shares the SPI bus politely with other devices. Some of the "fast" libraries you can download use special timing loops and are upset when other, maye slower, devices are used on the same bus. It's written in plain C and so has smaller overheads than some libraries. A Windows program is attached which allows you to make your own fonts and icons.

Step 5: Serial Comms to PC

The curve tracer can communicate with a PC via a serial link (9600bps, 8-bit, no parity). You will need a suitable USB-to-serial convertor.

The following commands can be sent from the PC to the curve tracer:

  • Command 'N': trace the curves of an NPN transistor.
  • Command 'P': trace the curves of a PNP transistor.
  • Command 'F': trace the curves of an n-MOSFET.
  • Command 'f': trace the curves of a p-MOSFET.
  • Command 'J': trace the curves of an n-JFET.
  • Command 'j': trace the curves of a p-JFET.
  • Command 'D': trace the curves of a diode on the NPN side of the socket.
  • Command 'd': trace the curves of a diode on the PNP side of the socket.
  • Command 'A' nn: set DAC-A to the value nn (nn is a single byte) then return an 'A' to the PC. DAC-A controls the load voltage.
  • Command 'B' nn: set DAC-A to the value nn then return a 'B' to the PC. DAC-B controls the base/gate voltage.
  • Command 'X': continuously send ADC values back to the PC.
  • Command 'M': show the main menu.

When the curves are traced following one of the commands, the results of the curve are transmitted back to the PC. The format is:

  • "n": start a new plot, draw the axes, etc.
  • "m (x),(y),(b)": move the pen to (x),(y).
    • (x) is Vce in integer mV.
    • (y) is Ic in integer hundreds on uA (e.g. 123 means 12.3mA).
    • (b) is the base current in integer uA
    • or (b) is 50 times the gate voltage in integer mV
  • "l (x),(y),(b)": draw a line to pen to (x),(y).
  • "z": the end of this line
  • "g (g)": the end of the scan;
    • (g) is the gain, threshold voltage (x10) or the cut-off voltage (x10)

The values sent to the PC are the raw measured values. The Arduino smooths the values before drawing them by avreraging; you should do the same.

When the PC sends an "X" command, The ADC values are returned as integers:

  • "x (p),(q),(r),(s),(t),(u)"
    • (p) the voltage at the load resistor of the PNP DUT
    • (q) the voltage at the collector of the PNP DUT
    • (r) the voltage at the load resistor of the NPN DUT
    • (s) the voltage at the collector of the NPN DUT
    • (t) the voltage of the "12V" supply
    • (u) the voltage of the "5V" supply in mV

You could write a PC program to test other devices. Set the DACs to test voltages (using 'A' and 'B' commands) then see what the ADCs report.

The curve tracer only sends data to the PC after it has received a command as sending data slows down the scan. It also no longer tests for the presence/absence of a component. The only way to turn off the curve tracer is to send an 'O' command (or to remove the battery).

A Windows program is attached which demonstrates sending commands to the curve tracer.

Step 6: Building the Curve Tracer

Here are the major components that you'll probably need to buy:

  • Arduino Pro Mini 5V 16MHz Atmel328p (£1.30)
  • 14pin Zif Socket (£1)
  • MCP4802 (£2.50)
  • HT7533 (£1)
  • LE33CZ (£1)
  • IL9341 2.8" Display (£6)
  • 5V to 12V boost Power Supply (£1)
  • 4xAA cell battery holder (£0.30)

Search eBay or your favourite supplier. That's a total of around £14.

I got my display here:

And the boost SMPS here:

The remaining components are things you probably have already:

  • BC639 (3 off)
  • 100nF (7 off)
  • 10uF (2 off)
  • 1k (2 off)
  • 2k2 (5 off)
  • 3k3 (5 off)
  • 4k7 (1 off)
  • 10k (7 off)
  • 27k (1 off)
  • 33k (8 off)
  • 47k (5 off)
  • 68k (2 off)
  • 100R (2 off)
  • Slide Switch (1 off)
  • LM358 (1 off)
  • stripboard
  • 28-pin IC socket or SIL header
  • nuts and bolts

You will need the usual electronics tools - soldering iron, cutters, solder, odd pieces of wire, etc. - and a USB-to-serial convertor to program the Arduino.

The curve tracer is built on stripboard. If you're the sort of person who wants a curve tracer, you will already know how to lay out stripboard.

The layout I used is shown above. Cyan lines are copper on the back of the stripboard. Red lines are links on the component side or are the extra-long leads of the component. Curved Red lines are flexible wire. Dark blue circles are breaks in the stripboard.

I built it on two boards, each 3.7" by 3.4". One board contains the display and the tester circuit; the other board has the battery holder and the 3.3V, 5V and 12V supplies. I kept the low-voltage ("5V") and high-voltage ("12V") parts of the tester circuit separate with only high-value resistors crossing the frontier.

The two boards and the display form a triple-decker sandwich held together with M2 screws. I cut lengths of plastic tube to act as spacers or you could use ballpoin pen tubes, etc.

I only connected the Arduino Mini pins that I needed and only the ones on the sides (not at the top and bottom ends of the Mini PCB). I used short lengths of wire rather than the usual row of square pins that Arduinos are supplied with (the pins soldered to the PCB are square in the drawing). I wanted the Arduino to be flush against the stripboard because there's not a lot of height under the display.

The Arduino ProMini pinout is rather variable. The pins on the long edges of the board are fixed but the pins on the short edges differ between suppliers. The layout above assumes a board with the 6 programming pins with Gnd next to the Raw pin and with DTR next to Tx on the long edge. At the other end of the board are a row of 5 pins with 0V next to D9 and A7 next to D10. None of the short-edge pins are soldered into the stripboard so you can use loose wires if your ProMini is different.

Use a SIL header socket to hold the display. Or cut a 28-pin IC socket in half and use the pieces to make a socket for the display. Solder the square pins that are supplied with the display (or came with the Arduino) into the display. They're too fat to plug into a turned-pin socket - choose a socket that has the "spring clip" kind of pins. Some "spring clip" kind of IC sockets can only withstand half a dozen insertions/removals of the LCD so try to find good ones in your component drawer.

The LCD contains a socket for an SD card (which I didn't use). It is connected to 4 pins on the pcb. I used the pins and a piece of SIL header or IC socket to help support the LCD.

Notice that there are some links under the ZIF socket. Solder them in before you fit it.

I added a programming connector with Tx, Rx, Gnd and a reset button. (My USB-to-serial convertor doesn't have a DTR pin so I have to reset the Arduino manually.) I unsoldered the programming connector when the project was finished.

To protect the electronics, I made a cover from polystyrene sheet.

Files for the circuit in EasyPC format are attached.

Step 7: Future Development

It might be nice to produce curves for other components but which? It's not clear to me what extra infomation the curve of a thyristor or triac would tell me beyod what the LCR-T4 tester does. The LCR-T4 tester can even be used with opto-isolators. I've never used a depletion MOSFET or an enhancement JFET or a unijunction transistor and don't own any. I presume the curve tracer could treat an IGBT as a MOSFET.

It would be nice if the curve tracer could recognise a component automatically and say which pin is which. Ideally, it would then go on to produce the curves. Unfortunately, the way the DUT pins are driven and measured, that would require a lot of extra components and complexity.

A simpler solution is to copy the existing LCR-T4 tester circuit (it's open source and very simple) with a second Atmega processor. Extend the ZIF socket to 16-pin to give three extra pins into which the unknown component can be plugged. The new Atmega acts as a slave on the SPI bus and reports to the main Arduino Mini what it sees. (SPI slave sketches are available on the web.) The software of the LCR-T4 tester is available and looks well documented. There's nothing inherently difficult there.

The main Arduino displays the component type and a diagram of how to plug the component in to the curve tracer part of the ZIF socket.

I've attached a surface-mount layout which can be used with an Arduino ProMini or with a naked Atmega328p (in EasyPC format). If there is sufficient demand (and orders with money) I could produce a batch of SM PCBs Could you buy one from me ready built? Well yes, of course, but the price would be silly. The advantage of dealing with China is that so many nifty electronic modules can be bought so cheaply. The disadvantage is that it's not worth developing anything: if it's a success, it will be cloned. Nice as this curve tracer is, I don't see it as a viable business opportunity.

4 People Made This Project!


  • Colors of the Rainbow Contest

    Colors of the Rainbow Contest
  • Explore Science Challenge

    Explore Science Challenge
  • Make it Real Student Design Challenge #3

    Make it Real Student Design Challenge #3



Question 2 months ago on Introduction

IL9341 display 3v3 or 5V?
Why are there voltage dividers (5V to 3v3) on 3,4,5,6,7 to protect the display controller, and yet pins 11 and 13 have the full 5V signals?
I have just completed the project and plugged in the display which worked for a minute and then went blank. Upon investigation the tiny U1 (is it a Vreg?) on the back of the display has exploded. and there is a complete short circuit downstream of this device.
The Arduino is still running and I have checked every connection/signal/supply to the display and all signals are fine but what about these 5V signals on pins 11 and 13 should they have potential dividers and be 3v3?
The datasheet says that Vcc =3v3/5V yet elsewhere it says 5V signals will damage the display controller.
I would welcome everyone's thoughts....

Peter Balch
Peter Balch

Answer 2 months ago

> IL9341 display 3v3 or 5V?

A good question. The IL9341 chip is 3V3 (actually 2.8 to 3.3V).

I've bought a few of the display modules and every one of them has a built-in 3V3 regulator. If you look on the back of the PCB, you'll see it connected to the VCC pin. It's a 662K chip on the ones I have - max 6V input, 200mA.

So it can be powered by 5V and you can connect it directly to your 5V Arduino pin. The LED power pin can also be connected directly to the 5V pin. At least, I think that's the case. Other people do that and I've been doing that and nothing's gone wrong.

In my schematic for the Curve Tracer, I see I've used an external 3.3V regulator. It was the first time I'd used the IL9341 module and I wasn't sure whether I could power it from 5V. You'll see in my subsequent projects, I just connect VCC and LED to the Arduino's 5V pin.

Is your LED backlight still working? You could try fitting another 3V3 regulator.

If the 662K chip has burned out, could you bridge it (connect its pins 2 and 3) and test the display by running the board from a 3.3V supply? You can probably get away with running it from the 3V3 pin of the arduino. Its current consumption is less than 10mA. The backlight takes more current and should not be run from the Arduino's 3V3 pin. You can run it from the Arduino's 5V pin.

As you say, there are voltage dividers on 3,4,5,6,7 of the display.
Pins 13 goes from the display to the Arduino. The Arduino pins are set
to input so no current should flow from the Arduino to the display.
You'll see I've put 10k resistors in the line so if there's a bug in the
Arduino code and the Arduino outputs 5V, the current will be
(5-3.3)/10000 = 0.17mA. That should be too small to damage the input
pins of the ILI9341.

Pin 11 goes from the Arduino to the display. That was me being lazy - I should have put a voltage divider on it. It's got a 10k resistor so, once again, the current is limited to 0.17mA. The ILI9341 has protetcion diodes on its input which will stop that 0.17mA current damaging the chip. The datasheet doesn't say what current the diodes can take - a typical value is 1mA.

If look around the web, you'll see other people do voltage-conversion that way. (It's the worst way to do it. The problem is the input capacitance of the pins. Best are FETs or voltage divider chips - they're fast. Next are potential divider resistors - they're slower. And last is a high value resistor - slowest of all.) It works fine with a slowly changing signal like CS but I wouldn't do it with a clock or data signal.



Reply 2 months ago

Hi Peter,
Thanks for your considered reply.
I built my unit directly from your original article so have a 3v3 regulator on board to drive the display. (and a 5V one for the Arduino etc)
Subsequently I have (as you say) discovered that the 662K is indeed a 3v3 reg that can be jumpered out with a solder bridge.
Whilst I checked all my signals going to the display with my 'scope and they were all 3v3 other than the two going to pins 11,13.
However looking at the 'touch' controller spec I now see that it's a 5v tolerant device.
I was afraid that these signals had damaged the display controller IC and caused it to draw excessive current blowing the 662K regulator.
I disconnected the display from the auduino and carefully powered the output side of the 662k from a variable PSU. As I increased the voltage supply from zero the display was taking hundreds of milliamps so I suspect the controller IC has failed or was a dud from the start?
The LED edge pin is a LED control pin NOT a direct connection to the backlight LED's so as the controller seems to be 'fried' the LEDs don't illuminate :-(
I am a little reticent now to plug another display into the Arduino even though I have double checked all the!
I was planning to modify your project to make it a transistor 'matching' device with two sets of inputs switched by the Arduino to display (persistence of vision) with overlaid curves from both devices.
I have just built an 80A electronic load and could have done with just such a device. However I eventually used individual opamp drivers with emitter feedback for each of the eight MJ11032 power darlingtons and this works really great. I tested it it 50A and it ran cool so I am sure it will handle greater current.
Finally, I complained to the vendor about the display and he's sending a replacement (hopefully).
Thanks again.

Peter Balch
Peter Balch

Reply 2 months ago

It certainly sounds like there's something horribly wrong with the display.

When you get the new one, can you power it from a current-limited supply? Or maybe just put a 100R resistor in the power line.

The 662K can only take 6V max input. Is it possible it got connected to the 12V line?

It's always annoying when one destroys a module or chip and you've got to wait ages for another one to be delivered. Please let me know how it works out.


Reply 2 months ago

Hi Peter,
The +12v goes only to the inputs of my two AMS1117 regulators and the only supply to the display is from the output of the AMS1117-3v3.
Otherwise the +12v goes to the opposite end of the pcb, as in your design.
Yes I am pretty sure that the display was faulty. I would normally have bought one off Ebay from China but wanted to get on with the project so bought from a 'UK' Ebay seller to get it quickly...sigh!
With hindsight I notice he only had 5 available and two sold so I now wonder what was the source. The Chinese ones always say "more than 10 available"!
I agree I will current limit the new display at first start up to make sure I haven't missed anything but I have checked almost to the level of paranoia!
I will let you know how I get on :-)
All the best


Reply 2 months ago

A result!
Hi Peter, so I took a deep breath and dismantled the display. The LCD was glued to the pcb with double sided tape which was incredibly sticky. However I managed to part the two only to find that the cheapskates had soldered the flexy-pcb edge connector directly to the pcb rather than use a socket.
I needed to know if it was the display that was presenting the 185 Ohms between Vcc and GND or something on the pcb. I unsoldered the flexi-pcb and measured the Vcc and Gnd on the pcb again,
Still 185 Ohms doooh!
So it was now either the TS2046 touch controller or the open circuit 662K (3v3) regulator. New 662K's arrived today so I removed the old one and 'bingo' it was the output of the regulator that was shorting out the 3v3 line.
Of course I should have removed this before desoldering the flexi-pcb...sigh!
Anyway this allowed me to fit a new 3v3 regulator and test the pcb for shorts?
None found and 3v3 was going to all the correct places.
Gritted teeth and now to try to re-solder the LCD's flexi-ribbon back to the pcb.
Success (easier than anticipated) all popped back together and powered up the curve tracer.
It works...HURRAH!
By the way the touch controller is powered from 3v3 so the 5V lines from the Arduino really should be divided down to 3v3, (though this didn't cause this failure)
So just a dud Chinese 3v3 regulator on the display was the cause of my failure.
Good to get it going.
Thanks for your support Peter.

Peter Balch
Peter Balch

Reply 2 months ago

Great news - and there's probably a moral in the tale, something to do with checking X before Y. If only hindsight ever helped next time I try to do something.

Those flexi pcbs are dreadful. My first Arduino Instructable was about using a COG LCD and I made a real mess of the soldering.

> By the way the touch controller is powered from 3v3 so the 5V lines from the Arduino really should be divided down to 3v3,

Using a current limiting resistor rather than a potential divider is fine - honest. Here's a discussion from Microchip. As they say, capacitative loading of the signal means you should only do it with slow signals (like the touch-screen CS). A potential divider only works with medium-speed signals. The SPI bus speed I'm using in this project is OK but I wouldn't expect full-speed SPI to be reliable. The proper way to do it is using FETs or even bi-directional high-speed chips.



Reply 2 months ago

HI Peter,
Yes you would have thought 40 years as an electronics engineer would have taught me something wouldn't you? In my defence, I was hoping to unplug the display from the board so I could 'run' the pcb up on it's own, and when I found the LCD didn't have a connector I got too enthusiastic lol!
OK on the SPI, I was just reporting what I had found, as I initially believed that the touch controller was running off the 5v input.
Thanks for your support.
All the best


4 months ago

Hi !

I have a question, you wrote :

"This is repeated for each base current. The base current is generated by a second 0V-to-12V DAC and a 27k resistor. The DAC produces 0V, 1.35V (50uA), 2.7V (100uA), 4.05V (150uA), etc. (Actually, the voltage has to be a little higher because of Vbe - assumed to be 0.7V.)"

But it somehow not true. You assume you have a voltage generator with ONLY 27k.
But in fact, you have I = Udac/(27k+Rbe) so the current is not exact.

You should measure the basis current step by step.


Peter Balch
Peter Balch

Reply 4 months ago


I don't think that Rbe is a useful concept. The base voltage/current curve is so non-linear you can't treat it as a resistor. As I said, you're better considering Vbe so your equation should be I = (Vdac-Vbe)/27k. Vbe depends on Ibe and also on Ice. It's traditional simply to assume that Vbe is 0.7V for silicon transistors (0.3V for germanium) and design your circuit around that.

You can measure the base current if you want but why do it? I think it's a mistake to base your circuit design on the exact shape of the Vbe curve - it varies too much between different transistors or with temperature changes or ageing. Design your circuit with plenty of negative feedback to compensate for differences between components or changes over time.

My curve tracer shows the approximate shape of the transistor's response - that's all any curve tracer does. Plug a transistor into different transistor-testors and you'll get very different values for the "gain". The only reason you might worry about the exact gain is to choose a "matched pair" and then you'll simply choose two transistors that give the same reading on the same tester. Even a "matched pair" bought from a reputable manufacturer might differ by 5%.

Don't design circuits that rely on exact values of any components - particularly the gain. Use negative feedback.


5 months ago

In ExecSetupMenu function for what purpose you have used

if (millis() - time > 1000) {
if (TestDeviceKind(tkNothing, false) != tkNothing)
return true;
time = millis();
Can you explain if possible thanking you sir

Further it was defined
i = analogRead(pin_ADC_NPN_Vcc) - analogRead(pin_ADC_NPN_Vce);
It is voltage difference only For current It has to divide by collector load
Pl clarify that point also

Peter Balch
Peter Balch

Reply 5 months ago

The ExecSetupMenu function executes one of the setup menus (for Bipolar or FET) then waits for either the OK button to be pressed or for a device to be inserted. (It also deals with pressing the up/down buttons)

It returns false if the OK button is pressed and returns true if a device is inserted.

The "if (millis() - time > 1000)" block tests whether a device has been inserted. It does so once every second.

I guess you don't have a millis() function in your 18f4620 software. Of course, it doesn't really matter that the test is done exactly once a second. I think I put the timer in there so that the test wasn't done every time round the loop - it slows down the response time of pressing the buttons so should only be done occasionally. Perhaps you could do the TestDeviceKind() test once every 100 or 1000 times the loop is executed.

The construction
if (millis() - time > 1000) {
// do something
time = millis();
is used in the Arduino to prevent problems with overflow:

> For current It has to divide by collector load

True. The collector load is 100 ohms. The Arduino uses the "5V" line as Vref for its 10-bit ADC so 5V is equivalent to an ADC value of 1023. (The Arduino compensates for changes in the "5V" line by measuring its internal band-gap voltage reference.) If you do the maths the equation is

i = ADC_value * 5 / 1023 / 100

So, for instance, a current of 10mA would give an ADC value of 205.

The line you refer to is in TestDeviceKind() when it is trying to decide what device is inserted. It compares the current through the collector load using
if (i > 50) {
A current of 2.5mA gives i = 51. So the program is testing whether the current through the device is greater than 2.5mA.


Reply 5 months ago

Thanks you sir a lot for your explanation For Touch portion I used external interrupt for sensing touch action. by connecting external interrupt pin RBO to interrupt pin of TFT display.The pressure sensing method Z1+Z2 which you followed not gives reliable result for me Thnking you once again


5 months ago

Sir I have ported your project to pic 18f4620 and I have successfully completed TFT DISPLAY PORTION AND TOUCH PORTION GRAPH PORTION is pending After completing I will share fully code


Question 6 months ago

I've been studying the circuit of the curve tracer for a days and i don't understand what is Q3 doing, why cant i just connect the NPN/MOSFET-N/JFET-N straight to the collector ?

Peter Balch
Peter Balch

Answer 6 months ago

Which collector? The collector of Q2?

If the top of R37 was connected to the collector of Q2 then the current through R37 would be limted by R30. The maximum current through R37 (and hence through the DUT) would be around 1mA. The curve tracer sends a maximum current of 50mA through the DUT.

Q3 acts as an emitter-follower. An emitter-follower has a voltage gain of (approximately) 1 but has a high current gain.


6 months ago


ty looks great.
i want to modify it so it will work with arduino due. if i use arduino due that all ready have DAC's and ADC's build in to it, i still need to use the MCP4802 chip?