CurrentDongle measurement report that became my personal torment nexus
Table of Contents
First of all, this article is being 100% rawdogged by a human being. I will not waste anyone’s time on reading some slop without warning.
The content I’m referencing is AI slop. https://github.com/cr1tbit/ADCurrentDongle_LabSession
The device⌗
The device was made by younger me, is actually quite usable https://github.com/cr1tbit/ADCurrentDongle
It’s actually pretty funny, one of my motivation was the fact, that official, passive GPIO-BNC converter costed around $25, which is very similar to cost per unit of my device. And it measures current. And also has GPIO-BNC conversion.
The principle is simple - Analog Discovery has 2 built-in programmable power supplies. One is negative, and won’t be used. The positive supply can be adjusted between 0-5v.
The supply is very noisy when low currents are drawn, so I added some pre-load resistors. Adding them will result in absolutely no negative drawbacks.
The board needs 20 min preheat before the measurements become accurate
Since Analog Discovery 2 works with 100MHz max, I assumed basic signal integrity rules will work well enough here. I never tested the impact of the manual switches on the signal though.
The relevant part of the schematic
30kHz low-pass filter guarantees that INA186 current amplifiers work inside their specification.
On my unit I mounted INA186A2 (x20) and INA186A5 (x500) - this increases the dynamic range of the measurement, this very much required when working with very low power MCUs.
An additional output toggle’able 2/20khz filter at output allows filtering some noise and work with lower sample rates.
In general, the board did it’s job. I could verify my MCU projects do take around tens of microamps of current.
Hey Claude, roast me⌗
Please, remember, this was just my side project. It went better than expected. But after doing the lab session, i found out about many mistakes, some trivial, some I would never think of.
1. INA186 is rail-to-rail, but noise goes beyond the rails⌗
Turns out while the INA has rail-to-rail output, if the signal is noisy, it sometimes goes beyond zero. This signal is lost, so averaging / low-pass filtering produces phantom current, when real average current is hidden in noise’s amplitude.
A simple fix would be seting the reference voltage to higher than 0V. Or even better, use the negative voltage supplied by analog discovery for INA’s negative rail.
2. Stuff sags and oscillates⌗
In some specific configurations, some random 13khz oscillation started appearing, which in turn adds noise to the measurements. The noise is averaged out, unless this small amplitude makes the signal enter non-linear range.
Turns out, that filtering analog signals is not only about the frequency response. Stages interact with each other, and it’s worth remembering about.
Conclusion⌗
Honestly, the board is not very well designed, but it still more or less does its job. Some other errors may contribute to a couple percent error, but it doesn’t really matter that much, when measuring for how long the device will last on battery.
I’ll keep using this device for articles I post next.