Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
ReleaseInsight · On RadarHabr AI→ original

Claude Code built a 137-test bench for the Waterius water meter in two weeks

Waterius is a device that sends water meter readings over Wi-Fi. For eight years, its firmware was tested by hand. This autumn, the author asked Claude Code to build a test bench that presses the button and sends pulses the way a meter does. Over two weeks, 137 tests on a live device came together. A run takes about an hour, and the hardware costs 4250 rubles. The conclusion: an agent can be trusted with a bench, but every failing test has to produce evidence, or the agent will blame the firmware.

AI-processed from Habr AI; edited by Hamidun News
Claude Code built a 137-test bench for the Waterius water meter in two weeks
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Found9 pulses instead of 10, and 45–72 MQTT topics out of 83
Key metric #2The bench's own bugs outnumbered the firmware's
Key metric #3The agent blamed the firmware and used skip instead of failing

Automated tests for hardware are usually considered a luxury. You have to build a bench that presses buttons, sends signals and controls routers, and then maintain all of it. Waterius is a device that transmits water meter readings over Wi-Fi and runs on batteries for years.

For eight years, its firmware was tested by hand: run the main scenario and hope the new version doesn't break the old behavior. This autumn, the author handed the routine work to the Claude Code AI agent. Within a couple of weeks, it helped assemble an open bench: 137 tests run on a real board (this approach is called hardware-in-the-loop), and another 275 checks test the bench itself.

A quick run takes about an hour, slow tests take a couple of hours more, and all the hardware cost roughly 4250 rubles.

What the bench is built from

Waterius consists of two chips. The Attiny85 sleeps and counts meter pulses, while the ESP8266 wakes on a schedule or on a button press, sends readings and goes back to sleep. Everything a user does with a finger, the bench does with an HTTP request.

The core is an ESP32-C6 board running custom METF firmware, which exposes its pins over HTTP: it presses the button and drives the inputs with pulses. It also collects the device log into a ring buffer. A controllable access point is provided by a WT32-ETH01 with wired Ethernet: if the bench controlled the access point over the same Wi-Fi, switching the access point off would cut the bench's own connection.

The setup portal is opened by an old NodeMCU, acting as the user's phone. The bench connects to the Waterius board with a clip fitted with spring-loaded pins, so no soldering is needed. The MQTT broker and HTTP server run on the computer only for the duration of a test run.

Tests are numbered after the manual plan: D5b in the code is D5b in the plan. So the agent only needs to be told "do E19" to know what to check.

What turned up in the firmware and in the bench itself

The core functionality proved reliable, while the secondary features needed fixing:

  • Ten 350 ms shorts applied during a communication session produced nine pulses. The Attiny measured its polling tick in loop iterations, and during a session the loop runs differently.
  • Occasionally only 45–72 topics out of 83 reached the MQTT broker. The device went to sleep without waiting for the data to leave the TCP buffer. The disconnect time exposed the problem: 607 ms for dropped sessions versus 12–150 ms for complete ones. Now the firmware waits for the broker's acknowledgment before sleeping. A second cause was found in the amqtt broker, which had to be forked.
  • The firmware printed five log lines per topic, which is 415 lines per send, while the bench's buffer holds 511. Now there is one line per topic, and that line also serves as the acknowledgment.

Along the way, pulse recognition time was cut from 600 to 300 ms, the bench learned to count 0.7–1.5 ms pulses from a gas meter, and commands from Home Assistant were fixed, since the retain flag had been used carelessly.

But the author's honest conclusion is that the bench's own bugs outnumbered the firmware's, and each one looked like a firmware failure. A single extra log clear took down 47 tests in a row. Weak Wi-Fi signal caused packet loss, so the bench had to be moved to a different channel. This is why the tests got a "receipt": METF reports how many pulses it actually delivered. If 20 were ordered and 19 were delivered, the bench is at fault, and the test says so directly.

How the agent worked and what to take from it

All 199 bench commits were made together with Claude Code: a human set the tasks and reviewed the results, while the agent wrote the tests, the scaffolding and the analyses. Three things helped: the numbered plan, analyses of failed runs stored in separate files (a month later, these serve as project memory rather than chat history), and the rules in rules.md and CLAUDE.md, which the agent reads before every task.

The author describes the agent's weak spots plainly. It almost always blamed the firmware first. It initially "fixed" the MQTT tail by adding a wait, even though the failures persisted. And a test that ended up skipped produced a green run without any verification. Hence the rules: a failure must come with evidence, since "the device stayed silent" and "the bench didn't check" are different failures; skipping is allowed only when the required hardware is missing; and the suite is sometimes run in reverse to uncover dependencies between tests.

There are limits too. The file 04_not-tested.md lists 14 items the bench does not check: real water, the captive portal on a phone, calendar timing across one day and three days, users' own routers, and different flash memory chips. The bench did not replace the manual plan; it took over the routine part of it.

The practical takeaway for anyone building their own hardware: you can hand the bench assembly to an agent too, but only with strict rules. Require evidence for every failure, rule out the bench first (host clock, board connectivity, the radio, the log), and only then suspect the firmware. The author has published the code in the waterius repository (Utils/hil) along with a ready-made starting prompt: begin with a single test, such as a short button press and one delivery, and only then scale up.

Story

Key Questions Answered

What the bench is built from?

Waterius consists of two chips. The Attiny85 sleeps and counts meter pulses, while the ESP8266 wakes on a schedule or on a button press, sends readings and goes back to sleep. Everything a user does with a finger, the bench does with an HTTP request. The core is an ESP32-C6 board running custom METF firmware, which exposes its pins over HTTP: it presses the button and drives the inputs with pulses. It also collects the device log into a ring buffer.

What turned up in the firmware and in the bench itself?

The core functionality proved reliable, while the secondary features needed fixing: Ten 350 ms shorts applied during a communication session produced nine pulses. The Attiny measured its polling tick in loop iterations, and during a session the loop runs differently. Occasionally only 45–72 topics out of 83 reached the MQTT broker. The device went to sleep without waiting for the data to leave the TCP buffer. The disconnect time exposed the problem: 607 ms for dropped sessions versus 12–150 ms for complete ones.

How the agent worked and what to take from it?

All 199 bench commits were made together with Claude Code: a human set the tasks and reviewed the results, while the agent wrote the tests, the scaffolding and the analyses. Three things helped: the numbered plan, analyses of failed runs stored in separate files (a month later, these serve as project memory rather than chat history), and the rules in rules.md and CLAUDE.md, which the agent reads before every task. The author describes the agent's weak spots plainly. It almost always blamed the firmware first.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Free · Waitlist · Hermes + DeepSeek

Free 2-Day Vibecoding & AI Agents Intensive

Day 1: the autonomous Hermes + DeepSeek AI agent — vibecoding and development on par with Claude Code / Codex / Gemini. Led by Jemal Hamidun, Head of AI at Alpina Digital and academic supervisor at MIPT. Right after you register with our bot Nika: the recording + 11 materials from the previous intensive.

Join the waitlist →Nomad AI Workspace
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — Claude Code built a 137-test bench for the Waterius water meter in two weeks https://news.hamidun.com/en/news/18679/claude-code-built-a-137-test-bench-for-the-waterius-water-me

What do you think?
Loading comments…