Board

BBC micro:bit V2 simulator, matrix and all

Mokxi models the micro:bit V2 on our own Cortex-M4 core, running the nRF52833 at 64 MHz. GPIO and GPIOTE, three TIMERs, RTC0, UARTE0, CLOCK, NVMC and FICR at their real addresses, the 5x5 LED matrix scanned the way the hardware scans it, and the two buttons and the speaker on the pads they really sit on.

Start building free
  • 7peripheral areas modeled
  • 3projects ready to run
  • Real timeon your own machine
BBC micro:bit V2: blinklive0.000 s 0.00x
Click to open it in the editor
The board is running real firmware right now. Click it to open the circuit in the editor.
The model

What is modeled

Taken from the board's own contract document and put in plain words, with what is missing beside it.

Modeled

Core
Cortex-M4 (ARMv7-M) at 64 MHz, with SysTick and the NVIC and the three priority bits the nRF52 family implements
GPIO
Both ports, with the real OUT, DIR, IN and PIN_CNF registers, and the 13 k pull-ups and pull-downs the product specification gives
GPIOTE
Event and task channels plus the PORT event, so a pin change raises an interrupt rather than being polled
TIMER0 to TIMER2 and RTC0
Real prescalers, bit modes, shorts and compare channels; the RTC counts the 32.768 kHz LFCLK
UARTE0
EasyDMA and the legacy one-byte registers, paced at the configured baud rate, wired to the serial monitor
The LED matrix
Twenty-five LEDs on five row and five column pads, scanned a row at a time from the SysTick interrupt, exactly as the real board lights 25 LEDs from ten pins
Buttons and the speaker
A on P0.14 and B on P0.23 behind the board pull-ups; the speaker on P0.00, sounding while the edges keep coming

Not modeled

  • The radio. There is no 2.4 GHz anything in the model, so no Bluetooth and no micro:bit to micro:bit messages.
  • The sensors: the accelerometer, the compass and the microphone. The touch logo is not wired either.
  • SAADC, PWM and PPI. analogRead and hardware PWM have no peripheral behind them yet; tone() is a square wave that the TIMER1 compare interrupt toggles.
  • MakeCode and MicroPython .hex files. The firmware runtime here is ours, and it is Arduino-shaped.
Start here

Open one and press Run

Each of these opens in the editor exactly as it is drawn here.

Projects

Every built-in project on the BBC micro:bit V2

Each has its own page with the circuit running, the code and a parts list.

Libraries

Arduino libraries that compile as they are

Paste a tutorial that includes one of these and it builds. For any other library, the build names the Mokxi header that does the same job.

Servo.h
attach, write, writeMicroseconds, read, detach, on any pin
Wire.h
I2C as a master; Wire.begin() puts it on pin 20 (SDA) and pin 19 (SCL)
SPI.h
transfer and transactions, on the board’s usual SPI pins
EEPROM.h
read, write, update, get, put and EEPROM[i], kept in 4 KB of RAM, which a reset clears: this board has no EEPROM to write
LiquidCrystal_I2C.h
the 16x2 LCD behind its I2C backpack
Adafruit_GFX.h and Adafruit_SSD1306.h
the 128x64 I2C OLED: text, pixels, lines, rectangles, circles, triangles and bitmaps
DHT.h
the DHT11 and DHT22: temperature, humidity and the heat index, as floats you can print
OneWire.h and DallasTemperature.h
DS18B20 thermometers, any number on one pin, found by the 1-Wire search

And 14 more, 22 in all: Adafruit_BME280.h, Adafruit_BMP280.h and SparkFunBME280.h; RTClib.h; Adafruit_SHT31.h; Adafruit_PCF8591.h; Adafruit_ADXL345_U.h; LedControl.h; Adafruit_LEDBackpack.h; Adafruit_TCS34725.h; Adafruit_SGP30.h; Adafruit_INA219.h; Adafruit_ADS1X15.h; Adafruit_MCP23X17.h; Bounce2.h; HX711.h.

Questions

Is it free?

Yes. Every board and every part is on the free plan, with no account needed.

Which micro:bit?

The V2, on the nRF52833. The V1 is a different chip and is not modeled.

Does it run MakeCode or MicroPython?

No. Those ship as .hex images built against the vendor stack; the runtime here is ours and it is Arduino-shaped. Write the sketch in C++ and press Run.

Does it simulate the radio or the accelerometer?

No. There is no radio and no sensor in the model, and there is no pretense of one.

Why is the board beside the breadboard rather than in it?

A micro:bit has no header to push in. The five big rings sit along its bottom edge, and on a desk it is wired with crocodile clips, so here it stands over the board and reaches it with jumpers.

Try it on your own firmware

What you build here runs on the board on your desk, unchanged. Nothing to install and no account needed.