Close

Bringing MetaShunt into The Agentic Era

A project log for MetaShunt: High Dynamic Range Current Measurement

A low-cost and accurate tool for analyzing the power consumption of ultra-low power and IoT devices with rapidly changing current usage

jake-wachlinJake Wachlin • 09/06/2026 at 21:16•0 Comments

Power/current profiling tools like MetaShunt allow us as developers to get deep insight into what our firmware is doing, where it is breaking, and how we can optimize it. My previous log discussed significant updates to the Web UI, enabling deeper insights into the current consumption of products without the need to further develop log parser tools. You can directly see, for example, how much of the energy use is from deep sleep mode vs. periodic wakeup events, without needing to do the math yourself.

These features are great, but as more and more software and firmware development is being augmented or done in whole-cloth by LLMs, it seemed suddenly obvious that those LLMs would need to be able to verify and test the power consumption of hardware they are working on too. This led me to develop (perhaps unsurprisingly with the help of an LLM) the open-source (MIT License) MetaShunt MCP server, available now on Github here. 

MetaShunt MCP

This project is a Python-based locally-running tool which provides a Model Context Protocol (MCP) interface to LLM tools you are using. It exposes interfaces to read decimated continuous or burst streamed measurements, so that the LLM can kick off measurements and validate against firmware it is measuring.

What On Earth Does That Mean?

OK, if you aren't deeply in the AI world, that prior word salad may not mean much to you. Let me show an example of just how powerful this is.

In my example setup, I am using OpenCode as my harness, OpenRouter for model access, and DeepSeek V4 Flash as my model. I have only recently been using this model, and WOW. While not the most intelligent model, it is certainly capable of autonomously developing fairly significant projects (such as MetaShunt MCP) with minimal guidance and support, for literal pennies of cost. The cost vs. value ratio is off the charts. The entire development of MetaShunt MCP cost less than $0.30 with this setup. "What token spend?"

Let's say I want to use this model for development of an embedded system. As an example, consider my Nanosleeper project, which was my finished project to build a dev board which can deep sleep at under 100nA total, while maintaining the ability to wake at a desired time. This project has a base open-source firmware here.

The Setup

I cloned both the Nanosleeper firmware repo and the MetaShunt MCP repo to my Documents folder, and then opened up the Nanosleeper project in OpenCode as a project. I then added opencode.json to the base of the folder, to let OpenCode know that I have an local MCP server at this location (more info on this setup process is on the MetaShunt MCP readme, and the LLM itself can also help you set this up). Restart the OpenCode window for this to take effect.

The firmware for Nanosleeper is pretty simple. It is just meant to be a "Hello World" program for customers, and to provide a working example of sub-100nA deep sleep. The hardware is first configured. Then, two LEDs are turned on for 100ms, then back off. Then, the CPU busy-waits for 2 seconds. The external RTC (that will provide the wakeup in 10s) is initialized, and then the MCU enters STOP0 mode. It will be woken up by an interrupt from the RTC in 10s.

After the wakeup from STOP0 mode, the RTC is initialized for another 10s wakeup cycle, and the MCU enters shutdown mode, where its consumption drops to 10s of nA. Wakeup from shutdown mode is effectively a POR, so the whole program starts over again.

The Prompt

You may then think that using the LLM to power profile this system is complicated and you need to be an uber-engineer. In fact, the opposite is true. I simply asked the LLM in simple language (and with a typo, oops!) to review the firmware, use the MetaShunt MCP server to power profiler, and to make recommendations. That's it! Believe it or not, but this was the very first attempt at connecting a project to the MetaShunt MCP, after the model already one-shot developed the MCP server. Wow. You can see that it immediately finds the tool, determines it is connected, and starts getting data.

It quickly detects what the current profile looks like, and starts using the tools to slice up the data. It determines it wants some measurements at higher frequency for the wakeup cycle (rising through 0.3uA).

It then writes a Python script to analyze the measured data and compute per-cycle energy use.

It identifies the section where the system is in STOP0 mode, and then starts breaking the power profile down compared to the firmware.

Now it has it - it correctly identifies the sections, their time, their current levels (even confirming <100nA average sleep for Nanosleeper in the process), and starts identifying improvements.

Finally, it provides specific recommendations for how to reduce power consumption. Since this is a demo program, I don't actually want to remove the idle times or STOP0 phase, but you can see how this would immediately provide recommendations that the model could then implement and re-test.

For your reference, the profile looks like the image below. You can easily identify each section that it identified, and where they match up to the code. When I zoomed in and picked out how much charge each cycle required, I got 770nAh exactly - spot on for what it identified.

Summary

MetaShunt MCP allows you to connect your MetaShunt V2 directly to your model (tested with OpenCode, but can likely be made compatible easily with Claude Code, Codex, Cursor, Kilo Code, etc). This closes the hardware loop on firmware development, ensuring that firmware changes stay grounded and changes don't negatively impact power consumption and battery life.

The most amazing thing to me is that MetaShunt MCP was built one-shot and then tested one-shot with a model that took literal pennies to run for all of this. Wow.

Discussions