Workshop

PLEN

Camera over the soldering bench: how I gave my AI agent eyes

A webcam on a motorised head, a USB microscope and one program that shows the same picture to me and to the AI agent. How it works, where we tripped up and what it is actually for.

Interfejs Kadr, widok na żywo: obraz z kamery nad matą lutowniczą z siatką pól, z lewej lista kamer, z prawej sterowanie głowicą, na dole pasek ostatnich zdjęć

Widok na żywo: obraz z siatką pól, lista kamer, sterowanie głowicą i pasek ostatnich zdjęć.

Working on electronics with an AI agent has one bottleneck: the agent can’t see what you’re doing. An agent is a program that writes code on its own, flashes it onto the board and checks the result, but about what is lying in front of me it knows only as much as I describe. And describing a circuit board in words is tiring and unreliable. “That small black part next to the capacitor” tells it nothing.

The answer is a camera over the bench that the agent has access to. I call it the bench camera. The program that controls it was written by the agent, so in a sense it built itself a pair of eyes. I mounted the camera, said what was getting in my way and checked whether the agent sees what I see on the bench.

The hardware: a webcam and a microscope

Hanging over the bench is an Insta360 Link I pulled out of a drawer, a 4K webcam on a motorised head that can pan and tilt. It connects with an ordinary USB cable and needs no special drivers. Any other camera with reasonably decent picture quality would do just as well – only then does this make sense.

The second camera is a USB microscope, for looking at markings and solder joints up close.

The first problem showed up straight away: only one program can read a camera at a time. If the agent is watching the picture, I don’t have it, and the other way round. So everything goes through a single service on the workshop computer. It holds both cameras, shows me a page in the browser, and gives the agent the same photos and the same buttons in the form of addresses it can send commands to.

A shared language: grid, photo numbers and markers

The picture alone is not enough. The two sides need a way to point at the same spot. Three simple tools came out of that:

  • A grid of squares, like on a map or a chessboard, from A1 to L8. Instead of “bottom left” you say “in square C6”.
  • Photo numbers. Every photo gets a short number: Z1, Z2 and so on. Numbers are never reused, so “look at Z14” always means the same thing. A crop of a photo gets its own number and remembers which photo it came from.
  • Markers. Numbered circles placed with a click. The agent can place them and so can I, and a note can be added to a photo.

This photo comes from another project, modding a component tester. On it the agent marked the chip pins I needed to reach with a wire, and I checked with a multimeter where they lead. In words that would have taken several messages and probably more than one mistake.

Where we tripped up: a camera looking straight down

Most of the time went on controlling the head, and for a reason neither of us saw coming. Clicking on the picture was supposed to turn the camera towards the point you clicked. It worked as long as the camera was looking straight ahead. Over a board the camera looks almost vertically down, and then panning doesn’t move the picture sideways, it just spins it around its own axis, like a steering wheel.

This is not a fault of the camera but a property of every head of this type: when it looks vertically down, the pan axis lines up with the axis of the lens.

Before we understood that, the control arrows changed their meaning five times in a single day: one moment they moved the camera, the next they panned the zoomed-in picture, the next they were switched off.

On top of that came two traps of the camera itself:

  • The camera can report angles that aren’t true. After being plugged back in, it reports the position from before it was unplugged, so the first move looks like a jump to a random spot. What helps is returning to the home position first and only then setting the framing. The program now does this by itself when the camera appears. Part of that mess, as it happens, the agent caused with its own earlier commands, and later wrote that down in its notes itself.
  • Putting the camera to sleep wrecked its position. After a minute’s break the camera came back pointing at the floor and ignored commands. Sleep stayed in the program as an option, off by default.

The final solution is unspectacular but effective. Over a board the camera hardly moves at all. Zooming happens in the browser, on the 4K picture, and rotating the picture is done by the program, not by the head. The mechanics are there to set the framing once, at the start of work.

The second surprise was a more interesting one. Standard USB camera control gives no access to exposure time and gain, and with shiny solder joints that is essential. The camera does, however, have its own vendor-specific commands, which someone had already worked out and documented in the open-source project link-studio. Thanks to that, exposure can be set by hand.

What it is really for: salvaging parts

The most practical use is stripping old boards. I put a board under the camera, take a photo and ask the agent to analyse it. The agent looks at the photo, takes its own close-ups if it needs to, and then sends back a list: which parts are worth desoldering, where they are and why. Each suggestion has a box on the photo and a short justification. For identifications it isn’t sure of, it says “uncertain” outright.

The order matters. A part goes into my parts inventory only once I have desoldered it, put it in a compartment and clicked “Wyjęte” (Removed) with the number of that compartment. The program then creates an entry with a description, the storage location and a crop of the photo. The agent’s suggestion on its own changes nothing in the inventory, so the list contains no parts I don’t physically have.

It works the other way round too. If the agent has missed something, I draw a rectangle around the component on the photo and type a question. The agent replies either with a suggestion or with an explanation of why it isn’t worth it. In the screenshot above, that question is box K7.

A new look with the help of a second tool

The first version of the interface was functional but rough. So the agent put together a package for an interface design tool: a description of how I work, screenshots, sample data and my brand’s visual guidelines. Out of that came a new interface called Kadr, and the old one was removed. Kadr is what you see in the screenshots in this post. While we were at it, the program stopped assuming there are two cameras and gained the ability to add more.

What remains of all this

  • An agent with eyes works differently. Instead of asking me what the device’s screen shows, it takes a photo and looks for itself.
  • A shared reference matters more than picture quality. The grid and the photo numbers cost little work and removed most of the misunderstandings.
  • The hardest part was the mechanics, not the program. The day with the arrows showed that an agent can go round in circles too, until it understands how a physical device behaves.
  • The agent suggests, the human confirms. In parts salvage nothing goes into the inventory without my click.

The bench camera is not a project that measures or controls anything in its own right. It is a tool that makes the other projects go faster, and today I find it hard to imagine working with an agent at the soldering iron without it.

szmidtpiotr/electronics-DIYGitHub

Bench camera (the bench-cam folder): live view from the camera and microscope, grid, numbered photos and markers for the AI agent.

  • Code not public

Related posts

Comments

No comments yet

Leave a comment

Your email address will not be published. Comments appear after approval.