Inspired by the last local robot tournamet at Omega, the Norwegian initiative Lær Kidsa Koding and a few discussions at my local hackerspace (Hackhem) I decided to revisit the BBC Micro:bit platform to see if it would be suitable as a mini sumo controller.

The idea was that it would be really cool to attempt a design of an entry level mini sumo platform, that used commonly available parts, didn’t cost an arm and a leg, was easy to build and easy to program. If successful, this could potentially lower barriers to entry in robot tournaments and create even more activity at Hackheim.

After a couple of months of tinkering, I ended up with a simple platform that easily can be built at most hacker-/makerspaces. The total parts cost, including PCBs is close to $30.

BBC Micro:bot robot platforms

The finished platform will accept anything with a BBC Micro:bit compatible edge connector (including, the hopefully upcoming “Clue” from Adafruit). The robot has 7 sensors in total, a GPIO expansion port and attachment slots that can be used for bolting on 3D printed skins or additional hardware or weapons controlled via the expansion port.

The picture shows a sketch of the statemachine that defines the robot's behaviour in the video above. This demonstrates that the underlying set of rules don't have to be complex for interesting behaviour to emerge.

Code equivalent of the state machine above: https://github.com/hansj66/micro-bot/blob/master/Firmware/state_machine_sumo.cpp

Hardware

The design is relativly straight forward. An I2C TCA9539 GPIO Expander sits between the micro:bit and the rest of the circuitry in order not to hog any of the dual use GPIO. The only exceptions are the PWM lines that are used to control the enable inputs of the L293DD motor controller. Since the motor controller operates at a higher voltage (this also includes the logic control signals) than the 3.3V micro:bit, a TXB0106 is used to translate logic levels between the motor circuitry and the micro:bit.

A linear 3.3V regulator (because I’m lazy. It may get hot, but it requires almost no support circuitry) provides power for the micro:bit and the rest of the circuitry. The 6V/700RPM N20 motors run directly from battery voltage.

N20 motors, wheels and mounting brackets can be sourced from AliExpress. Relatively cheap micro:bit headers can be sourced from [Pi Supply](https://uk.pi-supply.com/products/microbit-connector-180-degrees?_pos=1&_sid=035e1c422&_ss=r. The remainder of the electronics should be readily avilable from any component distributor). The full bill of materials, hardware design files (Eagle) and Firmware example code is available under Apache 2.0 and CERN OHL 1.2 license from https://github.com/hansj66/micro-bot

Firmware

Regarding the easy to program bit, I failed miserably. The code is written in C++ (mbed). I was hoping to be able to expose a high level API in MakeCode, but after having watched a few videos on the subject, I decided that life was too short and wrapped up the project with firmware written in C++, but providing high level abstractions for motors and sensors. Thus, enabling the user to create relatively simple state machines for defining the robot’s behaviour.

That being said, I don’t exclude the possibilities of revisiting MakeCode sometime in the future.

Previous adventures

In 2016, I decided to see how far I could push the relatively modestly equipped micro:bit. Turns out you can push it pretty far if you just bolt on enough hardware :)

Unfortunately, only the husk remains of the balance bot today. I brought it along to a hackathon at work in 2017, hoping to show it off to my co-workers. The regulator failed at one point, resulting in the entire stack of electronics going up in smoke.