Having a ball with code: Can Sphero inspire the next generation of developers?

Getting kids to code can be hard. Is a Bluetooth-connected robot ball part of the solution?
Written by Simon Bisson, Contributor

This is a software world: things we used to do with hardware are now handled by low-cost processors.

But that means we need more and more developers to write and maintain that code, but where are those developers coming from, when we're also told that the current educational system isn't teaching the essential skills needed to write code?

Learn to code with a glowing ball? It might just work.

Luckily for the modern world there's something of a renaissance in the educational technology world and in the teaching of the basic building blocks of the computing.

You can start with visual programming environments like Kodu, and move on to more complex low-cost computing platforms like Raspberry Pi. But they're only part of the story.

More and more our world is becoming one where we're interacting with smart devices: not only that, it's one where devices are talking to each other.

Traditional programming techniques often flounder when you're dealing with asynchronous, machine-to-machine applications – and when you're working with real time systems and embedded processors.

Microcontrollers like Arduino or Netduino have changed the way we can teach device programming – but while they're ideal for intermediate and advanced programming, they don’t really encourage beginners.

That’s where a new generation of programmable objects is coming in. Perhaps best thought of as inhabiting a space somewhere between BigTrak (the drive train of which formed the basis of my first home-built robot) and Lego Mindstorms; they look like toys but are programmable objects in their own right, with tooling that ranges from smartphone Logo-like macro tools to whole SDKs.

Over the last couple of years there've been more and more of them at CES, products that were born as university research products or in small startups.

You can start with Sphero's smartphone remote control...

I’ve been playing with Orbotix's Sphero for the last week or so. It's a small white ball, with a colour-changing LED light and an internal motor – and a Bluetooth connection to a smartphone or a tablet. You can drive it using a phone's touch screen as a remote control, or you can delve into its programming model. The cats may have enjoyed chasing a small bright light around the room, but I had a lot more fun exploring its development tools.

27-03-2013 16-19-39
...and end up on Github downloading SDKs.

Sphero's iPhone controller app is a free download, and contains links to a library of different apps - from games to apps that get you started coding. You can start programing the ball with a basic macro language app, with a simple visual programming language. It's more than a little reminiscent of the buttons on a BigTrak. You can choose to roll the ball forward, change its colour, and handle its rotation.

Where the Sphero macro differs from basic device programming environments, is its support for loops. Like the original Logo, and the turtle it controlled, you can wrap combinations of macros into basic loops, to create more complex functions. Sphero's macro language is extremely high level, so while your code takes advantages of the device's sensor suite to give it a much higher level of accuracy than you might expect, you don't get direct access to the data that Sphero sends back to the smartphone.

Sphero's macro app comes with sample apps to get you writing simple control programs

Macro tools like this make it easy to teach basic programming and control constructs. Choosing to flash a pattern of colours and to drive a ball around an obstacle course teaches basic programming – especially once you start to add loops to simplify operations.

You can go a lot further than just basic macros with Sphero. SDKs are available for most of the main mobile operating systems, as well as for desktops and for HTML5-based cross-platform development environments. There are also plug-ins for game development platforms like Unity, making it easy to use Sphero as a target for augmented reality apps, making a moving ball a controller for games. You're also able to drill into the device’s sensors, giving you the ability to identify when it's moving, and where the device is relative to where it started.

The location API is what makes the Sphero a true robot. You can use it to get feedback on device position and status, letting you write apps that can give you true autonomous operation. The same tooling can also be used to use Sphero as a controller – adjusting its position to sample gyroscape and accelerometer.

Educational programming tools need to guide users from the very basic to the very complex – and that's something Sphero does well. You can start with it just as a smartphone linked toy, before progressing to macro-based programming. Then you can use the APIs to build HTML5 apps for any platform, with just a little JavaScript knowledge, before moving on to apps that run on major smartphone platforms, and finally taking advantage of the device's Bluetooth communications channel.

Much more than a toy, Sphero is a platform that grows with you, and one that entertains as well as informs (and also keeps the cats happy as you test out your code). It's not expensive at under £100, and with development resources held on Github it's easy to get started writing your own Sphero code. Like Kodu it starts small and game-like, capturing a child's attention and encouraging them to do more as they go.

It's exactly the type of tool we need to start building the next generation of robotics developers. 

Editorial standards