## 2016/12/04

### Resistor blackjack – the ultimate party game for nerds

Resistor blackjack is like regular blackjack but better! Your goal is to assemble a single resistance from several resistors that is as close to 21k while not being over.
Unlike regular blackjack, the resistors can be combined in series and in parallel, giving the game a whole new dimension. Plus, resistors have tolerances so achieving a mathematical 21k doesn't guarantee a win.

### The deck

The deck resembles card deck except for the ace which has to be a fixed 11k.
For 4 players, you will need the following values:
2× 2k2
2× 3k3
2× 4k7
2× 5k6
2× 6k8
2× 7k5
2× 8k2
2× 9k1
8× 10k
2× 11k
Put all the resistors in a box and shuffle.

### Player's equipment

Each player should be given an empty breadboard, resistor color code chart (maybe, if you want to be nice) and access to jumper wires.
Decide whether to allow calculators. Computing reciprocal values when resistors are combined in parallel can be tedious.

### Dealer's equipment

Box with the deck.
Ohmmeter (multimeter).
Another box with: 5× 100k, 5×330k, 5×470k.
A separate larger breadboard as the scoreboard.

### Rules

Start the round by giving each player two random resistors. During the round, each player can ask for up to 4 more resistors (total of 6) but they have to use all of them and assemble them so they form a single resistance. Shorting a resistor is not allowed.

At the end of the round, dealer measures each player's assembled resistance. Who is the closest to 21k without being over wins and draws one resistor from the second box. The resistors which players win are connected in series on a separate breadboard (scoreboard) and who is the first to have over one million ohms wins the entire game!

### Rule extension: 20k trimmer.

Before a round begins, dealer can ask a trivia question. The player who has a correct answer (is first or is the closest if the answer is a number) is given a 20k trimmer which he/she can but does not have to use in the following round. The trimmer is returned to the dealer after the round ends.

## 2016/07/22

### Hameg HM8118 LCR bridge

tl;dr: I made a control program for Hameg HM8118 LCR bridge. You can get it here: https://github.com/kaktus85/Hameg8118

## Controlling Rohde & Schwarz Hameg 8118 LCR Bridge/Meter from PC

### Introduction

There's a lot of LCR bridges on the market from simple fixed-frequency el cheapo meters made in country where pandas kiss good night to high end thousands of dollars meters made in… well, the very same place.

Somewhere in the middle lies Hameg HM8118 LCR bridge from Rohde & Schwarz for about 2300 USD. While the less advanced models only have a couple of frequencies at best, this baby has 69 of them. That makes it suitable for measuring a frequency sweep and then fitting the data to a more complicated equivalent circuit than the two-component model you can use for a single frequency. The frequency range is 20 Hz to 200 kHz and the device has specified accuracy to 100 kHz so the frequencies between 100 kHz and 200 kHz are more of a "bonus". But that does not mean they are completely useless. Just that you can't expect them to be super-accurate. Hameg HM8118

### Operating principle

So, how does it work? Normally, the bridge measures the voltage and current through the device under test (DUT), which is typically a resistor, capacitor or inductor. Besides amplitudes, it also measures the phase and from the ratio of amplitudes of voltage and current and the phase difference, it then calculates the impedance. Either as magnitude-phase or resistance-reactance. It is just a different representation of the same quantity. Then, it can apply the knowledge of impedance together with the frequency on a simple two-component model such as a combination of resistor and capacitor or resistor and inductor. Plus, these components can be connected in series or in parallel. That is all math. The device calculates what would be the values of the resistor and capacitor/inductor if they've been connected in series or in parallel and the whole ciruit had the measured impedance at the set frequency.

But as you only measure two quantities (voltage and current), you can only calculate two unknowns. If the circuit is more complicated, you need measurements at more frequencies. Preferably, you measure all the 69 available frequencies and then fit the experimental data to the equivalent circuit. Not a trivial task to do but possible.

