Posted on Leave a comment

A2D 64CH Data Acquisition (DAQ) Board

A few years ago, I made a PCB to aid in measuring a bunch of thermistors for some thermal testing on battery modules. I’m finally getting around to creating some documentation for it so it can be helpful for others as well. I previously showed this board in the JLC PCB Assembly post.

Store link for the board.

The purpose of the board was to measure a bunch of thermistors. The battery module we were measuring had 50 cells in it, so 64 measurement channels seemed to be a good number to target. The first version was to be created with a perfboard, so all the ICs used had to be available on breakout boards. I’ve used the ADS1115 in the past for other projects. With 4 channels, 16-bit measurement, and an internal reference, it fits the use case perfectly. Adding a CD4067 16-channel multiplexer to each of the 4 inputs, we have the capability to measure analog voltages on 64 channels. Each thermistor needs another resistor for a voltage divider, and a capacitor for an RC filter on the board.

The board has the capability for digital I/O, as well as analog input on every channel. An analog output is not available as this would require a DAC at each channel since it is not possible to easily multiplex a DAC.


The full schematic for the board is available here: (link).

The input structure for each channel was designed specifically to require no external components to connect a thermistor. Digital I/O is handled by the TCA9539 I/O expanders, which are set up with a 3.3k resistor in series with the I/O expander going to the screw terminal. This means that any digital I/O channels have a 3.3k series resistance on its line. All channels share a common ground point, available at every channel’s screw terminals.

The screw terminals are 2.54mm pitch, best used with 22AWG solid core wire. Stranded wire with ferrules are difficult to get small enough to fit the opening. Each channel has a GND terminal directly beside it for easy connection of a thermistor.

Board dimensions are 97.6mm x 149.8mm. 4x M3 holes on the board for mounting are located 4mm from the corners of the board. The upper left screw near the USB connector is located 20.5mm from the top edge of the board. A 3D printed board mount is available here.

The board requires only a 5V power source, and can be powered entirely from the Micro USB port. The onboard LDO converts the USB input voltage to 3V3. An external 5V power input port is available via the screw terminals, and can be plugged in at the same time as the USB since it is diode-or’ed on the board. This means the higher voltage of the USB port or the external power port will provide the current for the board, and neither source will be back-fed from the other.

How to Connect To:

Analog Input (ADC)

This board can measure analog signals in the 0-3.3V range, with 16-bit resolution using the ADS1115 ADC. The 64 channels are in groups of 16 channels which pass through a CD4067 16:1 multiplexer and are passed to one of the 4 inputs of the ADS1115. These 4 inputs are multiplexed internally in the ADS1115 to a single 16-bit ADC. The multiplexer control lines are connected together, so if selecting channel 0 on the multiplexers, then channels 16, 32, and 48 are also available at the ADS1115.

There is a 1k and 100nF low pass filter before the multiplexer, and then a 100Ohm and 10nF low pass filter after the multiplexer. When switching which channel to measure, ensure to wait for the 100Ohm and 10nF filter to settle before reading. This should take 5 time constants, or 5*100*10e-9 s = 5us. The I2C command to trigger a conversion likely takes longer than this to start the conversion, so an explicit delay may not be required, but it is good to note.

Thermistor (Analog input extension)

The 3.3k resistor in series with the digital IO lines may have seemed like a weird choice, until you see that thermistors can be connected to this board without any extra components. Simply connect the thermistor across the channel’s screw terminal and the adjacent ground screw terminal. Set the TCA9539 to output a digital 1, which pulls up the 3.3k resistor to 3.3V and acts as the top resistor in a voltage divider with the thermistor across the screw terminals. A 3.3k resistor was chosen in this location to give the best resolution at the ADC in the range of temperatures that are often seen in electronics (room temperature and up to about 70C) when used with a 10K NTC thermistor. The recommended thermistor is an NXRT15XV103 as it gives good resolution when paired with the 3.3k pullup for the 20-70C temperature range.

Analog Output (DAC)

Not available on this board.

Digital Input

Digital input, with 0 to 3.3V logic, is available through the TCA9539 I/O Expander. Note there is a 3.3k resistor in series with the signal before the input is read, which may affect the output.

Digital Output

Digital output, 0 or 3.3V, is available through the TCA9539 I/O Expander. There is a 3.3k resistor in series with the signal before the output. This may be good for a MOSFET’s gate drive if you want it to be pretty slow, but make sure to not create unintentional voltage dividers with this resistor which will affect the output.


The firmware controls the IO expanders, ADC, and multiplexers on the board. An A2D DAQ class was created which creates instances of the classes for the ADC, IO expanders, and multiplexers. The examples in the class provide a SCPI control interface, which uses to A2D DAQ class to provide communicate to the low-level communication with the ICs on the board.

Software / Interfacing

There are instructions in the readme of the repository linked above about how to read voltages and temperatures of many different inputs, and log to a CSV file.

In the lab_equipment/ file, there are SCPI commands to communicate with the DAQ. Digital I/O, as well as analog input is available through the SCPI interface.

When first connecting to the DAQ, you will need to provide a config file to tell it how all the inputs are set up. This config file should be in the same format as provided example config files in the lab_equipment directory. The ‘configure_from_dict’ function in lab_equipment/ defines what happens for the available input types. If you will use any analog input functions for a channel, the Voltage_Scaling header must be present, and if any thermistors will be used to measure temperature, you must provide their Steinhart-Hart constants. To get the Steinhart-Hart constants from a lookup table or Beta model, this site is very useful:

Posted on Leave a comment

Dell Laptop Battery Degradation

