SUDO: sudoku-solving robot

Reading Time: 3 minutes

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.

SUDO is powered by a Raspberry Pi 3B+ and has been carefully trained using machine learning to recognise numbers shown in different fonts

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.

Arijit holds out a sudoku puzzle for the robot to scan and solve; at the moment, it needs to be held steady

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.

Place an IR sensor on top of the touchscreen and connect it to Raspberry Pi, then screw or clip the rear of the robot shell in place. Use sudoku grids to help train your robot to recognise numerals.

Schreibe einen Kommentar