Bringing an Old Computer Back to Life: How AI Helped Us Recreate the Motherboard

In the world of electronics and tech, we often feel a sense of nostalgia that inspires us to take on exciting projects that connect the past with the present. We recently decided to bring back the Slovene computer Iskra Delta Partner from the 1980s, and this project really captured our excitement for the past. Our goal was to make an exact copy of the main computer board, which turned out to be a pretty detailed and challenging task. One of the big things we had to do was put more than 1000 small bridges, also known as "vias," onto the board. In this blog post, we're going to share how we tackled this puzzle using computer vision to make the process more efficient.

When we were figuring out where to put the vias onto the board in KiCad, the traditional way was to place them one by one onto the grid while drawing lines (traces) to connect them. But with so many vias to deal with, we realized we needed a better approach. This led us to explore whether we could speed up the process by using artificial intelligence (computer vision). At first, we used an open-source library called OpenCV, which comes with some ready-made ways to recognize objects. It worked pretty well right out of the box. However, when we switched to different scans, our initial algorithm faced challenges due to factors like lighting, contrast, and resolution.

Our initial attempt involved using OpenCV to identify the vias. This approach showed significant potential. Unfortunately, this specific scan was too distorted to fit onto the grid. As a result, we had to create a different type of scan, which didn't work as effectively with this via recognition algorithm. (Credit: Tomaž Štih)

As we worked on preprocessing the images and fine-tuning the object recognition algorithm's settings, we simultaneously began creating our own method to detect the vias. This approach showed quicker progress and yielded better outcomes. The algorithm managed to locate and place around 970 vias quite accurately, marking a definite success. The algorithm's core concept is quite simple. We slide a small square window across the entire scan and attempt to figure out if the square contains a via. To accomplish this, we describe the square's contents with a feature vector that contains histogram-like features. Before the algorithm runs, we manually mark several vias, which guides the algorithm on what to search for. Only 9 vias were manually marked, yet that proved enough for an almost perfect outcome. As the square window moves across the image, it compares what it "sees" to the known via feature vectors (its "gold standard"). When a notable resemblance is detected, the square's content is recognized as a via. This likeness is assessed using the cosine similarity measure.

The grid-aligned scan with the recognized vias.

We also implemented the capability to repeat the recognition process iteratively and expand the gold standard with each round. Although this turned out to be beneficial, it wasn't the most significant improvement we made. We observed a substantial increase in accuracy when we introduced a "tabu mask." This mask guides the computer on where not to search for vias. We crafted this mask using the traces (lines) from the scans, and it had a significant positive impact on accuracy and speed.

The tabu mask that was used to produce the final result. This mask was created by extracting the black traces from the scans and converting them into a single 1-bit image.

What began as a fun experiment evolved into a significant success story. Through the use of computer vision, we were able to noticeably accelerate our work. While it did take some time to puzzle through the details, the effort was absolutely rewarding. This project effectively demonstrates how employing artificial intelligence can be a powerful approach for overcoming challenges while reverse-engineering an old circuit board.

The via recognition algorithm enabled us to get to the end result more quickly.

Resources

The source code of our via recognition algorithm is available here. The entire algorithm is contained within a single file and is fairly easy to read and understand if you are familiar with the basic principles of machine learning.

Disclaimer

The purpose of this post is not to present the latest and greatest technologies for image localization or object detection. This "via recognition" algorithm was developed with a clear goal in mind, and its further development was stopped once good-enough results were obtained. If you are interested in more recent and far more elaborate techniques, please consider reading about the neural network approaches.