Recently, I got a laptop battery from a Dell laptop about 5 years old. Battery life was down to about 1hr instead of about 8hrs when new. The battery in the laptop was replaced with with a new one and I took this one apart to test the cells and see what the cause of the low battery life reported on the computer was.

The pack is a dell YRDD6, rated at 3500mAh, 11.4V, so we’d expect to find 3x 3500mAh cells.

The cells all measured slightly above 4.2V straight from the pack. They were fully charged in the laptop and then were sitting for a few days before testing, so a failing cell with high self-discharge current was not the issue.

Testing was completed with a python program I wrote to control lab equipment for battery testing, and the test used 4-terminal sensing. For more details on the equipment setup and control, see an earlier blog post here (link).

1st cycle: discharge to 2.5V at 1A
2nd cycle: CCCV charge, 4.2V, 1A, end current 50mA. discharge to 2.5V at 1A

The discharge capacities are shown in the table below. All the cells still seem to be fairly well matched in capacity, so a single cell failing with low capacity does not seem to be the issue. The cells are pretty close to the typical end-of-life of 80% of original capacity, all just above that mark.

Next was an internal resistance test. If a cell or the pack had a high internal resistance, this could trigger the low voltage cutoff of the BMS when the pack is under load.

Cell 1 seems to have a slightly higher internal resistance than the other cells, but there is nothing to be concerned about here. The rise in internal resistance at low SoC is typical for any battery, new or old.

If the power draw of the laptop hasn’t changed significantly from when it was new, then there is no reason I see for this battery to only have a 1hr battery life now. 8hrs of battery life when new (100% SoH), should translate to over 6hrs of battery life now if we based the calculation only on capacity. Somewhere, we’re losing an extra 5hrs of life – extra power draw by the laptop, conservative battery management systems, or a higher low-voltage cutoff could all contribute. My own Dell laptop has started to give me battery warnings as well so I might replace that one soon and see what the issue with that one might be.

Posted on

Battery Testing with Standard Lab Equipment

Standard Lab Test Equipment: PSU, Eload, and DMM

Testing batteries is important in many different contexts and in different levels of complexity.

People re-using lithium batteries from laptops, power tools, and other sources may want to do a quick internal resistance and capacity test to verify the state of health, but likely don’t care about in-depth characterization or incremental capacity analysis. This group will probably not bat an eye about a 5% measurement error from their equipment.

On another hand, anyone looking to analyze effects of various charge or discharge protocols on battery degradation, or creating an equivalent circuit model of a cell to calculate heat generation or verify performance of a product will want as much data as they can get about the cell. This group could include student design teams at universities with a relatively low budget, looking to get the best efficiency from their Solar Car battery pack, or the highest power from a Formula-E pack. Companies looking to develop a product need to understand the performance their battery can provide to their device, or developing a state of charge or health model will want the best data they can get without breaking the bank.

At the extreme end of the spectrum, battery researchers will pay $100,000+ to get the best test equipment possible to ensure their breakthrough materials are better than the state-of-the-art, and not merely a figment of tester inaccuracy.

Battery Test Setup with RIGOL DP832A Power Supply and DL3021A Eload
Battery Test Setup with RIGOL DP832A Power Supply and DL3021A Eload
Battery Test Setup with Rigol DM3068 DMM, Siglent SPD1168X Power Supply, and BK Precision 8601 Eload
Battery Test Setup with Rigol DM3068 DMM, Siglent SPD1168X Power Supply, and BK Precision 8601 Eload

Battery Test Program

Over the past few years, I have been developing a program targeted towards that middle group – people looking to get accurate battery data for a purpose other than battery material validation. The program, with setup instructions, is available on Github:

Battery Testing Program by A2D Electronics, set up for 4 battery channels
Battery Testing Program by A2D Electronics, set up for 4 battery channels

The goal is to control standard electrical test equipment (power supplies, electronic loads, data acquisition, custom boards, etc) to charge and discharge battery cells with various test protocols to get anything from a simple capacity test to a comprehensive battery characterization. This is meant to be a widely applicable general-purpose structure for performing battery tests. Below are just a few examples of what can be done with it. All graphs and data used below are generated from my own results using this program.

1: Cycling Capacity

This is probably the most asked-about characteristic of batteries by the general public – how long does it last? Not only for a single charge, but also about the retained capacity after a few years of cycling. By cycling a cell repeatedly and calculating capacity for each cycle, this is relatively easy to plot, though it takes a long time to run the tests.

The graph below was generated by cycling an LG 21700 cell. There is a general downwards trend in capacity, as expected when a cell is cycled. Various constant discharge currents were applied throughout the cycling, which gives the jumps and discontinuities in the graph, as large discharge currents generally lead to increased internal losses and thus less discharged capacity.

LG M50LT Cycle Life Testing
LG M50LT Cycle Life Testing

2: OCV vs SoC (Open Circuit Voltage vs State of Charge)

By setting the charge and discharge current to very low values (e.g. C/25: a full charge in 25 hours), it is possible to accurately measure the voltage during charge and discharge. The OCV-SoC curve is then taken as the average of the charge and discharge voltage for every SoC point. This curve is the basis for many battery characteristics, as it represents the chemicals inside the cell being in equilibrium. It is important to note that in reality, the chemical reactions inside the cell do produce different voltage characteristics when charging compared to discharging, so this approximated curve is not perfect.

LG M50LT Open Circuit Voltage vs State of Charge Characterization
LG M50LT Open Circuit Voltage vs State of Charge Characterization

3: Measuring DC IR (Internal Resistance)

