Raspberry Pi Robots Bring ML to the Classroom

You’ve got 20 bright teenagers, a classful of robots running on Raspberry Pi Zero and an interest in neural networks (NNs). What do you do next? You dig into an Arm machine learning tutorial and use object detection to control the robots’ behaviour, of course!

Held at the King Saud University in Riyadh, Saudi Arabia, Oxmedica’s three-week, residential International Enrichment Program focuses on STEM (Science, Technology, Engineering and Mathematics) disciplines and is aimed at 14- to 16-year-old male and female learners.

Tutor Sam Martin was tasked with guiding the students through a series of lessons focusing on robotics, AI and computer science. Keen to give the students a sense of accomplishment, and building on their eagerness to explore, Sam decided to set them the challenge of building a robot based on a Raspberry Pi Zero.

“Regardless of their previous programming experience, or lack of, the students were all dying to start building robots,” smiles Sam.

“I find neural networks (NN) fascinating and thought they could add an interesting dimension to our project, introducing the students to the power of NNs without needing in-depth knowledge of the subject. With a little research, I found that getting started was surprisingly easy, particularly for well-trodden use cases like image recognition. But I felt that just learning about NNs wasn’t enough; we needed to build and use them to ensure that the students could see the real-life implications of what they were learning.

“The Raspberry Pi Zero provided excellent processing power and had great connectivity. However, running something like TensorFlow on the Pi Zero’s Armv6 architecture proved extremely difficult compared to the Pi 3’s Armv8 – so I was really happy to find Teach Your Raspberry Pi – Yeah World!, an Arm tutorial describing how to train AI on your Raspberry Pi without any extra hardware or accelerators. 

Oxmedica STEM students Riyadh 2018
Sam and students from the Oxmedica International Enrichment Program, Riyadh, 2018

“Since it came with links to an Armv6 distribution, we were able to train an NN to detect images of whatever the students wanted. We used the wonderfully simple Python bindings to allow the NNs to control the robots’ behaviour: one team used an NN to navigate around known obstacles, another to check whether a drinks bottle was full, empty or, in fact, not a drinks bottle at all. This gave the students a very hands-on approach to machine learning, and helped them see how it could be used in natural object recognition.”

“I was really impressed with the students’ progress,” says Sam.
“Some of them started with no programming experience whatsoever, and left having played a key development role in their team. But the great thing about the program is that it’s not just their technical skills that are developed. Soft skills are also cultivated: large, unstructured challenges such as this demand that students communicate, structure their approach, organize their resources and negotiate to find a solution together.”

At the end of the course, Sam provided the class with documentation, links and resources, and was delighted to learn that several students continued the project in their own time, acquiring the components used in the course and making their own robots. (If you’d like to know more, you can view the component list here.)


One of the robots built by the students after the course

Sam is currently working with autonomous drones for the University of Bristol and the Bristol Robotics Laboratory but is hoping to return to Saudi Arabia next year.

“I learned a lot from planning and teaching the activities for this course, but I’m so glad I found Arm’s tutorial – it turned what could have been a dry, theoretical area of study into an exciting project that captured the students’ attention and stimulated their interest in AI.

“I think, next time, we could take it further: I’d like to apply for more equipment and have a greater focus on team building, for example. I’ve also been really excited by the emergence of Cycle-GAN networks, which I’d like to introduce to show how NNs can be used not just in an analytical way but in an artistic way, too. That’s the beauty of ML: the applications are almost infinite, so there’s no end to the ways it can be used in the classroom to stimulate young people’s digital creativity.”

Sam is also a keen maker of wearable tech, with an interest in 3D printing and modelling. Find out more on his Twitter and GitHub accounts.

Anonymous