MicroPython and the BBC micro:bit

MicroPython Logo
micro:bit

Contents

MicroPython

MicroPython is a “slim” version of Python V3 specifically designed with a small footprint to efficiently run on memory constrained microcontrollers.

Contrary to the claims of some commentators, MicroPython doesn't implement anywhere near the complete complement of Python functionality. Many of the standard Python modules haven't been implemented for the good reason they would provide little benefit in the 'micro' world.

Additionally, a few of the full language constructs and built-ins are also missing from MicroPython. However the subset that is implemented is useful, fit-for-purpose and mostly all that is required.

MicroPython has been ported to an ever increasing list of microcontroller (and their associated development boards) including the BBC micro:bit, ESP8266, ESP32, Pyboard, Raspberry Pi Pico and various STM boards.

The version of MicroPython that has been ported to the micro:bit is an even smaller subset with not all 'standard' MicroPython features available. Still, the developers have done a great job and the language implementation is very solid.

This series is an attempt to teach the MicroPython language as available for the micro:bit without delving in any depth into microcontroller hardware specifics. All the MicroPython examples in the series are original and have been tested on a micro:bit for correctness using the Mu Editor.

BBC micro:bit

The BBC micro:bit is a development board designed by the BBC for use in computer education in the UK. It has the Nordic nRF52833 microcontroller from the ARM Cortex-M0 family at its heart. Integrated with the nRF52833 are additional hardware components including an LED light display, buttons, sensors and many input/output features.

Children in their preteens are taught programming and coding concepts with the aid of this little device. The teachers often have little or no experience themselves and rely upon 'recipe books' of projects to build. Graphical block 'languages' such as MakeCode and Scratch are predominantly used.

Fred's Cave believes this greatly undervalues the use of the micro:bit as an educational aid. While positioning a line of graphical logic blocks on a screen may demonstrate the raw assemblages of a coding algorithm this approach is too simplistic for promoting software engineering as a serious future career path to a young mind.

Final Notes

This series deals purely with the MicroPython language. It does not address micro:bit hardware specific programming. This will be the source of a future Fred's Cave project. Meanwhile those wishing to explore the hardware features of the MicroBit and how to access them through MicroPython can refer to the official (and well written) API documentation .

And finally… this series is entirely ad-free with no attached spyware, intrusive analytics or trackers. The site does not use cookies. It's completely hand-coded (Visual Studio Code) with the motivation simply as a learning tool for the author to gain experience with MicroPython and its application to microcontrollers.

<  Previous