2015/12/11

MightyWatt: How to increase the maximum power dissipation

Sometimes, you just need a bit more power than MightyWatt can dissipate. There is one trick that can easily increase the maximum dissipation. If you test batteries, they aren't typically discharged to zero voltage. This can be exploited: If you put a power resistor in series with the load, it will take over some of the heat that will be dissipated during testing, leaving a smaller portion to the load.

Let's make an example: Suppose you have a lead-acid battery that you want to discharge at 8 A. The battery goes from 14 V to 9.5 V. That would mean 112 to 76 W, well beyond the maximum for standard MightyWatt. However, if you put a 1 Ohm power resistor (properly rated) in series with the battery, it will dissipate 64 W while producing an 8 V drop in voltage. The load will only have to dissipate the rest: 48 to 12 W. Thanks to the differential voltmeter, you will always have the accurate battery voltage when using 4-wire mode as well as the total power of the device under test.

Schematic of connection with power resistor


A suitable power resistor would be for example this one from Vishay: HL10006Z1R000JJ or this one from Multicomp: MC14668. The first one is 7 USD on Mouser, the second one 9 USD on Farnell/Newark. That's a pretty cheap extension of the power dissipation!

Typical shape of a suitable power resistor

Now, there are some important points about this approach:
  • Because the power dissipation is calculated simply as the product of voltage and current, you will have to tell MightyWatt that you are using a series resistance so it won't show overload. In the Windows control program, select Advanced => Series resistance and type the value of the external power resistor in the pop-up window. The load will automatically keep track of the true dissipated power in 4-wire mode. This value only affects the thermal management, nothing else. But be careful, if you put wrong value or you remove the power resistor later, it may lead to a damage of the load.
  • This only works as long as the power difference between charged and discharged state (start - end) is not higher than the MightyWatt rating. It is great for batteries but if you have to go all the way down to zero with the voltage, you will have to split the experiment (voltage ranges) into two or more parts.
  • The temperature coefficient and precision of the power resistor do not matter much. The voltage is measured directly on the device under test and current measurement is not affected either. Don't waste money on high-end power resistors.
  • There are power resistors in aluminium heatsinks that look like the one below. These have to be mounted on a large heatsink to dissipate the rated power. See their datasheet. These resistors cannot dissipate the rated power only with the small heatsink that is around them. 
  •  
Power resistor that has to be mounted on additional heatsink

2015/12/05

Current accuracy of MightyWatt

People sometimes ask me how accurate is MightyWatt. I made a lot of tests during the development stage but how does a production unit (revision 2.5) perform? When I got my new Keysight 34461A, I thought it is about time to find out…

If you want raw data, click here to get the full report (Excel)

MightyWatt with Arduino Uno


While MightyWatt has its own 12-bit DAC, it relies on the ADC of the control board, which is typically Arduino Uno. The ATmega 328P in Uno has a 10-bit ADC. The sketch oversamples it to 12 bits.

The setup was:
  • One standard MightyWatt 30V/10A/70W with standard terminals
  • Original Arduino Uno running firmware (sketch) 2.5.1
  • Linear laboratory power supply PSD30/3C, 30V/3A
  • Keysight 34461A multimeter on autorange, current measured in 3A terminals, 10 PLC integration

First, MightyWatt was calibrated according to the manual from 0.1 to 3A with 5 calibration points. Since I only had 3A power supply, the calibration range was up to that current.

Calibration constants let us calculate the current resolution offered by DAC and ADC. DAC and oversampled ADC had one LSB equal to 2.56 mA. Physically, the ADC LSB was 10.23 mA before oversampling.

Then, I set a specific current via the Windows control program and noted the current that was measured by ADC and the true current from 34461A.

MightyWatt set I, A MightyWatt measured I, A External ammeter I, A
0.1 0.101 0.0982
0.25 0.255 0.2494
0.5 0.500 0.4980
1 1.001 1.0001
1.5 1.498 1.4997
2 1.994 1.9992
2.5 2.495 2.4985
3 2.997 3.0080

So, what these numbers tell us? Let's calculate the relative errors from the true value in percents and absolute errors in LSBs. Because the ADC was oversampled, there are both physical (p) and oversampled (o) LSBs in the table.

