Skip to main content
Version: ACS CC

Project Name

Microbit mini-console.

info

Author: Theodhoraq Mihallari
GitHub Project Link: link_to_github

Description

A mini-console for small games that two or more people can play.The games are:

  1. Rocket and meteor The player moves the rocket using the microbit's buttons left and right to avoid collision with the meteor coming from above.
  2. Guess the distance The microbit gives a random distance and players must put an object as close to a ultrasonic sensor (HCSR) as possible,who's nearest wins.
  3. Repeat the pattern The microbit outputs in a random pattern moves of 4 types (UP,DOWN,LEFT,RIGHT). The player,through a joystick,must repeat that pattern.If wrong,the game restarts. The speed and difficulty increase with time.

Motivation

I couldn't think of anything meaningfull to do,given our situation and resources so i picked this project because of how versatile it can be,i can implement multiple ideas with different hardware,and turn it into something fun.Also given how compact the microbit is,and with build in screen and buttons it would be a big help. (Since I'll be using a breadboard connecting screens and buttons would just make the product messy)

Architecture

Given the limited number of inputs on the microbit,we have to connect the components for each game (it's also cleaner that way)

Components: Microbit (with buttons and screen) Joystick - HW-504 Ultrasonic sensor - HC-SR04

Architecture Diagram 1 Architecture Diagram 2

Log

Week 5 - 11 May

Hardware assembly,planification

Week 12 - 18 May

Microbit-Rust research,getting to know things and what to use to make them work

Week 19 - 25 May

19 - first commit of software with the first 2 games,the second needs a bit more work

Hardware

Micro:bit Purpose: Main microcontroller unit Function: Controls the entire system logic, reads sensor input, drives the display, and handles button presses.

HC-SR04 (Ultrasonic Sensor) Purpose: Measures distance to nearby objects Function: Emits ultrasonic waves and calculates distance based on echo return time. The Micro:bit reads these measurements to detect proximity or obstacles.

HW-504 (Joystick Module) Purpose: Provides directional input Function: Acts as a 2-axis analog input device.

Breadboard + jumper wires Purpose: Prototyping without soldering and electrical connections between components Function: Connect all the components

Schematics

Schematic 1 Schematic 2

Photo 1 Photo 2

Bill of Materials

DeviceUsagePrice
MicrobitMicrocontroller75 RON
HC-SR04Ultrasonic sensor8 RON
HW-504Joystick6 RON
BreadboardConnect all components10 RON

Software

LibraryDescriptionUsage
defmtLightweight logging frameworkEfficient debug output (e.g., over RTT for microcontrollers)
defmt-rttRTT (Real-Time Transfer) backend for defmtSends log messages to host over debug interface
panic-haltMinimal panic handlerHalts MCU on panic (no backtrace)
cortex-mLow-level Cortex-M functionalityAccess to interrupts, critical sections, etc.
cortex-m-rtRuntime for Cortex-MDefines the #[entry] point for bare-metal apps
embedded-halHardware Abstraction Layer (HAL) traitsTraits for GPIO, Delay, RNG, etc.
microbitHAL and board support crate for BBC micro:bitAccess to board pins, peripherals, display, etc.

I used this repo as a starting point and as a scheleton for my project

https://github.com/nrf-rs/microbit

Big thanks to the microbit-Rust community!

Also usefull

https://docs.rs/microbit/latest/microbit/

https://docs.rust-embedded.org/discovery/microbit/

...