An internal resistance test can be conducted via a 2-pulse current method, where 2 different currents are applied to the cell and the voltages are measured. The difference in voltage and current between the 2 pulses are used to calculate the DC internal resistance. If there are enough data points in the voltage measurements, they can be extrapolated to the start of the current pulse. This is done because the current pulse discharges the cell, which changes the OCV, so the measurement includes voltage changes from 2 sources – the change and the current flowing over the internal resistance. Extrapolating the voltage measurement back to the start of the pulse removes OCV portion of the voltage change for a more accurate measurement. Note also that a good 4-point (remote sense) test setup is required to obtain a good internal resistance measurement.

Extrapolating voltage measurement back to start of current pulse in DC Internal Resistance measurement
Extrapolating voltage measurement back to start of current pulse in DC Internal Resistance measurement

4: IR vs SoC (Internal Resistance vs State of Charge)

The internal resistance test can be used as a single spot test of internal resistance but does not give the full picture of a cell’s performance. It is commonly known that the internal resistance of a cell changes with SoC, as well as temperature. As a cell is being discharged, different current pulses can be applied and the internal resistance measured at each step in current, across the whole state of charge range. The measurement matches the datasheet specification for the LG M50LT, 23±6mOhm DC internal resistance at 50% SoC.

LG M50LT Interval Resistance vs State of Charge Characterization
LG M50LT Interval Resistance vs State of Charge Characterization

5: ICA (Incremental Capacity Analysis)

Incremental capacity analysis (ICA), otherwise known as differential capacity analysis (dca or dq/dv), is commonly used to assess state of health as well as identifying degradation methods. It looks at how much stored capacity is available for each small increment of voltage. Using the work done by DiffCapAnalyzer in The Journal of Open Source Software, incremental capacity analysis can be added to the suite of tools relatively easily.

LG M50LT Incremental Capacity Analysis during OCV-SoC Characterization Test
LG M50LT Incremental Capacity Analysis during OCV-SoC Characterization Test

Equipment Recommendations

Getting started with testing batteries can be quite an investment if going for high accuracy and powerful equipment, but to do the basics you don’t need much. A cell holder is required to connect to the cell, and a power supply and electronic load are required to charge and discharge the cell. Expect to pay around $800 to $3,000 per battery channel you want to test if purchasing everything new. This is a large investment, though there will be some custom hardware coming (see below) that aims to drop this cost significantly. Here are a few non-exhaustive recommendations. For each list, cheap options at the top and the features get better and more expensive as you go down the list.

When choosing equipment, it is important to note that for accurate test results, equipment with remote sense is required. Without remote sense, the measured voltage will include the voltage induced in the cables between the equipment and the battery. Remote sense allows the equipment to measure the voltage with an extra pair of wires directly at the battery terminals instead of at the equipment terminals. A higher current will create a greater voltage drop in the wires from the equipment to the battery, so remote sense is especially important for high current tests. Generally, cheaper equipment does not have remote sense. Often, the remote sense terminals are on the rear of equipment, though occasionally easily accessed from the front. Equipment with no remote sense is marked with ‘No RS’.

All equipment is listed cheapest first.

Cell Holder

  1. A plastic clamp (non-conductive) and some wires – you might already have this around the workshop
  2. A2D Electronics 4-wire cell holder (link) (RECOMMENDED – though I am biased since I made it)
  3. Dedicated cyclindrical cell holder (link)
  4. Metal cylindrical cell holder (link), or higher power version (link)
  5. Gamry, Arbin, Biologic, or Neware (or other test equipment company) cell holders

Electronic Load

  1. Korad KEL102/3
  2. Rigol DL3000 Series (link), Siglent SDL1000X-E Series
  3. BK Precision 8600 Series

Power Supply

  1. Korad KA3005P (No RS)
  2. Rigol DP700 Series (link) (No RS), Siglent SPD1000X Series, Korad KWR102/3
  3. Rigol DP800 Series (link), Bk Precision 9103/4
  4. BK Precision 9200B Series

What’s Next?

Temperature Control and Thermal Chambers

Everything varies with temperature. So far, the program does not control the temperature but only measures it. Given that pretty much all battery characteristics including internal resistance and OCV vary with temperate as well as other factors, being able to control the temperature is extremely important for accurate battery testing.

Custom Hardware

Test equipment and cell holders are expensive, especially for high quality equipment. Testing multiple batteries at the same time is often required to speed up testing and stay on track of timelines, which requires considerable investment in a large number of individual power supplies and eloads, or prohibitively expensive lab-grade multi-channel equipment from companies like Maccor, Arbin, Biologic, Neware, etc. Some custom electronics and other hardware are in the works that aim to remove this cost barrier to getting actionable data on real cells for teams and individuals that don’t have huge budgets. A few things I’m working on are below.

  1. Cell holders that cost less than $15 each but still provide all the required features for adjustability and remote sense are one of the first things that I’ll get started with. Purchase the cell holders here when in stock!
  2. A board that will allow automated sharing of test equipment between batteries. This will allow a power supply to be connected to 1 battery to charge and an electronic load to another battery to discharge. Once the charge and discharge are complete, it will automatically switch the batteries to the opposite piece of equipment to complete the next stage in the cycle. This system will reduce the cost of test equipment for multiple battery channels by half (plus the cost of these boards).

    A2D Electronics Relay Board Prototype
    A2D Electronics Relay Board Prototype
  3. A system of boards to replace the dedicated test equipment. This will include ADCs and precision amplifiers for voltage, current, and temperature measurement, a precision reference, as well as power electronics and control strategy to manage current flow to and from a central DC power bus. This test system will also greatly reduce the physical space that is needed to run a battery test system with many channels compared to dedicated test equipment for each channel, as well as being significantly cheaper than existing solutions. Isolated voltage monitors will be available as well, to evaluate performance of a BMS or to evaluate cells within a pack without disassembling the pack and testing cells individually.
