- 1. Introduction
- 2. Temperature Chamber
- 3 Inductor measurements
- 4 Conclusions
Temperature can affect properties of matter in multiple ways. It can directly affect the volume (and density), the solubility, the chemical reaction rate, the diffusion rate, the speed of sound, the emitted thermal radiation and the conductivity among other things. Temperature also affects to different extents all electronic components and circuits, and for that reason they are usually rated to operate at defined temperature ranges. To make things more complex, with almost no exception, electric circuit or component will release heat during operation, affecting in this way their temperature. In this project I built a temperature chamber to study how temperature affects inductors.
2. Temperature Chamber
A temperature chamber is a chamber that can have its temperature set at desire. They usually use air, but I decided to use a liquid instead, and my two alternatives were water and mineral oil. Lets see how these 3 fluids compare to each other. Oil has the advantage over water that it's not conductive and won't boil at 100 ºC, but the drawback is that it's flammable with a flashpoint of >160 ºC, air on the other hand does not have any of these drawbacks. Probably more important are the thermal properties of the fluids, the thermal capacity and the thermal conductivity.
The thermal capacity is the amount of energy required to raise the temperature of an object or material. A high thermal capacity will make the temperature of the fluid "stiffer" lowering in this way the chance of generating high temperature gradients within the fluid. The volumetric thermal capacity is the amount of energy required to raise the temperature of a certain volume of a material, water has the highest with 4.2 J/ml·°K, followed by mineral oil with 1.34 J/ml·°K and air with 0.0013 J/ml·°K. Thermal conductivity measures the ability of an object or material to conduct heat, a high thermal conductivity will reduce the possibility of generating high temperature gradients within the fluid too, and also allow better transfer of the heat between the fluid and the probed electronic component. The thermal conductivity of waster is 0.58 W/(m·°K) followed by mineral oil with 0.138 W/(m·°K) and air 0.024 W/(m·°K).
In terms of its thermal properties, mineral oil isn't much worse than water and has the big advantage of being non-conductive, water could still be used but it would require water-proofing everything that is submerged into the liquid, so I finally decided to use mineral oil.
The complete system is made of 4 subsystems that needed to be built, the heating subsystem, the temperature measurement subsystem, the inductor probing system and the software, which implements the control system, the drivers and the visual interface.
2.1 Heating System
2.1.1 Heating Element
Ideally I wanted to build heating system that would quickly transfer heat to the fluid, to do so I relied on a large heating element surface-area-to-volume ratio, convection and thermal conductivity. The heating element was made by coiling a thin nichrome wire and then directly submerging it into the mineral oil.
The following photo shows main elements that form the actual chamber (except the LM358 which is shown as scale reference).
The beaker is the actual chamber that holds the mineral oil, the nichrome wire and the thermistor (more on that later). Since nichrome can't be soldered with tin, I mechanically clamped it to the wire with bolts.
2.1.2 Heating Circuit
The circuit is minimalist and generates a roughly linear non-pulsed voltage output (as a pulsed output disturbs the measurements):
The MCU-generated PWM signal is low-pass filtered (Fc = 4.8 Hz) and then amplified linearly with an op-amp and a FET to finally power a ~31.5 Ω (at ambient temperature) nichrome wire coil. The trimming pot and circuit power voltage were set to roughly generate a maximum voltage of 25 V, which can deliver ~19.8 W of heat to the nichrome wire. Of course, depending on the voltage output, a lot of heat is generated in the FET, so a heat sink and fan were used to keep it cool (*pun). As to why I used PWM and not the MCU DAC, the reason is that i get more bits of precision with the PWM.
The circuit without the heating element looks like this:
2.2 Temperature sensing
While there are digital temperature sensor, such as the DS18B20, I decided to take the analog route and use a thermistor instead. Thermistors change their resistance with temperature as defined by the Steinhart-Hart equation:
T is the temperature in ºK.
R is the resistance.
A, B and C are Steinhart–Hart coefficients.
Since I didn't have information about my thermistor, I characterized it to derive its coefficients.
2.2.1 Thermistor characterization
To derive the coefficients I heated the thermistor while recording its resistance at different temperatures and then mathematically solved the values.
I used a cooking pot that could keep the lab thermometer mercury column submerged all the time (for higher precision) during the heating of the thermistor. The left image shows a quick test that I performed to see how temperature affected the thermistor resistance. The right image shows how I applied hot glue to seal the thermistor and avoid current flow through water. Hot glue is easy to apply, and remove (with ethanol), but for this particular application it limited the maximum temperature that the chamber could be heated to, as hot glue melts at around 80 ºC.
The water was heated to 80 ºC and then slowly let it cool while measuring the resistance at multiples of 10 ºC. The measured values are shown in the plot:
To find the coefficients, only 3 measurements are needed, ideally, equally spaced and covering the temperature region at which the thermistor will be used at (ie: 20 ºC, 50 ºC and 80 ºC). Still, using more measurements can reduce the error even further and allow the evaluation of the quality of the measurements.
Each measurement can be written as a linear equation to form the following system:
Since I had 7 measurements I got 7 equations in the system for only 3 variables, which made the system overdetermined, and likely not having an exact solution. The alternative is to get an approximated solution, that is, coefficients that will roughly satisfy each of the 7 equations. I did this using the ordinary least squares method. If we write previous matrix representation of the system as:
The coefficients are computed like this:
In the following plot we can see how well the curve matches the measured data:
A better way to see how well the curve fits the measured data is to plot the error, the difference between the measured temperature and the curve temperature at the measured resistance:
The curve never got off by more than ±0.4 ºC.
2.2.2 The temperature sensing circuit
To measure the resistance I decided to build a voltage divider with the thermistor:
Large, as much as small R values reduce the voltage swinging of the divider, reducing in this way the temperature reading accuracy. To see how different R values affect the voltage curve I performed a few simulations with 8 common R values:
As it can be seen the resistances produce curves that cover different segments of the full ADC voltage range (0 - 3.3V), with a minimum 1.22 V swing for R = 1 kΩ and a maximum of 1.68 V for R = 3.9 kΩ. But there is a better selection criteria than the voltage swing range, and that criteria is the voltage derivative (dV/dT). The steeper the curve is (or lower the dV/dT is), the higher the voltage difference between close temperatures is. And higher voltage differences between the same temperature difference increase the precision of the ADC samples.
It can be seen that precision of the temperature readings varies depending on the resistor value, but also on the temperature. To get consistent precision in the complete 20 ºC - 80 ºC range I selected the 2.2 kΩ resistor, which has the lowest precision at 20 ºC (dV/dT = -20.1 mV/ºC), instead of the 3.0 kΩ resistor which has the lowest precision at 80 ºC (dV/dT = -21.0 mV/ºC), because the 2.2 kΩ resistor would allow me keep measurements precise if I later decide to use temperatures higher than 80 ºC.
2.2.3 ADC calibration
The ESP32 ADC ideally should have a linear response and cover the complete voltage range, but I found that its ADC is terrible! It clips below ~0.15 V and above ~3.15 V, is quite non-linear, noisy, but on the the bright side it can sample at ~89 ksps.
Here is an example the ADC capture of a slow (30 s) voltage rise from 0 V to 3.3 V:
The ADC value is an integer (12 bit) but was normalized to the 0 to 1 range. Since the divider never returns values below 0.15 or over 3.15 V the ADC is still useful if we calibrate it.
I used the following procedure to calibrate the ESP32 ADC:
- A 60 s period triangle wave from 0.3 V to 3.0 V s signal was generated with a signal generator.
- The generated signal was captured in parallel with the ESP32 ADC and with the Keithley DMM6500 (6.5 digit DMM).
- Both captured signals were resampled to the same rate.
- Cross-correlation of their derivative (which theoretically only takes two different values for a triangle wave) was used to compute the temporal shift.
- Both captured signals were sliced to a rising segment which, when plotted in an XY-plot show the equivalence between the ADC values and the voltage.
- Polynomials of different orders were adjusted to the curve and their error standard deviation computed.
- Based the error standard deviation I arbitrarily chose a polynomial of order 10, as above that value the improvement of the fit were minimal and likely the result of noise overfitting.
If we plot the calibrated ESP32 ADC voltage against the DMM6500 voltage, we get the following curve:
Which almost looks like a straight line. The voltage error is defined as the difference between the voltage measured by the DMM6500, and the ESP32 ADC. Lets take a look at the error before (left) and after (right) calibration.
After calibration the error gets in the worse case scenario as high as ±6 mV for an oversampling of 256 samples. At this level of oversampling we could get off by maximum of ±6 mV / -20 (mV/dºC) = ±0.3 ºC.
And here is as an example of how different a triangle wave looks after the calibration:
2.3 Inductor measurement
Measurements were made with a DER EE DE-5000 LCR meter, which comes with an IR port that can be used to record measured data to the computer. Since I don't have the IR cable, I built one using a phototransistor, a resistor and an FTDI board. The IR protocol has already been reverse engineered, it's made of 17 byte packets that contain the current settings of the meter and the current measurement readings. Packets are sent at roughly 2 Hz through a 9600 baud, 8N1 UART IR signal.
The circuit resistor value was roughly selected through trial and error, at high resistances, the voltage swing is high but the switching slow due to the Miller effect, on the other hand, at low resistances, the voltage swinging range may not be enough and the circuit may fail to reach the target logic level.
The whole circuit was built without any cables or solder, leads were tightened with Dupont crimps and then "encased" in hot glue:
2.4 Putting it all together to build the system
The following diagram shows how each component is integrated in the system:
The CPU runs a Python program that integrates a PID controller, which reads the chamber temperature and computes the output heating response to reach the setpoint temperature. The CPU also logs the setpoint temperature, chamber temperature, output power and LCR measurement time series into a file for later analysis. The ESP32 is controlled by the CPU to perform two tasks: generate a ~20 kHz PWM output to control the heating circuit, and oversample the thermistor circuit values. The heating circuit is powered by 32 V and cooled with a 12 V fan. The LCR meter is powered externally to disable its auto power-off feature. The following image shows how the real system looks:
2.5 The system architecture
The system got complex enough that I ended up using object-oriented programming (OOP) and spreading the code into multiple files. The main program implements the device drivers, the control system, the real-time text and graphics status output, and the data logger. The main program contains the following files:
Is the main program that besides using functions and classes from other files, implements the text and graphics real-time output and the data logger
Implements the serial LCR meter communication code, and the packet parsing and corruption/missing packet detection.
Implementes the PID controller.
Contains classes to generate either linear or stepped setpoint time series.
Contains functions that make numbers and units easier to "read" by using Système international (SI) unit-prefixes.
Adds functions to compute the Steinhart-Hart coefficients, the temperature and the resistance.
While there are a few robust methods to compute the optimal parameters for the PID controller, I ended up adjusting them manually because of time. The next image shows the real-time status output of the system, in text mode (left) and graphically (right). The green plot shows the setpoint time series, overlapped most of the time by the blue time series, which represents the chamber temperature; while the orange trace shows the power applied to the heating element. The bottom plot shows the data received by the LCR meter, which in this case was just the DC resistance of the inductor.
3 Inductor measurements
For the experiments I chose the following 3 inductors:
Which can be seen in the following photo with an HB graphite pencil as size reference:
I chose high inductance radial inductors, because they are easier to handle and their inductance is far above the inductance of the leads used to probe them.
To test the effect of temperature on the inductors I set the setpoint to 25 ºC for the first 15 min, then I raised it at a 1 ºC/min rate until it reaches 75 ºC, to finally I keep it at 75 ºC for 15 min. For every inductor I measured the inductance and ESR at 10 kHz, and its DC resistance. The LCR meter can measure the inductance and ESR at the same time, but not the DC resistance, so for every inductor I had to run the experiment two times.
Lets take a look at the temperature time series of the 6 experiments:
The temperature tends to overshoot a bit at the beginning but then tends to stabilizes until the setpoint begins to rise. Because of the way the PID operates, it takes some time to reach the setpoint temperature at the beginning of the temperature rise. Except for the bump at around 40 ºC (which appears to be caused by the ADC), the PID controller does a relatively good job at staying close to the setpoint until it reaches ~52 ºC, after that, some experiments show some oscillations around the setpoint temperature. The moment the setpoint reaches 75 ºC the chamber temperature tends overshoot a bit, again, as result of the way the PID operates. The reason oscillations occur at higher temperatures is because the system is non-linear, and the used PID parameters appear to be more tuned towards lower gradient temperature levels.
Lets take a look on the power curves:
Depending on the initial condition, a strong initial power spike attempts to make the chamber reach the setpoint temperature quick. To rise the temperature of the chamber at the specified rate, the same amount of power than the power that is lost to the environment must be injected, plus extra power that depends on the thermal capacity of the system and target temperature rising rate. At 75 ºC the system dos not need extra power, just needs to inject as much energy as the energy that is lost into the environment. The plot shows that the energy required to keep the chamber at 75 ºC is around 6.5 W to 7.5 W (depending on the environment temperature). If we consider that the system can inject almost 20 W of heat to the chamber, it is evident that it gives a lot of room to reach a much higher temperature or increase the temperature rising rate.
Lets finally see how temperature affects the inductors! The following image shows how inductance changes with temperature:
Interestingly the 3 inductor change their inductance in a very linear way but with completely different temperature coefficients (6.8 mH: 322 PPM/°C, 820 µH: 55 PPM/°C, 120 µH: 201 PPM/°C). The actual reason why this occurs is not clear to me, but its probably the result of an interplay of several factors.
Lets take a look at how temperature affects the AC (10 kHz) and DC resistance:
Except for the 6.8 mH inductor, the AC and DC resistances of the inductors are almost identical. Again I'm not sure why the 6.8 mH inductor behaves differently, but the 6.8 mH inductor has the biggest core and probably the highest amount of turns, layers and coil length.
To compare the temperature coefficients I plotted the resistance variation of the inductors:
All inductors appear to vary linearly with temperature, their temperature coefficient is also quite similar (~3300±250 PPM/ºC), which is very close to the temperature coefficient of copper (4000 PPM/ºC).
I had a great time developing the temperature chamber and then testing the inductors in it. What I probably enjoyed the most of this project was to build a control system and watch it regulate the amount of heat power injected to the chamber to make it closely follow the programmed setpoint.
As always things turn out quite different to what I initially planned. My initial plan was to program the chamber to follow a determined setpoint trace and manually measure the inductors, but after finding information on how the IR link of the LCR meter operates, I decided to automate the measurements. It also never was in my plan to "fix" an ADC, I never expected the ESP32 ADC to be that bad, at one point I was going to switch to either another MCU or an FPGA, but then I thought it couldn't be that bad to "fix" the ADC. It turned out that it was that bad! I spent quite a bit of time fixing it, I had to play with a lot of ADC tweaking parameters (which most of the times made things even worse) and signal analysis to figure out what was the best way to "fix" it. In the end I was able to improved it quite a bit, but still not enough to convince me to attempt to use it in any other future project (unless only very crude measurements are required).
Inductors, like any other real-world electronic component, behave in "non-ideal" ways and it was interesting to study how temperature affects the inductance and resistance. Now, understanding why components behave the way they do can be quite complex as there are many inter-playing effects, and its not always clear which of them are dominating the observed behavior.