I’ve learned so much from Snap!Con2020 (the annual conference for Snap! – a blocks-based language), the sister of Scratch. Our current lives dictated that it be held online, which has had the good side-effect (they’re not always bad) – an opening-up of access to participants, who would not have been to able attend in person. This year’s conference was held at Berkeley, California.

One session was an introduction to MicroBlocks, a blocks-based language which has been designed so it can run on small controllers and can be used for physical computing (doing things in the real world; like flashing lights, driving motors for robots). This means that you can write a program, try it out on your controller and then run it untethered from the computer, say as part of an installation (the Arts kind).

Eager to try it out afterwards (that’s going to be a feature of many things I saw at Snap!Con2020), I built a little project, as demoed in this tweet. This note is by way of a bill of materials which I used to make it, basically by following the excellent instructions produced by the makers of the component parts. And maybe there'll be some follow ups as I play with new features.

What it uses

  • a Raspberry Pi to run a WebThings gateway to provide a hub to send commands to the micro:bit. I used a Raspberry Pi 3 B (I tried the model 4, but the Mozilla software doesn’t seem to have been updated for it yet.) A Raspberry Pi 3 A+ should also work fine. The gateway opens the route to lots of WebThings possiblities.
  • a BBC micro:bit as the ‘physical device’. Though a few years old, it is really good value, with and array of LEDs to control, and sensors such as an accelerometer. Also a set of crocodile clip friendly connectors to add buzzers etc.
  • the micro:bit is not complete without the totally kawaii KittenBot Kitty case
  • micro-USB cable to connect micro:bit to computer for writing and downloading code, and connecting to the Pi gateway when live
  • a microSD card (8/16G fine).
connection diagram for components

What it does

The 5x5 LED array on the micro:bit can be switched on and off from the gateway (or over the internet). Nothing more, nothing less ;-) This note doesn’t cover the detail of the gateway, but I’ll plan to cover this separately; it’s going to be an important development for the web.


  • set up your WebThings gateway as per Mozilla instructions, you should be able to access the user controls at http://gateway.local. You will need to add a MicroBlocks add-on from Settings.
  • download the MicroBlocks software for your computer
  • plug in the micro:bit to a USB port on your computer and update its firmware in the MicroBlocks editor
  • create the blocks-first try the small local control block, just to prove you can flash the led. Then add the main loop blocks. Before unplugging the micro:bit and connecting to a USB port on the Pi, ensure you've deleted the first small local control block you wrote-it's proved its point (its presence seems to upset the WebThings operation).
  • from the Things page add your new IoT device (+)
  • now you should be able to control it.
code blocks


MicroBlocks activity card - I used this as the basis of my blocks sketch. A few details seem to have changed with the current version of MicroBlocks, but this may be my inexperience with the software. There are lots of other activities to try out on their site.

Mozilla WebThings Gateway setup. You need to put the gateway software onto a flash card to power up the Pi. If you don’t have a Pi you can use a PC running Linux as a gateway instead.

micro:bit/Raspberry Pi parts. There are many stockists of these, check out your local supplier. In the UK I often use Pimoroni, but choose your local supplier. For example: