Rosie the Red Robot
By Rob Zwetsloot. Posted
Take back control of your online data, with Raspberry Pi.
The clock is ticking as the contestants concentrate hard on finding the longest word possible from nine randomly selected letters. Yes, it’s Countdown, the classic TV game show loved by students, senior citizens… and robots. Playing along at home is Rosie, her Camera Module eye focused on the screen. Within seconds she blurts out, “I have a six-letter answer: murder.”
Rosie first came to life when Alan Peaty was challenged by his daughter to build a robot. Despite his engineering experience, Alan didn’t find it easy. “It didn’t take long before I was completely out of my comfort zone,” he tells us. “Possibly the most challenging aspect of trying to build a robot is that there are so many different areas of technology involved, from hardware to software, mechanics to electronics. For example, just to get Rosie’s neck to move, we had to write some code in Python, learn about Serial Peripheral Interface bus (SPI), and get familiar with servo motors and the physics of torque, even before thinking about connecting the whole thing together. Be prepared to Google absolutely everything and anything.”
As documented in detail on the rosietheredrobot.com blog, Alan has spent several months building Rosie and gradually adding extra hardware and abilities, while learning a lot along the way. At first Rosie was a simple wheeled robot, but she is now equipped with a headlight, LED matrix expressive ‘eyes’, motion sensor, GPS receiver, ultrasonic distance sensors, and a Camera Module.
Playing the game
It’s this last addition that enables Rosie to see the Countdown letters on the TV screen. Optical character recognition is then carried out using Google Cloud Vision API, to read the letters. “She performs relatively well at different distances on one condition – only the individual letters from the letters round is showing on-screen when the photo is captured,” reveals Alan. “When the contestants’ names, or even the channel name, appear in the same picture, it starts to muddle Rosie’s brain.”
A Python application runs the identified letters through an algorithm that matches possible results from a dictionary containing 10 000 words – a dataset from magpi.cc/2mgxuv4 that Alan has arranged alphabetically. Python’s gTTS text-to-speech module is then used to get Rosie to say the longest word she’s found, along with the numbers of letters in it, via an on-board speaker.
Naturally, replacing the dictionary with a larger one would improve Rosie’s performance, but she’s still a decent player. “It perhaps goes to show that machines are so much better than us humans at processing large volumes of data rapidly, when the requirements of the task are crystal clear,” says Alan. “The letters round doesn’t really require any tactics or strategy, or even any complex decision-making. You simply need to remember every single word in the English dictionary and have the ability to filter and search through them in under 30 seconds.”
As for getting Rosie to play the Countdown numbers game, “We’ve had a quick look at this,” says Alan, “but it turns out to be a little more complicated than just trawling through a list of words and letters. The algorithm is likely to need to work out every single mathematical operation possible not only between the chosen numbers, but between the results of subsequent operations. She would need to add this to her repertoire, however, if she was ever to appear on the actual TV show…”
Rob is amazing. He’s also the Features Editor of Raspberry Pi Official Magazine, a hobbyist maker, cosplayer, comic book writer, and extremely modest.
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 →
