Multi-decade dynamic auto-switching digital ammeter - Page 1
Forum section: electronics / projects

author: shaling
author_rank: Contributor
timestamp: March 28, 2021, 09:55:46 am
content: Hi,I've just finished building my own design multi-decade dynamic digital ammeter which you might be interested in. I use 4 different shunts with their own current sense amplifiers (INA190A3), then second stage pre-amps for comparators to switch the shunts off when at 2/3 of max output swing voltage of current sense amplifiers via very low resistance MOSFETs. I'm using higher current shunts to switch lower ones, so the threshold voltage is low. Hence the second stage amps for comparators. I use 16bit ADCs to read the voltage out from current sense amplifiers and comparators, and an Arduino which depending on the comparator voltage, decides which shunt voltage/current to display. I only needed to measure currents down to uA, so the smallest shunt is only 100Ohm. In theory, the accuracy should be on the level of tolerance in shunts, INA190 and ADC internal reference voltage, which is specified very well, but the precision is limited by the ADC read out rate which I have set very high at the moment and don't average so I capture the dynamic behaviour. Even so, the RMS on the uA range looks like <=1uA. I ordered an OLED which didn't arrive in time for this weekend, so I explored sending current measurements wirelessly using the Arduino and RFM69 transceiver. I use another Arduino+RFM69 as a receiver and print to serial. The Arduino is a clone of the Moteino on LowPowerLabs, so basically a small footprint Uno with pads for RFM69 radio. I wrote a simple python GUI to display real-time current over multiple plots of different scale from uA to As. I can get measurements at 85Hz through RF or 100Hz via direct (isolated) serial. I think I might just forgo the display. I split the circuit into modules in case it didn't work. So I have separate boards for power supply, current sense amplifiers, ADCs and opamps which might be useful in themselves. I did a mod to the original design to include a diode OR gate to get the correct switching topology, but this is included in the schematic and kiCAD project attached. Also attached is spreadsheet I used for calculations, Arduino and Python code.Feedback welcome.Thanks.

author: thm_w
author_rank: Super Contributor
timestamp: March 29, 2021, 10:29:33 pm
content: I like the auto-switching capability. Also the "simplicity" of just having 4 separate readings. It may be possible to add them together in software, but then you'd get into all kinds of offsets and calibrations..Have you tried measuring bandwidth or step response delay? I suppose BW would be limited by the INA190A3 ~50kHz.

author: shaling
author_rank: Contributor
timestamp: March 29, 2021, 11:09:52 pm
content: Good point on BW, but I can't sample the ADCs faster than 200Hz anyway, as there is a delay in switching between the four channels on each chip. I could use 4 separate ADC in continuous measurement mode for the INA190s and get the Arduino to use digitalRead on the HIGH/LOW comparator output to decide which voltage/current to display. Maybe get closer to I2C 400kHz BW. ADCs are on separate board, and got 5 boards of each module from FAB, so could make a second dual ADC board from spares. I've got a Picoscope on my wish list this month, so if I pull the plug, I could use its AWG to measure BW then.Got a nicer GUI now.

author: Anitech
author_rank: Newbie
timestamp: January 20, 2023, 08:10:14 pm
content: @shaling any new work added to this project?

author: shaling
author_rank: Contributor
timestamp: January 21, 2023, 11:23:24 am
content: Yes, some improvements, a second version so to speak.Rather than have each MOSFET bypass just it's own shunt, I bypass all the way to sink, so no need for diode logic gates for switching other MOSFETs on as well in a cascade as before..I've put in a Schottky diode in forward bias to limit the burden voltage to 0.4V during a stepped current pulse faster than the current sense amplifiers can respond. The INA190s have a propagation delay of order 10 micro seconds, so there is inevitably some lag in response, so the diode just limits this.I've added 10k Ohm shunt for nA range, but such high shunts are not recommended for INA190. So we'll see if that range is usable. Otherwise no need to populate that chain.I've used comparator ICs this time instead of building from opamps. Maybe better for driving the gates of MOSFETs.There are pads to place RF filers after each opamp and resistors around comparators to add hysteresis.Two board design with 4 layers each. Fast switching so I use 2 internal ground planes.The power supply is isolated as before, and I have a footprint for my own Atmega 1284P Arduino+RFM69 micro controller, but anything else can be placed here. Footprint is labelled.The ADS1115 ADCs are on board 2, so 16bit as before, but feed from current sense amplifiers also now go to micron controller footprint. So if an STM32 is used with 12 bit ADC, with oversampling, that would significantly up the sample rate as the ADS1115 are much slower than the bandwidth of the INA190s. So the ADS1115s don't have to be used.I have the boards made, just waiting a week for delivery of final components.I've been testing an earlier version of this design with 5V opamps with my oscilloscope, and driving square wave current waveforms. It works well. Just need RC filtering after the final opamps before the comparators.I've attached schematics, but will hold off on the full KiCAD design files until I've built this version.

author: Kleinstein
author_rank: Super Contributor
timestamp: January 21, 2023, 01:52:36 pm
content: The Shottky diode for protection would only work for 1 polarity. So for full protection there should be a 2nd anti parallel diode as well.This can work for the higher currents / low values shunts. For the 10 K shunt and maybe the 100 Ohm the current through the diode can be significant. Especially large shottky diodes have quite some leakage. The leakage goes up with temperature and can thus not easily be corrected or seen as part of the shunt.One could reduce the leakage with 2 diodes in series with a weak drive for the center. This way the diode to the signal sees near zero voltage.

author: Martinn
author_rank: Frequent Contributor
timestamp: January 21, 2023, 03:50:25 pm
content: Are you aware of the Joulescope?https://www.kickstarter.com/projects/jetperch/joulescope-precision-dc-energy-analyzerScroll to "How does the Joulescope work"It samples voltage/current with 2 MSPS and switch shunts within one microsecond.Very nice piece of gear, bought one and its in almost constant use since then. Now:https://www.joulescope.com/- Martin

author: shaling
author_rank: Contributor
timestamp: January 21, 2023, 04:36:31 pm
content: Kleinstein, not sure I understand your bit about "a weak drive" and "sees near zero voltage". Can you draw how that works please?I did put 1 micro amp through the device and add/subtract a diode, and that didn't make a difference to the current reading. So the leakage current at low burden voltage must be negligible for the diode I had at hand. I should only have ~30mV max burden voltage nominally, and during stepped responses, I don't really expect or care for accuracy. I would like to learn and implement a better design non-the-less. So I take your input.thm_w, I'm aware of the Joulescope and CurrentRanger. Both great devices, but this work is really just for teaching myself some electronics. I was afraid to buy such expensive gear (initially) with potential of blowing it, so at least my own design is repairable indefinitely.

author: Kleinstein
author_rank: Super Contributor
timestamp: January 21, 2023, 07:19:07 pm
content: With only 30 mV of burden and not much resolution just the diode may be OK. 30 mV is quite low with shunts spaces as 1:100.The way to reduce the leakage is shown in the part of a schematics for high resolution (6-7 digit range). Range switching in this case is with relays and no auto ranging.The OP-amp buffers the voltage and applies it to half the diodes. Normally the diodes towards the critical node see only the OP-amps offset. One may even opt for a lower values of R2 and higher current diodes (or rectifier) - in the final curcuit I have a 6 A bridge, though the input fuse is 2 A.The single MOSFETs for range switching alread provide a parasitic diode for the reverse direction - so in this combination the extra leakage reduction may not that much sense. So actually no need for a 2nd diode for the other direction. The highest current shunt usually needs no diode and is protected from a fuse alone. The diode is mainly for the 2nd shunt, as this sees the higherst power in overload.