Posted on

Automated DC-DC Converter Efficiency Testing

If you’re into electronics and you’ve ever considered using the cheapest DC-DC converters you can find for any kind of serious power delivery, you’ve probably wanted to see if they’re actually capable of delivering the power that they claim. You may do a quick test with the actual load to check if the converter shuts down or not.

Taking a step up from there, when you get further into power electronics design, testing DC-DC converters under a variety of input voltages and a variety of output currents has probably come into your mind at some point. Depending on how determined you were to get it done, you may have found some resistor banks and measured input voltage and current, and output voltage and current with multiple input voltages and loads. This would give you a pretty good picture of the efficiency of the device under all operating conditions, but takes a long time to set up and do the test.
Or maybe you’re designing a new converter for a board and wondering how accurate the efficiency graphs of given in the datasheet are for the specific components that you ended up choosing (different inductors, FETs, or diode for non-synchronous converters) can make a large difference in the efficiency if chosen improperly.

To get those efficiency graphs under a variety of conditions, I created a python script to run through all input and load cases with a programmable power supply and electronic load.
The script in my Test Equipment Control repo will run through as many combinations of inputs and outputs, then the will present all the results as a typical efficiency vs load current graph.

Test Setup

To get the program set up it walks you though with a simple GUI.

  • Choose which power supply to use
  • Choose which eload to use
  • Choose to use an external voltage measurement device (or use the power supply or eload for input and output)
  • Select a location to save the log files
  • Enter a name for the test – will be used to generate a name for the log file
  • Enter all the test settings
    • min, max input voltage and number of steps
    • power supply current limit
    • min, max output current and number of steps
    • delay between each step to allow transients to settle and device to come to thermal equilibrium

Note – the steps above are as of writing this, I may have updated the program since then.

Test Results for a few converters

Fully isolated 150V to 12V DC-DC converter

This was a dc-dc converter designed with a Vicor power module for the solar car design team I was a part of throughout university.

24V to 3.3V converter (Diodes Inc AP63357Q)

Using my Rigol DP832A power supply, DL3021A electronic load, and DM3068 multimeter, I was able to characterize a small low-voltage converter that I designed:

Remote sense setup to measure the voltage directly at the terminals of the converter to remove any contributions of the wires in the power loss:

Test setup showing the Rigol DL3021A, DP832A, and DM3068 and remote sense connections. The multimeter is used for a remote sense on the input terminals:

Test Results:
In the graph produced, we can see that it handled peak load current of 3A was handled without issue. We also see the efficiency decrease with higher input voltage as expected from the datasheet’s graph. This particular converter was set up for a 3.3V output voltage by changing the feedback resistors.

Comparing this efficiency graph to the datasheet’s given efficiency graph, the efficiency I measured is slightly lower. This board is using a 3.3V output and 6.8uH inductor (same inductor as the 5V versions I made), so it is expected that efficiency will be a little lower. Other sources of inefficiency would be not choosing the optimal inductor for the application  – considering core losses, heating losses, etc. The datasheet graph would have been generated using an optimal configuration of inductor characteristics. Inaccuracies in the measurement setup from noise and calibration of the equipment also add some uncertainty to the values that I tested.


Future Plans

I plan to add some more features to this script including:

  • Plotting the line and load regulation (possible with the data already collected)
  • Add connection to scope to test the load transient response automatically

Here’s the link to the github repository:

Posted on

Battery Cycle Testing with Python, and E-Load, and Power Supply

Update May 16, 2023 – see here for a newer post with a better overview and details.


A  lot of electronic loads (my Rigol DL3021A included) have a built-in ‘Battery Test’ function, either on the front panel or able to set up through the load’s accompanying software (See here for an overview of my lab hardware). This works fairly well if you’re just trying to run one cycle, but when trying to run multiple cycles you need to control the charging cycle as well. Keysight has the BenchVue software which allows coordination of multiple instruments together in drag-and-drop scratch-like scripts, but to get the full control over the cycles and parameters, you’ll want to control your instruments over SCPI with Python.

I’ve been wanting to test out some LG MJ1 cells for upgrading an old NiCD drill battery, and figured I’d take the opportunity to write a basic battery cell cycling program that I’ll be able to expand on in the future.

Before we dive into specifics though, I will preface with mentioning that I am not a firmware of software programmer by trade or by schooling, only out of necessity and interest – I can write code that works, but is not optimal. I know there’s a lot that could be done better and/or cleaned up in the code. If you want to contribute, send me a message and have a look at what I’ve got on Github!

Program Features

Basic GUI

While I am fairly familiar with command line tools, its always nice to have a GUI. Python makes that super simple with TKinter and EasyGui. A simple, linear flow of operations through popup windows is easy to implement, but in the future, having a full-featured program would be nice. A few images of the GUI screens are shown at the bottom of this post, but are not all that impressive – just the basic options provided.

Storing Test Settings to JSON Files

The settings for each charge and discharge cycle can be stored to a JSON file for easy recall for future tests.

Choosing Test Equipment

When setting up a test, it is good to be able to choose whatever equipment is available to you. The program has been set up to select whichever instrument series and visa resource is available to you.

While SCPI commands are supposed to be standard between equipment, there are a fair number of differences across different models for the more obscure features such as remote sense, front panel lock, and other such features. They often use different SCPI commands to activate these features, so I created a python class for each instrument will all the command specific to that instrument.

Multiple Test Choices

