3D printer solves Sudoku puzzles

Zach with his puzzling machine, photo: https://www.raspberrypi.com/
story and photo: https://www.raspberrypi.com/

Zach Hipps from byte sized turned his 3D printer into a sudoku-solving robot. He added a pen, a camera, and a Raspberry Pi Zero W to the printer in a non-destructive way so that it can still be used for printing.

How does it work?

Zach wrote some Python code to take a picture of the Sudoku puzzle using the camera attached to the printer. Then some image processing using computer vision happens, and the puzzle numbers are input into his Sudoku-solving algorithm which he has running on his Raspberry Pi Zero. Next, the Raspberry Pi generates the G-code for the solution, containing the commands for the printer parts to move so as to write out the correct numbers with the attached pen. The G-code is sent over the serial port to the printer, which makes the pen fill in the Sudoku grid with the solution.

This is a particularly impressive feat as Zach had never worked with computer vision before. Although he intended it as just a toe-dipping project, he managed to make a 3D printer capable of solving a Sudoku puzzle in seconds. Way quicker than humans. I’ve been known to take days. But I don’t number so well.

Hang on, what IS computer vision?

It’s a type of Artificial Intelligence (AI) that allows a computer to analyse, classify, and process what a connected camera is “looking” at.

Right. Now what’s G-code?

G-code is a super popular CNC (computer numerical control) programming language. It’s used a lot in manufacturing to control automated machine tools, and it’s used by 3D printers.