+ All Categories
Home > Documents > Finney Microbit Inside Out - Newcastle University

Finney Microbit Inside Out - Newcastle University

Date post: 23-Feb-2022
Category:
Upload: others
View: 11 times
Download: 0 times
Share this document with a friend
53
The micro:bit… inside and out Joe Finney [email protected] School of Computing and Communications Lancaster University UK [email protected]
Transcript
Page 1: Finney Microbit Inside Out - Newcastle University

The micro:bit… inside and out

Joe Finney

[email protected]

School of Computing and Communications

Lancaster University UK

[email protected]

Page 2: Finney Microbit Inside Out - Newcastle University

School of Computing and Communications: InfoLab21

Page 3: Finney Microbit Inside Out - Newcastle University

What computers used to look like… (I had one of these!)

Commodore 64 ( I had one of these)

Page 4: Finney Microbit Inside Out - Newcastle University

What computers used to look like… (I didn’t have one of these – but martin did!)

Sinclair ZX Spectrum (I didn’t have one of these)

Page 5: Finney Microbit Inside Out - Newcastle University

And then there was this one too!

BBC Model B (Delivered free to every school in the UK in the 1980s)

Page 6: Finney Microbit Inside Out - Newcastle University

Circa January 2015

Page 7: Finney Microbit Inside Out - Newcastle University

Micro:bit Legend

Howard Baker

Page 8: Finney Microbit Inside Out - Newcastle University

“We have some prototypes…”

BBC R&D by Michael Sparks early 2015… http://www.bbc.co.uk/rd/blog/2015-07-prototyping-the-bbc-microbit

Page 9: Finney Microbit Inside Out - Newcastle University

Delivered by a wide partnership

Page 10: Finney Microbit Inside Out - Newcastle University

More Prototyping…

The micro:bit SB1…

Page 11: Finney Microbit Inside Out - Newcastle University

And More Prototyping…

Micro:bits of Legend…

Page 12: Finney Microbit Inside Out - Newcastle University

In the most unlikely places…

Micro:bit SB2 Proof of Concept…

Page 13: Finney Microbit Inside Out - Newcastle University

In the most unlikely places…

Micro:Bit Font is called “Pendolino” for a reason…

Page 14: Finney Microbit Inside Out - Newcastle University

In the most unlikely places…

Micro:bit device drivers largely written at the car park at Cockerham Junior Football Club…

Page 15: Finney Microbit Inside Out - Newcastle University

A whirlwind of events…

Page 16: Finney Microbit Inside Out - Newcastle University

But not without its problems…

Page 17: Finney Microbit Inside Out - Newcastle University

We delivered 22nd March 2016…

Page 18: Finney Microbit Inside Out - Newcastle University

DEMO: Coding a micro:bit with MakeCode

Page 19: Finney Microbit Inside Out - Newcastle University

Inside the micro:bit…

25 LED matrix screen Light sensor User definable buttons

17 Digital input/output 6 Analog input 3 PWM output 3 Touch sensitive I2C, SPI, UART

Page 20: Finney Microbit Inside Out - Newcastle University

Inside the micro:bit…

16MHz ARM Cortex M0 16KB RAM, 256K FLASH

USB Storage/Serial/Debug

3 axis accelerometer 3 axis magnetometer Temperature sensor Bluetooth Low Energy

Page 21: Finney Microbit Inside Out - Newcastle University

How it all works…

Page 22: Finney Microbit Inside Out - Newcastle University

Blocks <-> JavaScript Editors

Simulator Compiler

Micro:bit DAL Runtime

pxt.microbit.org

TypeScript

Web sites

PXT

Devices

Page 23: Finney Microbit Inside Out - Newcastle University

Introducing the micro:bit runtime

Provides a Device Abstraction Layer (DAL) for the BBC micro:bit

Built on the ARM mbed platform and Nordic libraries

Accessible C/C++ component based API for all capabilities of device

Open source (MIT licence)

Designed with many requirements in mind: High level language features in mind (concurrency, eventing models and managed types)

RAM efficiency

Power efficiency

http://lancaster-university.github.io/microbit-docs/

Page 24: Finney Microbit Inside Out - Newcastle University

The micro:bit runtime architecture

The micro:bit community encourages many languages…

Page 25: Finney Microbit Inside Out - Newcastle University

The micro:bit runtime architecture II