There have often been times where running different cycle types have been useful. There are multiple options for different types of cycles built in:

  • Run a single cycle at a set voltage, current
  • Run multiple cycles with the same settings for a set number of times
  • Run multiple cycles with 2 different settings for a set number for each cycle type and test cycles (e.g. discharge at 5A, charge at 2.5A for 1 cycle, then discharge at 10A, charge at 5A for 9 cycles, then repeat 5 times for a total of 50 cycles). This can be helpful for degradation testing and measuring capacity with a standard cycle at fixed intervals.

Storage Charge Option

Every test setup will ask if you want to charge the cell to a storage level as well. Leaving cells discharged after a capacity test can accelerate the degradation of the cells, and can lead to increased dendrite growth causing latent failures in the cells. Charging back up to a storage voltage (around 3.7V for li-ion cells) is always a good idea.

Data logging and Discharge End Detection

The discharge is finished when the cells reach a defined voltage in the test settings. The monitoring of this end condition can be improved quite a bit from the current implementation.

The data (voltage at current) is measured from the eload and power supply at the interval defined in the test settings. It compares these measured values to the end points, as well as logs them to a csv file. With this method of logging at a fixed interval and comparing to setpoints, we will over-discharge the cell at the end of the cycle if the actual voltage of the cell reaches the setpoint at the middle of an interval. I hope to improve the algorithm to attempt to match the curve of the cell during discharge, and predict the time that the cell will pass the threshold. Then turn off of the electronic load at the calculated time instead of waiting until the next measurement interval.



Now for the interesting stuff. This has allowed me to do some long term cycle and degradation test for the Solar Car battery modules for the University of Waterloo. Eventually I’ll get around to making a proper summary of that data, but for now here’s a few cycles that I’ve done on some of the Samsung 25R cells I’m using to replenish an old NiCd power tool battery pack. They look pretty similar except for different state of charge at the start of the tests due to some other testing I was doing. These graphs are all spit out of another python program which also summarizes results such as capacity in Ah and Wh, final charge voltage, actual minimum discharge voltage, and max cell temperature if there was a thermistor also attached.

It is interesting to note that all the cells seem to still drop in voltage during the rest period after the discharge. I expect there may be some leakage current in the power supply or eload that is drawing them down – a problem for another day. For now, I’ll make sure not to leave them sitting overnight.

Posted on

Standing Desks from Frame kit and Plywood

About a year ago while working from home, I decided it was time to invest a little bit in my setup and get myself a standing desk. This page goes through a few of the decisions I made along the way and the general process I followed to build one.


When I started looking it to getting a standing desk, I broke it down into 3 solutions:

1 – Buy a Complete Desk Frame and Top: this is fast but more expensive

2 – Buy a Desk Frame and Build a Desk Top: fairly quick and less expensive, you only need to cut down a finish a desk

3 – DIY Everything: more time to design and build and might be cheaper in the end

I went for option 2 – I bought a desk frame since I found one fairly cheap and wanted to have a standing desk in a reasonable timeframe (within 2-3 weeks). I built the desktop since I wanted to still be able to call the desk my own and I wanted to make it as big as possible to fit in my space at home – so I wanted a custom size.

Being someone that likes having a lot of desk space, I decided to make 2 desks and configure them in an L-shape. This gives enough desk space for multiple monitors, notebooks, and some electrical equipment. As I’m still in university and moving around a bit, having 2 desks made it easier to reconfigure for different living arrangements. In the 3 different locations I’ve had them set up since building them, they’ve been able to fit without issue.

Once built, I got the desks setup in my basement with dual monitors and some electrical equipment.

I should mention – I would not describe myself as an woodworker by any means, so take my suggestions with a grain of salt.

Making the Desk Tops

In my opinion, the cheap IKEA desktops are not worth it – they’re just veneer on chipboard, and are not very sturdy. Building your own gives you a much sturdier, solid piece of wood.

I bought a 3/4in thick piece of 4’x8′ maple-finished plywood from Home Depot for about $75, cut it down to the sizes I wanted for my 2 desk pieces, rounded the edges with a belt sander with 50 grit sandpaper, then sanded the edges with 120, then the whole thing with 220 and 400 grits. 400 grits at this point was likely not worth it, just got

I also made a cutout with a hole saw and a jigsaw in the middle of the desk at the back as an easy passthrough for cables.

Sealing the Desk Tops

For the protective coating, I used a Varathane water-based polyurethane sealer and stain in one, and did 4 coats of it with a light sand with 400 grit sandpaper in between coats. I picked the water based sealer since from what I read, it was pretty easy to work with – doesn’t stink, and dries quickly. From the quick research I did, oil-based stains and finished are generally harder to work with, and not worth the time for beginner woodworkers.

I did all that sanding/staining in my backyard over the course of 10 hours or so (with 2 hours between coats). Overall, the process was fairly easy, just required a bunch manual labor when sanding – which I was happy to get some exercise from.

Choosing A Desk Frame

I purchased the cheapest electric sit-stand desk frame that I could find. I figured they were all pretty much the same and likely come out of the same manufacturing plants anyways. At the time I made these, this was a $240 frame from, which I  bought 2 of for my 2 desks. These are pretty sturdy (they do wobble a bit if they are at the standing height and you’re doing some heavy erasing) and have a huge range of adjustment. Super easy to assemble, and easy operation with simple up and down buttons.

Assembling the frame and the desks was fairly straightforward, and screws to the desk top with with 8 wood screws. I just screwed them directly into the plywood as I’m not expecting to need to disassemble it much, but using screw-in threaded inserts is also a good option to get slightly more permanent threads.

Posted on

New Lab Setup – Rigol and Electro-Meters

A few months ago, I started to be on the lookout for some better test equipment – an oscilloscope, multimeter, electronic load, and power supply. These would allow me to create a few projects that I’ve been thinking of doing for a while and didn’t have the right tools to get started. I had grown tired of borrowing equipment from various places and wanted a set for myself that I could use whenever I want.

