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.
- 3D printer (this is Zach’s model)
- Raspberry Pi Zero W (Zach used this starter kit from Amazon)
- USB hub (this hub from Amazon will do)
- Ordinary ballpoint pen
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.
In a follow-up video, Zach put his Sudoku-solving robot to the test by seeing how many puzzles it could solve in the time it took him to solve one. Spoiler: the printer is miles better than Zach. But Zach is better than me so, that’s something.
All the project files for this build are available on GitHub.