Page 26: Finney Microbit Inside Out - Newcastle University

Eventing and the Message Bus

Many languages support the concept of events.

This is also something that kids find familiar from visual languages such as Scratch.

And something that lends itself to embedded systems too… e.g.

Page 27: Finney Microbit Inside Out - Newcastle University

Eventing and the Message Bus

The micro:bit runtime contains a simple yet powerful extensible eventing model

Events are themselves a very simple managed type.

Contain two numeric values: a source and a value.

Every component in the runtime has a unique ID – the source of an event.

Each component can then create ANY value with that ID as a source at any time:

MicroBitEvent e(MICROBIT_ID_GESTURE, MICROBIT_ACCELEROMETER_EVT_SHAKE);

#define MICROBIT_ID_GESTURE 27

#define MICROBIT_ACCELEROMETER_EVT_SHAKE 11

Page 28: Finney Microbit Inside Out - Newcastle University

Eventing and the Message Bus

The MessageBus then delivers events to any code that registers an interest.

Functions can be either plain C functions, or C++ methods.

Wildcard values can also be used to capture lots of events at once.

void onShake(MicroBitEvent e)

{

// do something cool here!

}

int main()

{

uBit.messageBus.listen(MICROBIT_ID_GESTURE, MICROBIT_ACCELEROMETER_EVT_SHAKE, onShake);

}

Page 29: Finney Microbit Inside Out - Newcastle University

Eventing and the Message Bus The runtime generates a range of events application can build on.

Users can also define their own events easily… just numbers!

#define MICROBIT_ACCELEROMETER_EVT_TILT_UP 1

#define MICROBIT_ACCELEROMETER_EVT_TILT_DOWN 2

#define MICROBIT_ACCELEROMETER_EVT_TILT_LEFT 3

#define MICROBIT_ACCELEROMETER_EVT_TILT_RIGHT 4

#define MICROBIT_ACCELEROMETER_EVT_FACE_UP 5

#define MICROBIT_ACCELEROMETER_EVT_FACE_DOWN 6

#define MICROBIT_ACCELEROMETER_EVT_FREEFALL 7

#define MICROBIT_ACCELEROMETER_EVT_SHAKE 11

#define MICROBIT_BUTTON_EVT_DOWN 1

#define MICROBIT_BUTTON_EVT_UP 2

#define MICROBIT_BUTTON_EVT_CLICK 3

#define MICROBIT_BUTTON_EVT_LONG_CLICK 4

#define MICROBIT_BUTTON_EVT_HOLD 5

#define MICROBIT_BUTTON_EVT_DOUBLE_CLICK 6

#define MICROBIT_RADIO_EVT_DATAGRAM 1

Page 30: Finney Microbit Inside Out - Newcastle University

Fiber Scheduler: Providing Concurrent behaviour…

…or at least apparently concurrent behaviour!

Take this simple example again. What behaviour would you expect?

Given that show string will scroll the given text on the 5x5 matrix display…

Page 31: Finney Microbit Inside Out - Newcastle University

Fiber Scheduler: Providing Concurrent behaviour…

Fibers can be created at any time, and execute independently

By design, a non pre-emptive scheduler to reduce potential race conditions.

Fibers can sleep, or block on events on the MessageBus

Anytime there’s nothing to do… processor enters a power efficient sleep

void doSomething()

{

while(1)

{

uBit.display.print(‘A’);

uBit.sleep(100);

}

}

void doSomethingElse()

{

while(1)

{

uBit.display.print(‘B’);

uBit.sleep(100);

}

}

Page 32: Finney Microbit Inside Out - Newcastle University

Fiber Scheduler: Providing Concurrent behaviour…

void onButtonA()

{

uBit.display.scroll(“hello”);

}

void onButtonB()

{

uBit.display.scroll(“goodbye”);

}

// Then in your main program...

uBit.messageBus.listen(MICROBIT_ID_BUTTON_A, MICROBIT_BUTTON_EVT_CLICK, onButtonA);

uBit.messageBus.listen(MICROBIT_ID_BUTTON_B, MICROBIT_BUTTON_EVT_CLICK, onButtonB);

Page 33: Finney Microbit Inside Out - Newcastle University

Device Drivers Each hardware component is supported by a corresponding C++ object:

MicroBitAccelerometer

MicroBitButton

MicroBitMultiButton

MicroBitCompass

MicroBitDisplay

MicroBitIO