Before we move on, a huge thanks to Electro-Meters for helping out with the equipment upgrade! I reached out to Electro-Meters, the local distributor for Rigol equipment, and they were willing to provide a discount in exchange for mention on these project logs and images of the products being used in my projects over the next little bit. They were great to deal with during the whole process! Check out their selection of equipment here.

What equipment to buy:

I do quite a bit of work with batteries, so having a power supply and electronic load to charge and discharge the batteries is a must. These are also super helpful for testing power distribution circuits and DC-DC converters. A multi-channel power supply (or 2 power supplies) was a requirement as I often find myself wanting to charge a battery and do something else at the same time.

A good DMM was also on the list as I need one that I can trust. I was getting tired of using the cheap handheld ones and trying to guess at what the voltage or current actually is. A few reasons for the upgrade from handheld to bench meters are below:

  1. For batteries, even a few tens of millivolts difference can make the difference between them being fine to connect in parallel or if they need to be balanced first.
  2. Keep other instruments in calibration. A 5.5 digit meter would have been good enough for typical battery or hardware debugging, but a 6.5 digit is even better for keeping power supplies in calibration.
  3. Fast measurement speed – when you’re testing voltage on 100 batteries, the fast measurement speed (Ability to change the NPLC count) of a bench meter makes everything a lot faster.
  4. Automating testing with a Python over SCPI. This enables automatic testing such as generating the efficiency curve of a DC-DC converter under different loads through a single python script. Remote sense inputs on the PSU/e-Load or extra DMMs are required to eliminate cable loss from the measurement.

Last but not least, an entry-level 4-channel oscilloscope can help debug the majority of bugs that may be encountered during bringup of a new board.

What brand to go with:

I wanted to go for some reliable equipment that wouldn’t break the bank but would also last a while and be fairly capable entry-level equipment.

I didn’t have much confidence in any of the cheap Aliexpress-style brands as I had seen way too many teardowns of them and don’t trust the quality. While it is often stuff that can be fixed pretty easily (noisy fans, cables too small, not enough mains isolation), I didn’t want to have to deal with it and wanted this equipment to be a tool and not a project.

Here in North America, Keysight equipment is generally regarded as some of the best test equipment, but it gets pretty expensive. A 6.5 digit multimeter would set you back about $1500.

I’ve used several BK Precision electronic loads and switching power supplies in the past, and have no complaints about them. They are solid pieces of hardware, and work great, but still a bit too expensive for me.

Rigol and Siglent are generally regarded as entry level test equipment, and they make a great product for the price, but on my student budget it was still a bit expensive.

The other reason I was swayed towards Rigol equipment was the reports of it being easily hackable through the activation codes to unlock extra accuracy and bandwidth capabilities. A few guides linked for the Oscilloscope here and the e-Load and power supply here. As most of the guides online mention, it was pretty straightforward to make these upgrades.


I purchased the following equipment at a discount from Electro-Meters:

  1. Rigol DS1054Z 4-channel Oscilloscope (Upgraded with protocol decoding and 100MHz bandwidth)
  2. Rigol DL3021 Electronic Load(Upgraded to DL3021A)
  3. Rigol DP832 3-channel Power Supply (Upgraded to DP832A). Remote sense is not available on this model, but having the DMM handy makes accurate measurements easy.
  4. Rigol DM3068 6.5-digit Multimeter

After upgrading the Electronic load and power supply, the characteristic color screens (as opposed to the single color displays on the non-A versions) were shown after a reboot. When you consider the added accuracy, they are a pretty good deal.

I’ve been spending some time setting up the SCPI commands to interface with these a get a full battery cycle test going, and will make a post for that soon.

Posted on

JLC PCB Assembly Service – First Time User Review


JLC PCB started an assembly service a while ago and I’ve been hoping to design a PCB to use it at some point. I started designing a PCB a while ago – the schematic went quick and then kind of forgot about it for a few months. The PCB is a 64 channel Data Acquisition Unit meant primarily to measure a large number of thermistors, but can also be used as a general digital I/O board.

Board Details

The board is not too complicated – pretty simple, but I wanted to try out a few different things, as well as making it as easy as possible to make and program. I used some chips with varying packages – QFN, TSSOP, and some 0402 passives. I chose a 4-layer board to keep it easy to design and have dedicated power and ground planes for easy layout. I chose ENIG as the board finish mostly because the gold just looks really good. I also put the A2D logo in the corner of the board in copper (remove the soldermask in this area) and kind of wanted this in gold.

As the design software, I used EasyEDA – not because I wanted to use it but because I didn’t want to spend the time to create all the component libraries in Altium. Its also really well integrated with LCSC (a chinese component supplier) and the JLCPCB order service (they are pretty much the same companies just different names for different divisions I think).

I ordered 10 boards with the following specs:

  • 150mm x 100mm outline
  • 4-Layer
  • 1-oz copper
  • ENIG finish (Electroless Nickel Immersion Gold)
  • Green Soldermask (required for the JLCPCB Assembly Service)


The Good

  1. The price – total was around $170 all shipping and import fees to Canada included
    • $65 for the boards
    • $53 for components and assembly
    • $23 shipping via DHL
    • $28 DHL import charges on arrival
  2. Really nice board finish – silkscreen, soldermask, and ENIG finish looked great!
  3. Boards worked – no shorts, etc.
  4. Assembly quality was great – no issues here 0402s and TSSOP packages were great! (QFNs were out of stock so I had to order those from Digikey and assemble it myself).
  5. The boards came packaged really well. I only have components on 1 side of my board, and they packaged them back to back and wrapped in the pink antistatic bubble wrap.