Set I (DAC) error Measured I (ADC) error
1.83 % / 0.70 LSB 2.85 % / 0.27 LSBp / 1.09 LSBo
0.24 % / 0.23 LSB 2.25 % / 0.55 LSBp / 2.19 LSBo
0.40 % / 0.78 LSB 0.40 % / 0.20 LSBp / 0.78 LSBo
-0.01 % / -0.04 LSB 0.09 % / 0.09 LSBp / 0.35 LSBo
0.02 % / 0.12 LSB -0.11 % / -0.17 LSBp / -0.66 LSBo
0.04 % / 0.31 LSB -0.26 % / -0.51 LSBp / -2.03 LSBo
0.06 % / 0.59 LSB -0.14 % / -0.34 LSBp / -1.37 LSBo
0.08 % / 0.98 LSB -0.02 % / -0.05 LSBp / -0.20 LSBo

One thing is immediately obvious, the DAC performed better than the ADC. This is, however, no surprise. The DAC is a standalone chip of good quality with 12 bits of resolution while the ADC is integrated in a microprocessor with 10 bits of resolution. It was an unfair match to begin with.

However, the overall accuracy was pretty good, DAC did not exceed 1 LSB error and ADC too if you count the physical LSB as the LSB. It is also worth recommending not to operate the load below 1 % of the range. The relative error there was almost 2 % of set current and 3 % of measured current. Above this threshold, the accuracy quickly improved.

The root mean square of absolute error was 0.57 LSB for DAC and 1.29 LSB for oversampled ADC. That means the DAC was about 2.3 times more accurate than the oversampled ADC.

If you recalculate the relative accuracy to the full scale (10.5 A in real), the worst error was 0.024 % of full range for set current and 0.053 % of full range for measured current.

So, would it improve if we used Arduino Due?


MightyWatt with Arduino Due


Due has 12bit ADC already and with some averaging, we can get even better accuracy from it.

Besides the Due itself, the setup was the same as with Uno.

Again, MightyWatt was calibrated according to the manual from 0.1 to 3A with 5 calibration points. Since I only had 3A power supply, the calibration range was up to that current.

The LSB for ADC was 2.55 mA while for the ADC 2.56 mA, practically the same.

MightyWatt set I, AMightyWatt measured I, AExternal ammeter I, A
0.10.0980.09818
0.250.2490.2494
0.50.4990.4979
11.0011.00006
1.51.5011.4997
22.0011.9992
2.52.4982.4986
32.9982.9974

Comparing this with the Uno measurement, the true current was pretty much the same with the same set values. That was because the DAC did not change and it performed similar to the first experiment.

Set I (DAC) errorMeasured I (ADC) error
1.85 % / 0.71 LSB-0.18 % / -0.07 LSB
0.24 % / 0.23 LSB-0.16 % / -0.16 LSB
0.42 % / 0.82 LSB0.22 % / 0.43 LSB
-0.01 % / -0.02 LSB0.09 % / 0.37 LSB
0.02 % / 0.12 LSB0.09 % / 0.51 LSB
0.04 % / 0.31 LSB0.09 % / 0.71 LSB
0.06 % / 0.55 LSB-0.02 % / -0.24 LSB
0.09 % / 1.01 LSB0.02 % / 0.24 LSB

The ADC in Due is vastly superior to the one in Uno. With 16 sample averaging, as defined in the sketch, it is even better than the DAC. The root mean square error was 0.58 LSB for DAC and only 0.39 LSB for the averaged ADC. The choice for high precision measurements is Due.

The worst accuracy relative to full scale (10.5 A) was for both ADC and DAC 0.025 %.


Temperature coefficient

 

While the measurements were accurate at ambient temperature, things can change when they get hot. And electronic load is designed to be operated at high temperatures. I set 3 A and 23.3 V to get 70 watts of dissipated power, the maximum continous rating for the standard MightyWatt. The time constant for the whole load is about one minute so after 10 minutes, the load is in thermal equilibrium. The change in temperature was from 21 to 88 °C, as reported by the thermistor underneath the MOSFET.