This is the basic operating principle of this LCR bridge. It is a nice unit that, sadly, does not come with a desktop software so you have to rely on the front panel display and buttons which make complicated measurements tedious. Yet, you can connect the device via USB and switch it to a virtual COM (serial) port. Then send commands and read measured values.

### Controlling from PC

I have used the serial port feature to create a simple control program in C# (.NET 4.6). It should work on any computer running Vista or higher. It is open source and released under GPL v.3. The project, which also contains the only executable file you need (Hameg8118.exe) is available on my GitHub account.

## 2016/06/07

### Push it to the limit – measure the true junction temperature to get the most out of MightyWatt

Spoilers!

If you just want to know if you can overload your MightyWatt, the answer is yes. You can run it at 75 W constantly and at about 85 W for short periods.

End of spoilers Fig. 1: Experimental setup for measuring forward voltage drop of a FET body diode.

## Introduction

If you want to run a FET at high temperature, which is typical in electronic load applications, it is important not to exceed the maximum junction temperature. In my MightyWatt electronic load, I use IXTH75N10L2 as the main transistor and its maximum allowed junction temperature is 150 °C.

It is not easy to measure the junction temperature without actually having a sensor at the junction. Thermal camera, thermistors and other sensors will always measure less because there will be a temperature gradient betwen the case and the junction. At 70 W, the temperature of the copper tab directly attached to the die can be 20 °C less than the silicon temperature!

Luckily, there is a way of measuring the junction temperature. Sadly, it cannot be done while the load is operating… Because the temperature sensor is the intrinsic body diode of the FET itself. Its temperature coefficient can be measured in laboratory conditions and then its temperature can be correlated to some other temperature sensor, attached to the body of the transistor. In case of MightyWatt, that is a tiny 0402 thermistor placed beneath the transistor.

## Experimental setup, results and discussion (don't mix this in a paper)

### Measurement of the diode temperature coefficient

I have first measured the intrinsic body diode forward drop (VSD) of 10 samples of IXTH75N10L2 at room temperature (about 24 °C) at 1 mA using Keysight 34461A bench-top digital multimeter. Interestingly, they were all the same, at 522 mV. That's good! Seems like the process variation is not very high.

Then, one sample from these 10 was randomly selected and fitted with silicone elastomer insulated cables to the drain and source.

The transistor was then immersed in an oil bath (edible rapeseed oil actually) in a borosilicate beaker with a magnetic stir bar and put on a heated magnetic stirrer (IKA C-MAG HS7) (Fig. 1, 2). The temperature sensor from the stirrer was Kapton-taped to the metal tab of the transistor. Fig. 2: Transistor in an oil bath with two temperature probes: One from the magnetic stirrer/hotplate and a second, external one for verification.

Then, the bath was heated to 60, 70, 80, 90, 100, 110, 120 and 130 °C and when the temperature stabilized, a few seconds worth of experimental values were averaged to get the VSD. The multimeter sampled at about 1000 samples per second.