The Not-so-Good

  1. The sides of the board were a little rough – the panel removal left some material on the edges. Nothing that a bit of sandpaper can’t fix, and I can’t really complain for the price that the boards were.
  2. LCSC didn’t have some components in stock or low in stock, so I had to solder a few components myself after the boards arrived.
  3. There were some parts of the silkscreen that were cut off (the RESET at the top of the board). JLCPCB in the past used to be pretty good at catching things like this. I can’t fault them for this since it was my design mistake and I didn’t catch it.

Overall, for quick-turn prototype boards, I can highly recommend JLCPCB. Just make sure that you’ve designed your board and exported Gerbers properly – they will make exactly what you send them. The integration with LCSC makes it super easy to purchase components when you design it in EasyEDA but would require a litt

Posted on

Interfacing the 32-Channel ADG731 Multiplexer with the LTC6811 Battery Stack Monitor

Lots of people put guides online with simple steps to explain how to connect to and get data from ICs using a development board. Usually, the process in pretty simple. But for more complicated ICs, you’re not always that lucky. The first connection often takes some debugging. This is not a ‘simple guide to connect devices’ but rather a more careful look through the datasheets and debugging that is not often documented online. Engineering often has times when you’re looking for a needle in a haystack – or that 1 line in the 100 page datasheet that explains your problem. This post aims to document some debugging, which is much easier when you know that datasheets are not scary and measuring stuff is fun!

As part of the Battery Management System for the Midnight Sun Solar Car team at the University of Waterloo, I have been working on getting the external communication interface of the LTC6811 Battery Stack Monitor IC to interface with a large number of thermistors. We need to measure 2 thermistors for every group of 25 parallel cells on our battery pack as well as 1 ambient temperature sensor for every 2 series groups. The many ambient sensors are placed throughout the pack in an attempt to quickly identify spikes in ambient temperature that could be indicative of a cell venting. This adds up to a total of 30 thermistors per LTC6811 chip, plus a thermistor on the PCB for the balancing resistors.

An image of the battery modules is shown below:

To measure all of these thermistors, the external communication interface on the LTC6811 was used to communicate with the ADG731 32-channel analog multiplexer. The output of the multiplexer connects to one of the GPIO pins on the LTC6811 to be read as an Auxiliary analog input to the chip.

Testing and debugging this interface turned out to be a little trickier than planned. As usual, the answer was in the datasheets.

Let’s first get a bit of background on the ICs.


Datasheet for LTC6811-1:
Many images in this document are from the datasheet.
The LTC6811 is a 12 channel battery stack monitor by Analog Devices. It features 12 independant cell measurement inputs, and dedicated cell balancing pins. Communication to the chip happens over SPI, or by using the LTC6820 ICs an isolated isoSPI interface can be implemented. Also present an external communication interface that can be used to send either SPI or I2C commands to external devices. This is the external interface that is used to communicate with the ADG731.


Datasheet for ADG731:
Many images in this document are from the datasheet.
This device is a 32:1 channel analog multiplexer, control with a CLOCK, SYNC, and DATA signals. It mentions that the interface is compatible with SPI (but there is a catch here – read on). The mux has an internal shift register which shifts data in from the DATA input on the CLOCK signals.

When connecting it all up and reading the Auxiliary analog inputs on the LTC6811, garbage data was observed, and probing around with a multimeter proved that the pin was indeed floating. So it seems the ADG731 output was never enabled.
All the hardware connections were double-checked with a multimeter to ensure proper connections and no shorts. Still no output, so  attention was turned to the firmware. Looking through the driver that the team (UW Midnight Sun Solar Car Team) had put together for it, a missing Packet Error Code CRC calculation was found in the WRCOMM command, and the COMM register byte order mistake were both fixed. A logic analyzer was used to check the communication interface to ensure that the LTC6811 was actually outputting data at this point, and it all seemed fine (or so I thought). Note that the SPI decoder in this image is set to SPI Mode 2, which is what the ADG731 would be reading.

Time to do a deep dive into the datasheets

Two pieces of info were found that Identified the problem:

