How to control a Sphero Original, e.g. using Micropython?

198 views Asked by At

I recently got a used Sphero robot (as far as I can tell a "Sphero Original" since it doesn't have any other version information), and intended to experiment with it with my children. Unfortunately, as far as I could find out, all the official Android apps (Sphero Play, Sphero edu) don't support that model anymore (I checked). what's up with that?

Fair enough, I thought, I bought a Micro::bit anyway, intending to use the SDK I heard about to interact with the robot using Micropython.

Unfortunately (again), I just found out that the Microbit Python SDK only seems to be for the "RVR" model. I checked the code and it seems to be mainly uarting stuff to the device.

Now, I'm not afraid to write some Python to talk to my Sphero Original, but I could not find any documentation for the communication protocol (using classic Bluetooth).

Q1: Is there a way to easily interact with my Sphero Original, e.g. using an app I don't know about? (I got Linux, Android, Python, Micro::bit available)

Q2: Failing that, is there documentation for the communication protocol available somewhere (maybe from an old SDK version or whatnot), so I could implement rough control myself?

FWIW, the device still charges, emits the correct light codes, jerks aroudn a little when moved, and I can pair it with my Android phone. As far as I can tell it would still work (it's basically unused), only the apps (Sphero Play, Sphero edu) don't pick it up.

1

There are 1 answers

1
JdenHartog On BEST ANSWER

I was searching for this as well and found a lot of useful information here:

http://wiki.mark-toma.com/view/Sphero_API_Tutorial

The following code works for me turning the old Sphero red in Python 3.10.7

One has to use the correct tty device on a Mac (or COM port on Windows).

import serial
ser = serial.Serial('/dev/tty.Sphero-BYR-RN-SPP') # Sphero turns light blue.
ser.write(bytearray.fromhex("FF FF 02 20 37 05 FF 00 00 00 A2")) # Sphero turns red.
ser.close() #Sphero returns to blinking id pattern.

Execute the lines of code one by one, or build in a delay, or you will not see anything happening.