MicroBitLightSensor

MicroBitRadio

MicroBitSerial

MicroBitStorage

MicroBitThermometer

Page 34: Finney Microbit Inside Out - Newcastle University

Putting the pieces together…

SimulatorEditors

C++

TypeScript

Blockly

ARMbinary

ARMAssembly

IR

mapping

JavaScript

ARMbinary

Linker

compile

ARMbinary

ARMbinary

link

cached copy

decompileCloud-based compilation

TypeScript

Page 35: Finney Microbit Inside Out - Newcastle University

Memory Footprint

micro:bit has 16Mhz Nordic nrf51822 CPU (32 bit Cortex M0)

256 KB FLASH memory, 16KB SRAM…

micro:bit runtime

NordicSoft Device

BLE Bootloader 16 KB

98 KB

FLASH MEMORY SRAM MEMORY

NordicSoft Device

stack 2 KB

8 KB

ARMmbed/Nordic-sdk 2 KB

1.5 KB

User data 2.5 KB

micro:bit runtime

ARMmbed/Nordic-sdk 20 KB

~50 KB

User data ~72 KB

Page 36: Finney Microbit Inside Out - Newcastle University

Power Efficiency

Pi 3 ~ 2000mWhttps://www.raspberrypi.org/help/faqs/

Pi Zero ~500mWhttp://raspi.tv/2015/raspberry-pi-zero-power-measurements

http://www.reuk.co.uk/wordpress/microbit-battery-capacity/

Page 37: Finney Microbit Inside Out - Newcastle University

What can you do?

Baseball pitch counter – HawaiiMicro:bit in Space – Rishworth SchoolAir guitar – Tech Will Save UsMicro:bit as a security deviceMicro:bit family fun day – IET/Schneider Electric

Page 38: Finney Microbit Inside Out - Newcastle University

What can you do?

IET Faraday Challenge Day 2016 winners… the “No-Nod” by Kings School, Winchester. Meeting the Princess Royal at the opening of IET Savoy Place

Page 39: Finney Microbit Inside Out - Newcastle University

What can you do?

Veggard from Norway (age 12)

Page 40: Finney Microbit Inside Out - Newcastle University

What can you do?

Page 41: Finney Microbit Inside Out - Newcastle University

What can you do?

Page 42: Finney Microbit Inside Out - Newcastle University

What can you do?

Page 43: Finney Microbit Inside Out - Newcastle University

• 13 million visits to the

micro:bit website

• Nearly 10 million code

simulator runs

• And nearly 2 million

compiles to the device

A positive impact that is changing

attitudes

• 70% increase in the number

of girls that said they would

definitely choose computing

• 86% said it made computer

science more interesting

• 88% said it showed that

coding isn’t as hard as they

thought

Source: Discovery Research Report for BBC Learning

The Outcome?

Page 44: Finney Microbit Inside Out - Newcastle University

Going Forward…

Page 45: Finney Microbit Inside Out - Newcastle University

Blocks <-> JavaScript Editors

Simulator Compiler

Runtime

pxt.microbit.org mini.pxt.io adafruit.pxt.io

TypeScript

Web sites

PXT

Devices

Page 46: Finney Microbit Inside Out - Newcastle University

The future is now!

Joe Finney

Micro:bit Foundation

Page 47: Finney Microbit Inside Out - Newcastle University

Vision:

In the future, every child will be an inventor

Page 48: Finney Microbit Inside Out - Newcastle University

Mission:

To empower children, parents and teachers around the globe to learn and innovate using the micro:bit

Page 49: Finney Microbit Inside Out - Newcastle University

Big Objective:

100M people globally will use a micro:bit

Page 50: Finney Microbit Inside Out - Newcastle University

BBC micro:bit is going global

Now available in 32 countries

microbit.org in 8 languages

National roll-outs in UK, Iceland, Croatia

78 partner ecosystem

globally!

Page 51: Finney Microbit Inside Out - Newcastle University

Croatia: 1000 primary schools Crowd Funded…

Page 52: Finney Microbit Inside Out - Newcastle University

Sri Lanka: Early Days…

micro:bit User Group Sri Lanka

Page 53: Finney Microbit Inside Out - Newcastle University

Key Take Away…

Everyone can help, visit us at http://microbit.org to find out how!

Call to Action

All children are natural inventors, which micro:bit

is helping unleash!


Recommended