At 21 °C, the current, as read by the 34461A, was 2.9975 A and at 88 °C it was 3.0080 A. Recalculating this to the temperature coefficient, its value was 50.0 ppm / W, or 52.3 ppm / °C. Interestingly, the temperature coefficient of the current sense resistor is 50 ppm / °C according to the datasheet.


Noise and stability

 

Not only one-shot accuracy is interesting, the noise in the measurement and its stability is important too. I tested the stability at 1 A set current and acquired 600 samples with the 34461A. The statistics is below:

Average current1.0003711 A
Standard deviation0.0000132 A
Relative standard deviation0.00132 %
Minimum value1.000331 A
Maximum value1.000416 A

MightyWatt was indeed exceptionally stable in the DC measurement. But what was the AC, or noise component of the signal? I set the load to measure AC current and the multimeter to acquire anything from 3 Hz to about 300 kHz, which is the upper range of the multimeter. The noise was then expressed as the AC/DC ratio.

MightyWatt set I, AAC RMS I, AAC/DC ratio
0.10.0002350.24 %
0.50.000140.03 %
10.000630.06 %
30.001670.06 %

Noise was low and again, the best measurement was when the current was above 1 % of the range. Just a note: a certain amount of noise helps the ADC on Uno with oversampling. A perfectly clean signal cannot be oversampled…


Conclusion or How to make accurate measurements with MightyWatt


  • Stay above 1 % of the current range.
  • MightyWatt performs very well with Uno but if you are looking for the very best accuracy that is possible, use Arduino Due or similar board with good ADC.
  • If you are making a lot of measurements at high power, consider calibrating the unit at the desired temperature. You can control voltage during current calibration and current during voltage calibration so it is possible to get a specific temperature. This will compensate for the temperature coefficient.
  • The calibration is only as good as your reference is. The ammeter and voltmeter should be, ideally, 10 times as precise as the precision you want from MightyWatt.
  • The internal reference voltage in the DAC can take some time to stabilize. It is a good practice to let the unit on for a couple of minutes before taking measurements. Most lab equipment accuracy is specified only after the unit has been turn on for a certain amount of time.

2015/09/10

MightyWatt as a Li-Ion charger

Introduction


MightyWatt electronic load can be used not only to test how a battery is discharged but it can also be used to charge the battery. In conjunction with a fixed-voltage power supply like a wall wart, MightyWatt can be turned into a USB programmable Li-Ion charger with CC/CV mode.
 
Typically, a Li-Ion battery is first charged by a constant current. When a certain voltage is reached, for example 4.2 V, the charger then keeps the voltage constant until the current drops below some pre-defined threshold. Then the charging process is considered finished.

You can use the MightyWatt in conjunction with a cheap fixed-voltage power supply to create such charger. By connecting MightyWatt in series with the battery and power supply, it will be possible to control the current (and voltage) while measuring voltage at the battery terminals. This is possible thanks to the differential voltmeter whose inputs can be at different potential than the power terminals.

Setting it up


First, be sure that you have a firmware version at least 2.5.1 and Windows control program 1.2.2.0 or higher (get it here).

So, how to do it? First, make the connection (Figure 1): Connect the positive terminal of the battery to the positive terminal of your power supply. Connect the negative terminal of the battery to the positive power terminal (PWR+) of the MightyWatt. The negative power terminal (PWR-) is then connected to the power supply ground. This signal ground will be also the earth ground because the PWR- is connected to earth via USB.

Now, connect the positive sense terminal (SENS+) to the positive terminal of the battery and the negative sense terminal (SENS-) to the negative terminal of the battery. In this way, you will be able to measure the voltage of the battery while controlling the charging current.

Figure 1: Connection schematic to create a programmable CC/CV Li-Ion battery charger.

