Tech note: making your own V-I plots at home

surprisetalk1 pts0 comments

Tech note: making your own V-I plots at home

lcamtuf’s thing

SubscribeSign in

Tech note: making your own V-I plots at home<br>Jul 17, 2026

Share

When working on my latest book, The Secret Life of Circuits, I wanted to keep the artwork real. My main beef with the diagrams in popular electronics textbooks and online tutorials is that most of them are fake. At best, they’re retraced from ancient texts; at worst, they’re sketched from memory and can be charitably described as “based on true events”:

An assortment of V-I plots for diodes, collected on the internet.<br>The Secret Life of Circuits contains about 290 original illustrations and no such shenanigans. I painstakingly gathered real data for everything from quartz crystal frequency response, to battery discharge curves, to signal reflections in a 100 ft run of coax cable strewn around the workshop, to the behavior of vacuum tubes.

A snippet from the sample chapter, available here.<br>Most of it was straightforward to capture, but I can’t say the same about the parametric plots that show the relationship between voltage and current in semiconductor devices. In some portions of the curve, the currents are too miniscule to record with the most common graphing instrument, the oscilloscope. In other portions, the current suddenly skyrockets — and before you know it, the device lets out the magic smoke. Even in the in-between region, there’s no respite: the characteristics of semiconductor junctions change with temperature, and that includes self-heating. Do nothing and watch the point on the oscilloscope screen drift away.<br>To tackle this problem, I eventually ditched the oscilloscope in favor of a benchtop multimeter (DMM) and pulsed power from a lab supply. The perk of the multimeter is that it can easily measure down to microamps and microvolts; the perk of pulsed power is that heating-indued drift can be kept in check.<br>Oh — I also submerged the device under test in non-conductive liquid for cooling purposes:

A close-up of the final setup.<br>Of course, taking measurements by hand is tedious and error-prone, so it’s better if one or more of the instruments is interfaced to a computer. Many benchtop instruments support a simple, text-based protocol called Standard Commands for Programmable Instruments (SCPI). Depending on the age of your gear, the interface may be available via RS-232, via a USB Type B (printer-style) port on the rear; or via Ethernet — in which case, you simply establish a TCP connection to port 5025.<br>The SCPI protocol uses commands and queries. An example of a query is *IDN? followed by a newline (\n); sending this string causes the device to respond with a line of text describing its make, model, and other identifying information. Another possible query is MEAS:VOLT?, which might return the current voltage reading. In contrast to queries, commands do not return any text; an example may be SOUR:VOLT 1.2 to set the voltage to 1.2 V, or OUTP 1 to turn on output channel 1.<br>Alas, although I had an SCPI-capable multimeter, my benchtop power supply was more basic and offered no remote control. Because of this, I bit the bullet and purchased a source measure unit (SMU) — essentially a combination power supply and a multimeter with a very fast response time. Brand new SMUs are obscenely expensive, but there are virtually no second-hand buyers for them, so it’s easy to find excellent deals on eBay. I scored Rohde & Schwarz NGU401 for a laughably tiny fraction of its astronomical MSRP ($9,000).<br>This particular SMU can be used by repeatedly setting the output voltage and then querying the DMM for the current on-screen reading, but the reading is updated only at a frequency of about 3 Hz. A better option is to use the device’s data streaming mode; in the Rohde & Schwarz parlance, this is known as FastLog. The API allows sampling rates of 100 to 250k per second (!) and sends voltage-current pairs as binary 4-byte floats.<br>Of course, as can be expected of a niche feature on a niche device, nothing actually works as documented. The returned binary data is corrupted if you try to use the serial-over-USB interface; after a day of chasing ghosts, I was finally able to get it to work over Ethernet.<br>My C implementation for capturing the V-I curve of a forward-biased diode can be found here. It uses FastLog at 10 ksps; for currents below 0.3 mA or so, it leaves the supply voltage on and averages 2,500 data points to obtain a noise-free microamp-range reading. For higher currents, it cycles the power on for 5 ms, and averages 20 best samples from the FastLog buffer.<br>The following plot shows the actual, positive-side V-I curve for a popular 1N4148 diode with a continuous current rating of 300 mA:

Forward bias of 1N4148.<br>The data is unedited and can be found here. Note that I was able to effortlessly cover the range from few microamps to nearly 2 A; it’s actually possible to go to 4 A, but it adds no interesting detail to the plot.<br>Note that although the relation...

from voltage current note plots data

Related Articles