| Electronics > Projects, Designs, and Technical Stuff |
| High speed, high dynamic range current logger for emdedded debugging (we did it) |
| (1/1) |
| Oleg Artamonov:
Hi everyone Recently we (www.unwds.com, don't bother, its in Russian anyway) started to look for decent current logger for low-power embedded system debugging and battery life prediction. The problem is, we needed something like * max 10 us acqusition period and min 50 kHz bandwidth, otherwise it will miss short events * min 10^7 dynamic range, from 1 uA (sleeping MCU) to a few amperes (2G modem at full power) * cheap, to put it on every developers' table and make them use it Obviously, $50 SiLabs devboard is not an option (we have some, but 6 kHz sampling rate and 50 mA max current...), Keysight N6705B is nice but is not something I'm ready to put on every table in the office. CurrentRanger seems nice, but overpriced and some specs and technical details (mostly related to software) are unclear for me — it is Arduino based, so I'm not sure about actual performance and latency. Long story short, we build it. Specs: * 3 us sampling rate, 50 kHz analog bandwidth * over 10^7 dynamic range with 3 switchable shunts — 0.1 uA to 3 A; ranges are overlapping and there's some hysteresis * 10 us typ, 20 us max shunts switching latency * 40 mV maximum burden voltage * onboard 2.0...3.5V (in 0.1V steps) 3A DC/DC supply * external power supply up to 18V * supply voltage measurements (useful for testing battery powered systems with real batteries) * onboard LCD with uA max, mA*h accumulated and mW*h accumulated * USB interface and power * USB CDC (virtual UART) console with time, average voltage, average current and accumulated energy reporting every 10 to 1000 ms (user selectable) * UART-to-USB bridge for DUT console/bootloader/etc. * SWD/DAPLink interface for DUT programming * BOOT and RESET signals for DUT control/programming * matchbox sized (37×50 mm) * $50 retail price The very first version (back in December 2018) used INA214, so specs were worse, but after taking some preorders and ideas and playing with prototypes we changed schematics (price rose a bit, but its still reasonable). As for now, it consists of: * OPA2376 + LM7705 "true zero" amplifier (LM7705 provides low-noise negative supply voltage, so we don't care about "rail-to-rail" being actually "20 mV apart from rail") * 0.01 Ohm, 1 Ohm and 100 Ohm shunts, 0.1 % low-ppm resistors * IRLML6344 or IRLML2402 MOSFETs for low-current shunts, IRLHS6242 (14 mOhm @ 3V Vgs) for 3A shunt * low-side current measurements (so we don't need expensive instrumentation amplifier) * 47 MOhm + 4.7 MOhm voltage divider for voltage measurements (so parasitic leakage is less than 0.1 uA @ 3.6 V), buffered by OPA2376 * ST1S10 DC/DC (I really love it, I failed to kill a single one of them in all the years I use them), output voltage set exclusively by 16-pos rotary switch, so you can check voltage before even powering it * TXB0304 for UART and SWD interfaces (fully symmetrical, unlike TXB01xx and most other level shifters) * TIC33M LCD display * STM32F042K6 CPU (32 KB flash, 6 KB RAM, 48 MHz, crystall-less USB) Some choices were based on components availability from local distributors, because we were in a bit of a hurry to build it, still, actual specs are very pleasing. Anyway, we don't want to compete with Keysight, we needed reasonably priced and reasonably working device for everyday use. Firmware is based on dap42 SWD-DAPLink project, sources are free and available at https://github.com/unwireddevices/dap42/tree/umdk-emb (build target is UMDK-EMB, you'll need arm-none-eabi-gcc + make), main file is https://github.com/unwireddevices/dap42/blob/umdk-emb/src/stm32f042/umdk-emb/target.c (I know, it's 995 lines of code, I promise, we'll split it... someday). The whole thing is based on libopencm3. ADC triggered by hardware timer and uses DMA with 200-words circular buffer, range switching is based on ADC analog watchdog feature. Buffer is being read twice every cycle, when half-full and complete full, so no data is lost during processing; when switching ranges, data accumulated prior to switching are processed and then DMA is resetted. Voltage is measured once every 10...1000 ms (same as reporting period), so a few current sample are missing here. Basic functions (power on/off, display mode, target boot mode, SWD on/off) are accessible via hardware buttons, but there are UART console commands too, so it can be controlled by some script or application running on PC. UART console is ASCII-only, no binary data, so it can be used on any OS with regular RS232 terminal. Anyway, we wrote a simple logging application for PC/Windows. Can be used without PC connection, e.g. if you need to check real-world power consumption of some device, just power it from USB adapter, leave it for a week and then check how much milliampere-hours DUT gobbled (extremely useful with "send-data-once-a-day" IoT devices like water or electricity meters). Drawbacks: * doesn't have crystal, so without PC connection timings are not exactly accurate (±4 % at 25 °C); with PC connection, it syncs with USB frames, so timings are ±0.5 % accurate * I'm not exactly happy with precision at the lower end of current ranges because of ADC offset * would like to have ability to take high-resolution graphs, but it takes a lot of RAM, so we need bigger, faster, pricey CPU for that * I was told UART bridge doesn't work with TI CC3200 bootloader Some pictures below — photos, console output, PC software, current range switching waveform (yellow is a voltage across the load, other lines are Vgs of MOSFETs controlling shunts — one pic is switching from range 0 to range 1 with 0 to 35 mA load step, another is range 0 to to range 2 with 0 to 2 A* load step, so all three shunts are involved). * — actually it was a short circuit through some thin wires We didn't publish schematics yet, but I think we will, maybe with the next HW revision. Anyway, if you want to build something like this by yourself and have questions, ask. Can be ordered, of course. Price is $50 plus packing and international shipping $10, so $60 total, Paypal oleg@olegart.ru (we registered business account, but it is "being verified" for something like 3 weeks now). If you live in Russia, Belarus or Kazakhstan and want to order, please contact me directly at oleg@unwds.com or better place your order here, for EACU countries we have other shipping options. If you have any ideas about software/hardware/functionality, please share. |
| Navigation |
| Message Index |