Let's set the control software correctly now (Figure 2). In this example, I will assume that the battery should be charged with 1 Amp to 4.2 V and then kept at 4.2 V until the current drops to 50 mA.
  1. Safety first: Set up the watchdog. If anything goes wrong, the load will disconnect the battery. I have set the watchdog to stop if current exceeds 1.5 A.
  2. Set the remote (4-wire) voltage sensing.
  3. Define the constant current part of the charging process. I put 1 A for 3 hours (the time limit won't be reached so put something long here). Then define the skip conditon. That means this part of the charging will be terminated when the condition is met. I chose that exceeding 4.2 V will make the program go to the next step.
  4. Define the constant voltage part. It is important to set "constant inverted phase voltage", I will talk about it later. In my example, I will keep 4.2 V for 3 hours (it will finish sooner so once again, put some long time here) and terminate this part when the current drops below 50 mA.
  5. If you wish, set up logging and/or save the program items for future use.
  6. Hit the Start button, you're ready to go!
Figure 2: Setting of a CC/CV mode for battery charger. Watchdog is enabled for safety.

What is the "constant inverted phase voltage" all about?

 

The second part of the charging process requires the voltage to be kept constant. However, it is not possible to directly use the hardware implemented constant voltage because it has an incorrect phase for this application. Normally, the constant voltage mode assumes that by increasing the current, the voltage will drop. This is normal behaviour of most sources. But look at this setup: increasing current to the battery will actually increase its voltage. It is the difference of power supply voltage and battery voltage that is in fact decreasing. But we want to measure (and control) the battery voltage, not the power supply that is actually loaded. 

So the feedback has to be modified to a system where increasing the current will increase the voltage. In other words, the transistor in MightyWatt must open when the voltage is too low and close when it is too high. This is not implemented in hardware so the firmware must be called to help. In the mode named "constant inverted phase voltage" the firmware (Arduino sketch) will internally switch the load to constant current mode and then increase it when the voltage is lower than the set voltage or decrease the current when the voltage is higher than the set value.

The bottom line

 

With the new firmware and software, you can turn your MightyWatt (+ cheap power supply) into a great USB programmable Li-Ion battery charger! Use the special "inverted phase voltage" mode to keep the voltage constant in this setup. If you don't have the latest firmware and software, download it from the resource page. Don't forget to copy your calibration values.

2015/06/14

Building a 100 mA transimpedance amplifier

Introduction


A while ago, I wrote about zero resistance ammeter. The more common name for it is transimpedance amplifier. It is a device that converts current to voltage. So an ammeter really. But unlike the ordinary ammeter, transimpedance amplifier (TIA) has zero voltage drop across its terminals. To achieve that, it has to be an active device. The most simple form comprises of an op-amp in inverting configuration with a single resistor, RF, that determines the transimpedance gain. In reality, there has to be an additional capacitor, CF, to compensate for the op-amps input capacitance [Figure 1]. The output voltage is then V = -RF·I.
An excellent overview on this topic from Robert A. Pease can be found here: http://electronicdesign.com/analog/whats-all-transimpedance-amplifier-stuff-anyhow-part-1.

Figure 1: The principle of transimpedance amplifier.


The big advantage of TIA is that is has zero voltage drop on its terminals so it does not affect the circuit being measured – unlike a regular multimeter. Also, regular multimeters tend to be much less precise on current measurements than on voltage measurements. Using a precision current to voltage converter, you can increase the precision of measurement and not influence the measured circuit at the same time!

When one range is not enough


If you need more gains (ranges), then you can place a switch in series with the resistors. It is a good idea to have a make-before-break (shorting) switch so you don't interrupt the flow of current during switching. The switch, however, adds uncompensated capacitance and series resistance. This limits the use of semiconductor switches because their capacitance is typically higher than the capacitance of mechanical and electromechanical (relay) switches. Switch resistance will produce a measurement error which increases when the value of gain resistor decreases. It is possible to use a double throw switch and use the second part to sense the voltage drop before the current enters the first part of the switch.

Powering from a single supply


To have a bipolar ammeter on single supply, you will need another op-amp for biasing. This op-amp needs to be as fast and as powerful as the first one. Remember, the op-amps will be sourcing/sinking the same current you are measuring.

The prototype

 

The design idea

My design [Figure 2, 3] uses two OPA567 power op-amps in non-inverting configuration supplied from a single cell li-ion battery (RCR123A). One of the op-amps is held at bias voltage of 1.25 V (from a series voltage reference). The second is controlled by OPA320 in such a way that its voltage creates zero potential difference between the sense terminals. The reason for using OPA320 is that its input offset voltage is very low. Both OPA567s are used only for their high current capabilities. This configuration also enables easy remote (4-wire) sensing which elliminates the input cable resistance [Figure 4].

The current passes through precision (0.1%) resistors, the switch and two protecting PTCs. The voltage drop across the precision resistors is multiplied by two using an instrumentation amplifier INA333 referenced to the 1.25 V node. This amplifier isolates the voltage output so any loading of the output terminals does not affect the TIA's operation. The output voltage range is ±1 V so the voltage drop across the precision resistors is 0.5 V maximum. The remaining 0.75 V can be (although not entirely because the OPA567 cannot swing to exactly zero) sacrificed on other resistances, particularly the two PTC protection fuses and cables that will connect the TIA to its source.


Figure 2: Complete schematic of my transimpedance amplifier.

Figure 3: Finished prototype. The range is switched to 1 V = 1 mA. Green LED on the left indicates battery OK. Red LED on the right would indicated an overload.


Figure 4: Testing the input offset voltage. At 102.9 mA (range set at 1 V = 100 mA), the input terminals were 30 µV apart.


Safety and monitoring


Output is ESD protected by high-speed TPD2E001 diode array and 100R series resistors. Inputs are protected by series resistors (sensing) and PTCs (power). Battery input is reverse-polarity protected and also has a PTC and a TVS.

A microprocessor (ATTINY24A) monitors the battery voltage, output voltage of the instrumentation amplifier and output voltages of both power op-amps. Firmware controls whether the battery is OK and the output voltages stay in the device limits so there will be no clipping of the signal. Two LEDs are controlled by the micro: One shows the battery charge status and the other indicates overvoltage. The overload LED control is latching so it will be visible even when the overload has low duty cycle.

If battery voltage drops below 3 V, the LED will shine red, if it drops further to 2.7 V, the LED will blink and the microprocessor will shut down the power amplifiers because they will no longer be guaranteed to deliver enough power. At this voltage, the device effectively shuts down. Going below 1.8 V will disable the microprocessor as the brown-out detection will trigger. That means the LED won't blink any more and the device will be "dead". The battery monitoring system has some hysteresis built into it so the LED does not change its color wildly.

Thermal protection is built in the OPA567s and the microprocessor also monitors this and will indicate overheat using the red overload LED.

A mechanical switch physically disconnects both battery and one of the inputs so no current can flow when the device is unpowered.

Device parameters


The bandwidth is approximately 10 kHz, above that the THD starts to rise. The maximum rated current is 100 mA. With active cooling and different switch, up to 1 A will be reasonable. Minimum current range is 1 µA because the switch has 6 poles and I am using decadic ranges. Lower current ranges will be also reasonable but the input bias current of INA333 is 70 pA so 100 nA would be the lowest high-precision range. Remote (4-wire or Kelvin) sensing is enabled by a mechanical switch and is there to compensate for cable resistance. The quiescent current is 16.2 mA so the maximum runtime on 650 mAh cell is 40 hours. But it will depend on how high the measured current is. The device must supply the same amount of current as is being measured so at the maximum (100 mA), the runtime on single charge would be about 5.5 hours.

If you are interested in the design files, all resources can be found on my Google Drive.

2015/06/07

MightyWatt 2.4

New features and improvements in version 2.4


MightyWatt electronic load is constantly evolving. Version 2.4 comes with a LED that will indicate the passage of current through the load. Or anything else, because its behaviour is defined (and re-defined) in the firmware. MightyWatt used to have LED indicating overheating in the early versions. Because the unit never overheated during operation in the specified range, the LED has been removed. Now it's back and can be used for any purpose.

There are two new capacitors forming a low-pass filter on the current and voltage measurement circuits. This can increase the stability of the load in certain situations but the capacitors should be populated only when you experience instability.

The terminal block can be made in pluggable version with 20A maximum current. This is not really a change because the PCB stays the same. If you're going to use this version, make sure you have the terminal without the side walls so it fits without problems.

2015/03/26

SAM4S development board

SAM4S development board

There is a ton of development boards on the internet and I'd like to share my own. This time it's for Cortex-M4 from Atmel, the ATSAM4S in 0.5mm pitch 64-pin LQFP. The board is also good for any pin-compatible processor, such as SAM3S. I use ATSAM4S8B-AU, a 120MHz processor with DSP functions, 512 kB Flash and 128 kB RAM.

The board is not the smallest or cheapest one but it has been proved to work (it's revision 3.0 after all) and has all the necessary stuff without useless BS. It is programmed via JTAG or (micro)USB.
The pitch between the two pin headers is 1.6" and fits many larger breadboards.

The DevBoard

 

Features

  • All I/O pins routed to pin headers.
  • 12MHz crystal oscillator.
  • Fully ESD-protected USB.
  • Power supply either externally or from USB. Routed via 0.5A Schottky to 0.5A 3.3V LDO. TVS protection on the 3.3V line.
  • Precision 2.048V voltage reference can be connected via jumper, when disconnected, external voltage reference can be applied.
  • Reset button and erase jumper.
  • Full 20-pin JTAG header for connecting programmers like SAM-ICE.

 

Schematic and board

You can download Eagle schematic and board from my Google Drive. The board can be ordered from OSH Park for something under 20 USD per three boards.

Complete schematic of the development board

2015/03/21

MightyWatt resource page

This page contains the most up-to-date resources for MightyWatt. 

 

New version R3 available on Tindie with its own resource page here! If you have version 2 to 2.5, continue using this page for resources.

 
Click here to view Google Drive folder with all the resources.

 

Resources also available on GitHub.


 
Please, contact me if you find a bug or have a software request.

Latest hardware revision: 2.5

Latest sketch (firmware) version: 2.5.9 (2.5.9 calibration)

Latest Windows control program version: 1.3.1.0

Warning: You will need FW 2.5.7 or higher for Windows client 1.3.0.0 and higher.


Guides

Detailed guide: All you need to know for calibrating and running MightyWatt.
Case assembly instructions: If you have the original acrylic layered case for MightyWatt + Arduino Uno or Arduino Zero (M0/M0 Pro), these are the instructions on how to assemble it.
Communication protocol description: If you wish to use your own PC-side control program with the original sketch, this guide has information about the communication protocol which is used by MightyWatt.
Booster pack guide: A guide for the official Booster pack accessory. Increases the maximum power dissipation with a power resistor.

Arduino sketches 

Main sketch (firmware): This is the program that runs in Arduino. As of version 2.5.7, it is compatible with Arduino Zero (M0/M0 Pro), Uno and Due boards. Please note that on Due boards, it is necessary to solder its AREF (BR1) jumper to EXT (external).
Calibration sketch: Use this for calibration of MightyWatt.

Schematic and board 

Eagle: Schematic and board plus a PNG image of the schematic.

Bill of Materials

PDF file: List of all the components you need to make MightyWatt.

Windows control program

Complete C# project: A PC-side program that controls MightyWatt. Program has manual control, advanced measurement programs and data logging. The executable is located in C#/bin/Release/MightyWatt.exe
Changelog: A file containing description of changes to the Windows program.

Charts

Excel macro: A macro-enabled workbook that can import data from MightyWatt Log File and automatically update it, thus showing charts in real-time.

Calibration aid

Excel spreadsheet: Calculates the calibration values.

Acrylic layered case

SVG drawing: Contains drawings of the layers. Numbers in parentheses indicate how many layers are needed for one case.


 

How to update to firmware version 2.3.1 (and higher) and Windows program 1.0.1.1 (and higher):


Windows program version 1.0.1.1 (and higher) is only compatible with firmware version 2.3.1 (and higher). It is, however, possible to upgrade any 2.0 or higher board to this version. You will have to modify the calibration values though. Download the new calibration aid and copy the source (measured, ADC and DAC) values from your old calibration aid to the new calibration aid (or make a new calibration). You will get a set of new values which you will put into the new sketch. Also, don't forget to comment "#define ZERO" and "#define DUE" and uncomment "#define UNO" line in the sketch. I recommend reading the Detailed guide.