Tech Camp Blog

Artificial Intelligence on the Raspberry Pi using Invent!

We’ve recently built up a prototype of our Invent! system (www.inventblocks.com) using the Raspberry Pi. Invent! is a system to rapidly build robots, learn coding in schools, and even prototype inventions by engineers. We’ve now got three versions of the system, each using different microcontrollers.

The first we developed uses the ‘Crumble’ which is a great board for simple drag-and-drop programming. The second version (and mainstay of our product line) uses the BBC micro:bit – it’s great because it can be programmed simply by children using a drag-and-drop environment, but can just as easily be programmed using real-world programming languages like ‘Javascript’ and ‘Python’ which make it perfect for teaching programming not only in the secondary school environment (and our camps!) but also for tertiary education – both technical/vocational training and advanced use in engineering programmes.

As the Raspberry Pi is a full-blown computer, there are even more advanced options using it. Shown here is a test rig using our standard Invent! components, along with both off-the-shelf ‘Grove’ modules (which are compatible with our system), and off-the-shelf Raspberry Pi add-ons (the touch screen and camera).

Once you add a keyboard and monitor to a Raspberry Pi, it become a full-blown computer. You can browse the internet, create spreadsheets and other documents, and generally do everything else you’d expect with a computer. By adding in the ability to drive motors and connect sensors, it also can become the brains of a complex stand-alone electromechanical system to build robots, wireless weather stations and much more. Two of the ‘Grove’ modules connected here include sensors that detect temperature, atmospheric pressure (and altitude), environmental pollution, and humidity. The pressure sensor is so sensitive it can detect the difference in altitude when you raise it by 50cm from the desk.

We’ve built this rig primarily to show some of the advanced AI capabilities using the Raspberry Pi connected to a camera. In this picture you can see it identifying both a ‘cell phone’ and a ‘person’. It says it’s 77% certain that I’m holding a phone, and 85% certain that I’m a person (phew!). Its AI model is pre-programmed to identify dozens of different objects from cups to keyboards and even animals, but you can also train it to identify other objects, and indeed train it for all sorts of other purposes like recognising speech.

For anyone wanting to play around with AI and the Raspberry Pi, we really pretty much used Google’s off-the-shelf ‘Tensorflow’ code (we based it on this code here: https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi)

It’s not a beginner’s project though, because even just installing everything is a very tricky process, but it does show you what can be achieved.

We’ve developed this version of Invent! due to increased interest in AI in the education sector in secondary schools, colleges and universities so we’re really interested to see what people can make with this system when we release it. With the ability to do AI and interface sensors, motors and servos, there are limitless options from creating simulated factory-production lines for teaching concepts in ‘Industry 4.0’ to courses on AI and electronic engineering where students design their own sensors and PCBs.