Next week I’m expecting delivery of a robot that can pick up electronic components smaller than a grain of sand and place them on a circuit board with an accuracy measured in hundredths of a millimeter. I like to know that this technology can be performed on US soil.
Naturally, I want to see just how well it performs.
To test it, I decided to design a circuit board using KiCad. KiCad is an open source printed circuit board (“PCB”) design suite. The PCB I plan will contain hundreds of precisely positioned components. Rather than laboriously arranging each component with a mouse, I wanted a computer program, aka script, to create the board automatically.
That seemingly straightforward idea led me into an unexpected project involving an upcoming release of KiCad, over 1,000 files of software documentation, and an unusual collaboration between two artificial intelligence tools.
Background
The robot I am expecting next week is the high precision AFARCO Pick-and-place (“PNP”) machine (see below). AFARCO uses the open source code OpenPNP.1 I want to test the ability of the of the PNP by creating a demanding circuit board with a variety of components placed in a variety of angles and in rows. Creating such a testing board is best done by a script which can easily create a 10 x 10 bank, i.e. 100 pads for small resistors, without my having to locate such with a mouse on a screen. KiCad’s current version is Release 10 and it offers a scripting interface that lets one programmatically design PCBs. KiCad is on a release schedule such that Release 11 will come out in February 2027. One of the enhancements for Release 11 will be a complete overhaul of its scripting facility and Release 11 will not support scripts that work in previous releases. So if I’m going to create a script today, November 20, 2026, it will be tied to Release 10 or older. I’d prefer to create a script that works in the newer scripting environment so I can follow the KiCad releases for the next several years and not have to always keep a Release 10 to support scripts using the older interface.
The GitHub project KiCad Python scripts features 5 scripts that accomplish various tasks demonstrating the tasks the scripting interface can accomplish. They are written for the current Release 10 scripting model. They will not work in Release 11.
Here’s a screenshot of a 3D version of a circular light emitting diode (aka LED) board that is created entirely by script. The even placement of LEDs in a circular fashion would take many hours if performed by hand using a mouse, and the accuracy and consistency of the placements would probably vary. The circular LED example is an excellent demonstration of why scripting is more efficient than hand editing.


So I embarked on migrating the first script, via-stitching, using ChatGPT. (A via is a hole in a circuit board that connects two or more layers. ) The script creates a PCB with 1,076 vias. Can you imagine having to create over a 1,000 vias by hand?
It took a great deal of time because the ChatGPT model did not have in its data the Release 11, and therefore did not have the new scripting interface. So I spent a lot of time running commands against Release 11 that help identify methods and properties for a given object so ChatGPT could write a script imitating the older script. After completing that first migration, I realized the problem was that ChatGPT did not have something to refer to since it’s model was built prior to Release 11 scripting interface, so I decided to engage Codex (a version of ChatGPT that can runs scripts on my computer) to review Release 11’s code tree and provide an atlas of documentation of the new object model. That task was a major project that produced 57 directories containing 1,131 text files totaling 147 MBs. (A 4.3 MB zip archive is available here.)
The beauty of the “atlas” of documentation is that I uploaded the zip archive to ChatGPT and now it had available to it all the properties and methods it would need to script in the new interface. So for the next four scripts I migrated, ChatGPT did not have to ask me to run commands to explore the object model. Instead, the manner of work was: I provided the original Python script of the project and instructed ChatGPT to build the same script using the new Release 11 API atlas. To assure that the newly created PCB, i.e. the circular LED PCB, conformed to the one created by the old script, ChatGPT created for each script several rigorous quality assurance tests to be applied against the output. We got down to some discrepancies that were measured in nanometers. At about 3 different times, we were stuck because the QA scripts were failing, so I directed ChatGPT to provide a summary of the problem and a research request for Codex which then dug into the KiCad 11 code tree containing 10,618 header and C++ files to explain the failure. Each time Codex came back with a thorough explanation and recommendation which ChatGPT could use to adapt its test and order restructure how it manipulated the object. Three times we overcame hurdles the atlas could not address.
This was a 3-way effort: ChatGPT, me, and & Codex.
All five scripts were successfully migrated.
The process of giving ChatGPT an atlas of the Release 11 code and using Codex to handle edge cases where the atlas documentation was not clear, worked extremely well. I had asked ChatGPT to create a punch list of the 5 scripts in order of difficulty. It concluded the last and most difficult was the cicular LED. So, we took baby steps and migrated the lesser complex scripts. By the time we undertook the circular LED project, it was a simple matter. But, the circular LED project involved rotation and we discovered a design decision in Release 11 where rotation values were being truncated. Example: 1.3456789 mm could be truncated to 1.3456. That truncation caused our QA script to fail because the exact values between the new and old versions did not align. Codex found and documented the change in code between Release 11 and Release 10.
Pick-and-Place Machine
A pick-and-place machine is a computer-controlled robot used to assemble electronic circuit boards. Using vacuum suction and cameras, it picks up miniature electronic components and positions them on precisely defined locations on a circuit board.
The AFARCO machine I am acquiring has a manufacturer-specified placement accuracy of ±0.05 millimeters (50 micrometers), approximately the width of a human hair. It can handle components as small as 0.6 × 0.3 millimeters, far too small for most people to position reliably by hand, especially when you are my age, e.g. 70.
This precision makes it possible to assemble sophisticated electronic circuits using components that are almost invisible to the naked eye. The machine places small tiny electric components on pads containing solder paste on a printed circuit board which are then “baked” onto the board by placing the board with its placed components in a “reflow” [heat solder paste until it turns into its liquid state and flows] oven which essentially is a dedicated toaster oven. I’m going to be using the AdaFruit modification kit for a standard Black & Decker toaster oven using their project: EZ Make Oven.
Here’s a screenshot from the AFARCO’s product page:

Conclusion
This was an exercise where I had a ChatGPT model which did not have the data of KiCad’s Release 11 when the model was created, so I directed Codex to create an atlas of the current high watermark which ChatGPT could then reference. Simply: I helped ChatGPT learn newer and still evolving specifications and utilize them to work in producing scripts. And we used Codex to dig into the nitty gritty of two versions of a substantial code tree when following the atlas did not produce identical results.
An engineering team of three.
- OpenPnP is an open source Surface-mount technology pick and place system that includes ready to run software, and hardware designs that you can build and modify. You can also use OpenPnP software to run a pick and place machine of your own design, or with existing commercial machines, giving them abilities they never had with their original equipment manufacture [proprietary] software.
Leave a Reply