Skip to content

Repository files navigation

micro:bit cave: Explore the world of micro:bit & MicroPython

Documentation Docs build MicroPython License: MIT

Hands-on MicroPython projects for the BBC micro:bit, from your first scrolling message to sensors, displays, motors and two-way communication. Every project is tested on real hardware (micro:bit V2).

Explore the documentation website · Getting started · Contributing

What's inside

Each project has a page on the website with the parts you need, a wiring diagram, the full code, a line-by-line explanation and ideas to try next.

micro:bit built-ins

Projects that need nothing but a micro:bit.

Project What it does Board Code
Display Text Scroll a message and show a heart V1 & V2 .py
Built-in Images Cycle through hearts, faces and moods V1 & V2 .py
DIY Images Draw your own picture LED by LED V1 & V2 .py
Radio Messaging Send a message from one micro:bit to another V1 & V2 sender · receiver
Light Sensor Tell day from night with the LED matrix V1 & V2 .py
Dice Shake to roll a random number V1 & V2 .py
Challenges Press A for a random party challenge V1 & V2 .py
Data Logging Record temperature to the on-board log V2 .py
Serial Communication Stream sensor data to your computer and reply V1 & V2 micro:bit · computer
Digital Compass A needle that always points north V1 & V2 .py
Spirit Level An LED ball that rolls as you tilt V1 & V2 .py
Clap Switch Clap to switch an LED lamp on and off V2 .py
Music Jukebox Melodies, your own tune and a siren V1 & V2 .py
Fruit Piano Play notes by touching fruit V2 .py

Sensors & modules

Projects that wire external hardware to the micro:bit. Helper libraries live next to each example.

Project What it does Board Code
LED and Buzzer Switch an LED or buzzer with button A V1 & V2 folder
PIR Sensor Motion alarm with a buzzer V1 & V2 folder
Ultrasonic Sensor Measure distance (3 V and 5 V modules) V1 & V2 folder
Servo Motor Turn a 9g servo with the buttons V1 & V2 folder
OLED Screen Print text on an SSD1306 display V1 & V2 folder
DHT11 Sensor Read temperature and humidity V2 folder
IR Receiver Decode buttons from an IR remote V1 & V2 folder

Quick start

  1. Open the micro:bit Python Editor in your browser.
  2. Paste the code of any project and connect your micro:bit with a USB cable.
  3. Click Send to micro:bit.

Sensor projects that import a helper (like servo.py) need that file on the micro:bit too. The getting started guide shows how.

Repository layout

microbit/          projects that use only the micro:bit
microbit_tools/    one folder per sensor or module: example + helper library
docs/              website pages (MkDocs Material), one page per project
templates/         the page template for new projects

Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

  • Test on real hardware: please test your code on a real micro:bit before opening a PR.
  • Avoid duplicates: check the existing projects first.
  • Add a docs page: every project also needs a page on the website, made from templates/example-page.md. The contributing guide explains the folder layout and how the wiring diagram is generated.

Every pull request builds the website to catch mistakes, and merging to main publishes it automatically.

License

MIT © Meqdad Darwish