SUDO: sudoku-solving robot
By Rosemary Hattersley. Posted
Keeping our minds and bodies active is reputedly key to a healthy life, with puzzles such as sudoku providing the right sort of mental stimulation. Much like chess, however, it seems machines are far more adept at them than humans. Computer science student Arijit Das has come up with SUDO, a Raspberry Pi-based robot that’s a lightning-fast sudoku whizz.
Take back control of your online data, with Raspberry Pi.
Named after both the UNIX command and Japanese puzzle, SUDO began life as a companion to help Arijit with number-based puzzles. “I was trying to master sudoku puzzles and invested a lot of effort,” he explains. As an experienced inventor and programmer, he soon realised there was no need to solve sudokus manually. “I can build a robot to solve any complex sudoku within seconds,” he reasoned.

Keeping track with robot camera eye
Arijit has been experimenting with Raspberry Pi possibilities since 2017, when he began trying out IoT projects. These include a Spy-Dog live video surveillance bot, a drowsiness detection device, and a web-based GPS tracker. His SUDO robot runs on a Raspberry Pi 3 B+, but he says it could easily run on a Raspberry Pi Zero.
For the sudoku challenge, the robot required “an eye to see the sudoku, a brain to solve the sudoku, and a medium to communicate the solution”, says Arijit. He soon realised that Raspberry Pi’s Camera Module could act as the eye, its processor as the brain, and a display and speaker as the communication medium.
As long as SUDO is able to detect the puzzle placed in front of its camera, it’s able to solve complex sudokus in a few seconds. The caveat, says Arijit, is that the robot finds it tricky to read the puzzle grid in poor light. When it recognises a grid, SUDO states: “I have detected a sudoku,” quickly followed by “I have solved the sudoku successfully.” SUDO then displays the solution on its touchscreen display.

Puzzling it out : solving sudoku with Raspberry Pi
Arijit is working on overcoming the challenge of low light, which can cause SUDO to misread numbers on a sudoku grid. He has put in many hours getting SUDO to recognise different fonts. “Accuracy was the ultimate factor, as misinterpreting numbers would give wrong results,” he says.
This required training the robot using machine learning algorithms to recognise all those fonts. Arijit used OpenCV to train SUDO. He is currently looking at ways to get his robot to follow and track a piece of paper held in front of its camera, since people often unintentionally move the paper containing the sudoku puzzle while SUDO is trying to decode it.
Having gained experience of machine learning when training Raspberry Pi to recognise vehicle number-plates for another project, Arijit knew which existing algorithms to use to get SUDO to solve the puzzles. He adapted them to work with Raspberry Pi and his own machine learning data set. He used open-source Python code to control the robot. The robot’s appealing case was originally that of one of his childhood toys. The fully operational robot has been shown off at Maker Faires and tech events, attracting selfie-takers and kids who plead with Arijit to make them a robot to solve maths problems. SUDO even had a human challenger. Arijit proudly relates what happened: “Before the guy wrote a single digit on the paper, SUDO solved [the sudoku puzzle] and showed the solution”.
Build a sudoku robot
Find instructions on how to build your own SUDO robot on GitHub.

Rosie has worked for consumer tech titles such as PC Advisor, Computeractive, CNET and Macworld and written For Dummies books on using iPads, Androids and tablets
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Take Back Your Clound in Raspberry Pi Official Magazine 165
We’re all-too accustomed to the feling of being watched on the internet. A search for any product leads to adverts, emails, and goodness knows how many bots tracking you. It feels weird and intrusive, and we aren’t being paranoid – they really are watching us. Luckily you don’t have to reply on online services that […]
Read more →
Win one of three Raspberry Pi 4 with 3GB RAM!
Raspberry Pi 4 is still a powerful piece of kit, and this new 3GB version is great for projects and builds that need slightly more than 2GB of RAM but don’t quite need 4GB. We have three to give away and you can enter below. Win 1 of 3 Raspberry Pi 4 3GB
Read more →
Etch A Sketch CNC machine
The software controlling the Etch A Sketch logs the image, turns it into vectors, turns the vectors into G-code, then sends the G-code to the Etch A Sketch – and it was all written by AI
Read more →