1: The LTC6811’s external communication interface operates in SPI Mode 3. This means that the clock idles high, and data is shifted out on the falling edge and sampled on the rising edge of the clock (

2: The ADG731 shifts data into the input shift register MSB first, on the falling edge of the clock.

From this information, the LTC6811 external interface is not directly compatible with the ADG731 since the data shift phase is opposite. The LTC6811 will be shifting out new data  as the ADG731 is reading the bus. Looking at the logic analyzer output above, it can be confirmed that different data is sent from the LTC6811 than is received with the ADG731.

Fixing the Communication

Looking at the waveform on the logic analyzer and double checking on the oscilloscope, I figured the clock signal of the LTC6811 SPI Mode 3 interface could be inverted to achieve a waveform that would successfully clock data in to the ADG731 Input Shift register in the correct order. Essentially, this would turn the interface into SPI Mode 1 for the ADG731.

A simple circuit using a transistor and some pull-up resistors could be used to achieve this clock inversion. I had some 2N3904s on hand, but no small FETs so I went with that. The LTC6811’s GPIOs are open-drain. Just to be sure, as mistakes are often made in small analog circuits, I fired up LTSpice and made the schematic to make sure I wasn’t out of my mind. The circuit simulated as expected and we got an inverted signal on the output.

This trace of the CLK line shows the rise times on the inverted clock are a bit long, but a less ancient transistor and an SMD footprint should make them look a little nicer due to the reduced parasitics. The long GND lead on the oscilloscope probe is also likely playing in to some of the error here. We do see the important parts though – we have 8 clock cycles to shift the data in, and they rise above the 2.4V logic high threshold of the ADG731.

Connecting up the logic analyzer once more, the output was now correct. Here, switch 5 of the ADG731 is activated. The SPI decoder in this image is in SPI Mode 1, which the ADG731 would read correctly.

Here’s an image of the test setup and probing – yes, its messy and eventually I’ll get some better tools and equipment to make this all neater – but for now, this is all there is:

Some useful data was finally received through the microcontroller. I had connected some thermistors and fixed resistors to the mux inputs and measured the correct voltage values.


The datasheet is always right. It often amazes me how much information is stuffed in there, and that they manage to get all the relevant information across without mentioning silicon structure of the chips or anything like that – block diagrams are all they need.

The external communication interface and GPIO Auxiliary input pins of the LTC6811 was used to successfully read 32 thermistors through the ADG731 analog multiplexer.

Posted on

Design and Build of Prototype Battery Module

For the Midnight Sun Solar Car Team (, I have been designing a building a prototype battery module. This module must fit in to the pack to be modular, safe, easy to manufacture, easy to assemble, and have low power loss.

This module will be a 24P 2S module, made up of a variety of materials and sections. This was made so that all of the access points for the terminals will be on the top of the modules and we will not need to reach any tools into the bottom in order to put the pack together.

Layer stackup:

  • Gusset Plates (red and black) and Fuse Board
  • Top Section:
    • Acetal Cover Plate (Laser Cut)
    • Electrical Grade Vulcanized Fiber (Fish Paper) Insulation (Laser Cut)
    • EMS Sigma Clad 60 Busbar (Water Jet Cut)
    • Nickel Strips (3D Printed Bending Dies)
    • Acetal Cell Holder (CNC Machined)
  • Cells and Aluminum Standoffs
  • Mirror Top Section for Bottom

Mechanical Considerations:

The module has an acetal plate on the top and bottom with pockets to fit the cells and hold them in place. In order to avoid relying on the friction between the cells and the acetal plates holding the modules together, there are aluminum standoffs connecting the plates together. M3 bolts go into the top and the bottom of these standoffs to clamp the pieces together.

Above the acetal plates, we have a laser cut piece of fish paper that is used to cover the busbar and provide isolation. And above that fish paper, there will be another acetal plate to provide extra isolation protection and a more durable module. Since the fish paper is susceptible to water damage, this will also help to minimize the water that the fish paper comes in contact with during assembly/handling.

The red and black pieces on top of the module are gusset plates that will support the vertical busbar connections that will connect the modules in series.

Electrical Structure:

We wanted to minimize the total resistance of the high current path in order to minimize the power loss.

The material of choice for the high current carrying busbars (eliminating superconducting materials from the options) is copper, due to its low resistivity. Unfortunately, due to this property, copper also is difficult to attach to the cells. Resistance spot welding – the most common and cheapest method of battery assembly for hobbyists – requires the material to have a high(er) resistance in order to generate the heat to weld the material together when passing current through it. To solve this issue, we are using nickel and stainless steel clad copper from Engineered Material Solutions (EMS). This allowed us to use a resistance spot welder to connect the cells and the busbars, as the stainless steel provides a higher through-plane resistance – with the copper still providing very low across plane resistance. The other downside of having the copper in the material is having a high thermal conductivity, which wicks the heat of the weld away. With our spot welder, the K-Weld, we were not able to get consistent welds on the 0.3mm thick EMS material for more than 10 consecutive welds. Because of these issues, we switched gears and threw some nickel strips in the design. These connect the cells to the busbars, and allow a low weld energy to be used. The lower weld energy also increases the safety of the cells because there is less electrolyte that evaporates (causing internal impurities and thus eventually internal shorts) inside the cell – this info came from a post on the electricbike forums ( The power loss from adding the nickel strips in was calculated to be negligible compared to the power loss due to the internal resistance of the cells.

The votage taps for measuring the voltage of each cell come off of tabs on the busbar. These connect to fuses and resistors on the voltage tap breakout board. The resistors will help to limit the current in the case of a short and will help to spread out the heat from the balancing resistors. The fuses will blow if anyhting bad happens. This breakout board on the top of the module connects to the voltage taps through a Molex MicroFit connector for easy disassembly in case the replacement of a fuse is required. These connectors are protected against offset installation and ‘scooping’ which could connect the wrong cells to the voltage taps – a very important feature. Having the fuses and the connector on the board enables us to switch to a distributed BMS if we choose to in the future, having the voltage measurements happening at the cells instead of on a centralized Analog Front End (AFE).


This was the fun part where I taught myself MasterCAM to program the 2.5D double sided tool path to machine the acetal plates the hold the cells in place. The Haas VF2 in our university’s machine shop made light work of the acetal.

Water jet cutting the busbars from EMS Sigma Clad 60 and the making a 3D printed die for bending the nickel strips into shape.

The top and bottom acetal insulation plates were laser cut using the Epilog Helix cutter at the University.


The whole assembly process was thought through and designed into the part, so that it all went together fairly smoothly, save for 1 part. The holes in the acetal capture plates were made so that the cells fit snugly when inserted individually. The problem comes when you are trying to put 48 cells in at the same time. It took quite a bit of force provided by c-clamps and distributed with pieces of wood. Eventually it went together, but the holes on future versions will definitely be increased in size. The burrs on the waterjet busbars made it difficult to slide the terminal connectors on them, so we ended up soldering them on for this rev and will order thicker terminal connectors for future revisions. All the red and brown wires you can see coming off the cells are thermistor wires that we attached for thermal characterization of the battery modules.

And now we have our first finished battery module prototype! Stay tuned for the results of thermal characterization and further testing.