The VSD turned out to be linearly dependent on the temperature with a slope of -2.454 mV/K (Fig. 3). Fig. 3: Temperature dependence of VSD and ideality factor n (which is only discussed in the "extra math" section so pretend you can't see it).

### Measurement of the diode VSD in MightyWatt

First, I soldered wires to the drain and source of one standard MightyWatt's main transistor. The source was at the common ground potential. Because measuring VSD means connecting the polarity in opposite, the drain was connected to a SPDT relay. The normally closed lead was connected to multimeter negative terminal (diode cathode) via a 0.15-Ohm current sense resistor while the normally open lead was connected to power supply positive terminal.

Triggering of the measurement was done using a comparator circuit, which was driving one transistor that switched the relay and another transistor which triggered the multimeter. When there was current flowing through the load, the comparator would switch the relay to connect the power supply. When the current was interrupted, the relay switched to measure the VSD (Fig. 4). The propagation delay between the current interrupt and the actual trigger signal was measured using an oscilloscope (Rigol DS1052E). Fig. 4: Schematic of the connections for the in-system measurement of VSD.

The load was let to dissipate 75.9 W at 3.004 A and I waited until the temperature reported by a thermistor placed beneath the transistor was stable. This took about 10 minutes from ambient temperature. Then, the current was interrupted by physically removing USB cable that powered MightyWatt, immediately interrupting current flow. At that point, the relay switched and multimeter began to measure 2000 samples at about 1000 samples per second. I am only showing the first 500 ms, since the rest was a monotonic increase.

The VSD quickly increased upon interrupting the current. The trigger propagation delay was about 0.2 ms and thus negligible. There was an 80-ms delay starting from the current interrupt before the sampled data stabilized. The VSD had to be extrapolated from the recorded data to the point where the current was actually interrupted. I used only a phenomenological 5th order polynomial to extrapolate to the beginning (Fig. 5). Thermal fluxes are complicated in such setup… Fig. 5: VSD development with time right after the current was interrupted. First 80 ms had to be extrapolated.

So the VSD was about 260 mV when the current was interrupted, which means the junction temperature was about 132 °C, well below the maximum. By the way, the thermistor reported 101 °C temperature. The ambient temperature was 26 °C.

We can calculate the thermal resistance of the system now: (132 - 26) / 75.9 = 1.4 K/W. While the thermistor thinks it is (101 - 26) / 75.9 = 1 K/W. We should therefore calculate the junction temperature (Tj) from thermistor temperature (Tth) and ambient temperature (Tamb) as Tj = (Tth - Tamb) / 1 × 1.4 + Tamb.

Assuming Tamb = 25 °C and Tj = 150 °C, the thermistor will be reporting about 114 °C at this maximum. MightyWatt will report overheat above 110 °C, which seems to be a correct threshold to allow some leeway.

The maximum dissipated power is then (150 - 25) / 1.4 = 89 W. And at rated 70 W, the junction temperature is about 70 × 1.4 + 25 = 123 °C. But there is one catch: The Arctic Silver AS5 thermal paste (which I use) is rated 130 °C continuously (180 °C for short periods of time). The temperature at the thermal paste is unknown because datasheet only quotes maximum junction-to-case thermal resistance. Using the maximum value, the case temperature at Tj = 150 °C will not be less than 122 °C. But probably it will be higher, possibly exceeding the long-term rating of the thermal paste. So to be perfectly safe, let's assume the Tj to be 130 °C maximum. At this temperature (and 25 °C ambient), the maximum continuous power dissipation is (130 - 25) / 1.4 = 75 W

We should leave some safety margin because the extrapolation might not have been very precise and the Tj could have been higher. But advertising MightyWatt as a 70 W load seems to be honest, if a little conservative. And don't worry overloading it for extra 15 W for short experiments. You will have to change the maximum power in the sketch though.

That's all folks! But if you're interested in some more math, then please, continue reading…

## Digging deeper

### Calculation of VSD

Besides direct measurement, the VSD can be calculated using Shockley diode equation (1), where I is the diode current (1 mA in this case), IS is the reverse bias saturation current, n is the ideality factor, typically between 1 and 2, and VT is the thermal voltage equal to kT/q, where k is the Boltzmann constant, T is the thermodynamic temperature and q is the elementary charge.

(1)     I = IS[exp(VSD/n/VT) - 1]

IS is temperature dependent and is approximately equal to (2), where Eg is the bandgap energy.

(2)     IS = T3exp(-Eg/k/T)

The bandgap energy also depends on temperature and can be calculated from (3), with experimentally determined parameters Eg(0) = 1.166 eV, α = 4.77·10-4 eV/K and β = 636 K.

(3)     Eg(T) = Eg(0) - αT2 / (T + β)

Combining equations 1, 2 and 3 with the experimental data permits the calculation of the only remaining unknown – the ideality factor n – which was calculated to be between 1.061 and 1.175 for the temperature from 60 to 130 °C (Fig. 3).
The value of n indicates that the current was limited mainly by the recombination of minority carriers in the neutral region.

Thermal fluxes in systems like transistors on an active heatsink are complicated. The heat emerges from a relatively small region made of silicon and is then preferentially conducted via copper tab to the back of the transistor case where a heatsink is attached. The silicon content is very low compared to the lead frame and encapsulant, which contribute to almost the entire heat capacity of the device.

IXYS does not publish information about the material composition of the transistor but a similarity can be assumed with other parts in the same package. International Rectifier publishes Bill of Materials for TO-247 packaged transistors. The main mass (66.2 %) of the transistor is the copper lead frame. The other significant contribution is the epoxy resin, that is composed mainly of a filler – SiO2. These two materials account for over 90 % of the overall mass. The silicon content is a meager 0.6 %. The total weight of the transistor, as reported by International Rectifier, is 5.6 g. The IXYS IXTH75N10L2 was somewhat heavier at 6.4 g.

This permits us to calculate the approximate heat capacity of such transistor. The specific heat capacity at 127 °C of Cu, SiO2 and Si is 398.6, 889.2 and 788.3 J/kg/K respectively. Assuming the balance to 100 % has the same average heat capacity as the two main components, the overall heat capacity of the International Rectifier transistor is approximately (398.6 × 0.003719 + 889.2 × 0.001411)/0.913 = 3.00 J. Scaling this to the IXYS transistor, the heat capacity could be about 3.00 × 6.4/5.6 = 3.43 J.

Assuming the transistor is evenly heated and thermally conductive, the 80 ms delay at 75.9 W of cooled power would cool it by 1.8 K. However, such assumption is never true because the materials have different thermal conductivity and the heat distribution is uneven, with the maximum at the junction. Besides that, the silicon part has very low heat capacity because it is very small and the thermal path is mainly through the copper to the heatsink. There is a large temperature gradient from the junction to case at 75.9 W. According to the datasheet, the junction-to-case thermal resistance is up to 0.31 K/W, which creates a gradient of 23.5 K at 75.9 W. The extrapolation of junction temperature, even to a time only 80 ms before experimental points, is not trivial and in this study was done by simply fitting the VSD vs. temperature curve with a 5th order polynomial that accurately tracked the experimental data (Fig. 5).

Well, if you read all of this, you really pushed it to the limit. Go ahead, you deserve it!

## Introduction

Bipolar is not only a disorder but also a requirement for power supply for some devices. While most electronics is OK with a simple plus and minus, some will also require a mid-point, often called ground. It does not have to be connected to a real Earth ground and sometimes that is not even possible (think satellites).

The problem is that many laboratory power supplies do not have this midpoint, though they frequently offer ground connection. But that can only be tied to plus or minus, no real midpoint is typically available on them. That's where a virtual ground comes to save the day. Virtual ground, also called "rail-splitter", is a device that creates a midpoint, whose voltage is (plus + minus)/2 and is capable of both sinking and sourcing current. There are two basic approaches to get virtual ground: Either from a switching regulator or from a linear one. The former is more efficient and the latter is easier to build and offers less noise, albeit at the cost of wasting half the power.

For projects that do not require high power, a linear virtual ground is appropriate. I am presenting a circuit and a board that I use personally. It is a third iteration of my original design using a power op-amp and a simple resistor divider.

## The construction

My virtual ground is not cheap, it uses quality components and you may find a cheaper alternative. But this design is robust, simple and powerful. The printed circuit board itself is around 20 USD at OSH Park. Top of the PCB Bottom of the PCB

The unipolar power enters through an universal screw clamp terminal (CON1), the positive rail passes through a 3A resettable fuse F1 (PTC). Voltage spikes are quelled by a bipolar (can be unipolar too) transient suppressor diode D1. The positive rail then passes through reversed P-FET transistor Q1 that protects the circuit from reverse polarity. A suitable part for Q1 would be Vishay SUD50P06-15, a cheaper alternative Infineon SPD18P06P G might work too. Gate voltage is regulated by Zener diode D2 and current-limiting resistor R1. The gate voltage must stay below what is in the datasheet (typically 20 V) so choose the Zener voltage few volts below the FET's maximum (see my earlier blogpost about reverse polarity protection). The rail then continues from Q1 to three bypass capacitors for the main op-amp. C1 is an aluminium electrolytic capacitor, C2 a large ceramic capacitor and C4 is not shown because it is supposed to be soldered directly between pin 4 and 5 of the op-amp. Use 0603 package and 100nF/100V with X7R dielectric. Schematic of the virtual ground (click for full resolution)

The voltage from the input terminals is divided by two thin-film precision resistors. Use at least 56k because if the polarity is reversed, some current will go through these resistors and the ESD diodes of the op-amp. Its value should be small (like 1 mA). The output of the resistor divider is one half of the input voltage, this, after being buffered, will be the virtual ground voltage. The output from this resistor divider is stabilized using capacitor C3.

The heart of the virtual ground is OPA548 – a high-end power operational amplifier from Texas Instruments (IC1). It is capable of continuously outputting 3 A. Its input voltage must be between 8 and 60 V so the virtual ground will be 4 to 30 V above the negative power supply. Since this is a linear virtual ground, the op-amp must be attached to a heatsink. With Fischer Elektronik SK 129 63,5 STS, the thermal resistance of the system should be around 5 K/W so the virtual ground will be capable of dissipating approximately 20 W. But I haven't tested it at this power dissipation.

The output of IC1 is buffered by two identical aluminium electrolytic capacitors – C6 and C7 – before entering the output banana receptacle. A snubber circuit aimed against oscillations is formed from a series combination of resistor R4 and capacitor C5. Two reverse-biased silicon diodes (D3, D4) protect the output of the IC1 against voltage spikes that often occur from inductive loads. A suitable diodes are MUR410 from ON Semiconductor. Fast recovery is a key factor here.

Finally, there is a green LED (LED1) with series resistor R5 indicating that the output is on.

### How to calculate power dissipation

It is simple: the virtual ground must drop one half of the input voltage, so the power dissipation is the input voltage, divided by two and multiplied by the current. Or – the output voltage in respect to the negative input voltage, multiplied by the current.

## Conclusion

The idea is simple, the execution likewise. Input protection, resistor divider and a unity-gain power amplifier with output protection. If you're going to build this, don't forget a good thermal grease between the heatsink and op-amp and maybe add some rubber feet to the bottom of the board.

You may want to consider thicker copper layer, such as 2 oz/sqft instead of the standard 1 oz/sqft.

Eagle project can be found on my Google Drive here and on GitHub.

## 2016/03/18

### USBuddy

Do you sometimes develop with USB? I do. So I need to access data lines, bus voltage and I'd like to easily monitor the current too. I made myself a small companion (43.5 mm × 22.5 mm, 9.5 g) to do that. Just a simple breakout board with one connector in and one out. And a little extra to make things easier. I call it USBuddy. USBuddy between host and device.

It has one pin header to break out all the lines plus one LED to indicate that the USB is on. And the current measurement system: It is a very simple system, just a current shunt resistor and a current shunt amplifier. I chose INA199B1 with 50 gain which consumes less than 100 µA. This allowed me to use a very small current shunt, just 20 mΩ. This means that at 0.5 A, I will be losing only 10 mV. And it also means that the output will be a convenient ratio of 1 mV = 1 mA. The current shunt has 4-wire (Kelvin) connection for more precise measurement.

But why stop here? Often, USB is used for charging at larger currents. The design allows for up to 4 A and 24 V. While putting more than 5 V on USB is typically not a good idea, the USBuddy is designed to handle that just well. USBuddy schematic
If you think this project can help you, you will find all the design files on my Google Drive and on GitHub.