BBC micro:bit-Instructions and First Steps

From Embedded Lab Vienna for IoT & Security
Revision as of 20:29, 5 August 2020 by CCinay (talk | contribs) (→‎ At a glance)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

What is the BBC micro:bit?

The BBC micro:bit is a computer that anyone can program themselves. It was developed especially for programming lessons and learning programming languages. The BBC micro:bit is very small, particularly inexpensive and is perfectly suited for use in school lessons. With the BBC micro:bit, children and young people can gain their first experiences with programming and coding. In class and at home it is flexible and versatile for beginners and advanced users. Programming the micro:bit is a piece of cake even for beginners. It is fun and brings immediate feelings of success in the development of the first own computer programs.

The BBC micro:bit success story

The BBC micro:bit was developed as a teaching board microcontroller for children of compulsory school age. It was unveiled in July 2015 and released in March 2016, and by 2017 well over one million of these devices were in use by young programmers.

Learning programming, made easy

Get coding - easier than ever before!

With the micro:bit you can learn programming very easily and playfully. Programming is done, as usual, in the usual browser in the following link:
Microbit-Official-Homepage. In the browser you work with the JavaScript Blocks Editor or with the Python Editor. JavaScript Blocks is especially suitable for beginners. If you are already a bit better at programming, you can use Python (see below for more details). With Python and JavaScript you will get to know two of the most popular programming languages and quickly implement simple programs. Immediate experiences of success show that programming is fun and successes are quickly visible.

  ➥ JavaScript Blocks Editor

  ➥ Python-Editor

micro:bit Facts - Technology&Editors

Get Creative, get connected, get coding

The micro:bit has a 32-bit ARM Cortex M0 processor with 16 KB RAM and 16 MHz clock frequency. On its board there is a display consisting of
25 red LEDs. Here the programmed tickers and symbols are displayed. Two programmable buttons control the programs - e.g. lights are switched on and off automatically. The reset button is located on the back.

The BBC micro:bit has a micro USB port for connection to a PC or notebook. Additionally it can establish a Bluetooth connection to interact with other devices or the Internet. At the bottom of the board there are 20 input/output pins, 6 of which are also analog. Next to the USB port is the battery connector for the required power supply when the micro:bit is not connected to a PC.

The BBC micro:bit also has a compass (magnetometer) and a 3-axis accelerometer. These allow you to determine the position of the micro:bit, the direction it is moving and the speed at which it is moving.

 At a glance

  • BBC-micro-bit-At-A-Glance

 ➥ 32-bit ARM Cortex M0 processor

 ➥ 16 KB RAM, 16 MHz

 ➥ 5x5 LED Matrix

 ➥ 2x programmable buttons; 1x reset button

 ➥ Micro USB port; battery connection (JST PH)

 ➥ Magnetometer; 3-axis acceleration sensor

 ➥ 20 input/output pins (6 analog)

 ➥ Bluetooth Low Power (BLE)

BBC micro:bit features

 ➥ Buttons: are a very common input device. Your micro:bit has two buttons you can program, and a reset button.
   More information by watching the video below. Buttons

 ➥ LED display & light sensor: 25 LEDs arranged in a 5x5 grid make up the display for showing pictures, words and numbers.
  They can also act as sensors, measuring how much light is falling on your micro:bit. More information by watching the video below.
  LED Display & Light Sensor

 ➥ Pins - GPIO: The GPIO pins allow you to connect headphones, sense touch and add other electronics to expand the possibilities of your micro:bit.
   More information by watching the video below. Pins-GPIO

Hardware Description

Review the BBC micro:bit hardware specifications in detail on the micro:bit developer community website. View the tech specs

Overview

  • BBC-micro-bit-Hardware

Button

The two buttons on the front of the micro:bit, and the 1 button on the back, are tact momentary push to make buttons. The back button is connected to the KL26 interface processor and to the nRF51 processor for system reset purposes. This means that the application will reset regardless of if it is powered from USB or from battery.

Front buttons A and B can be programmed in the user application for any purpose. A and B are debounced by software, which also includes short press, long press, and ‘both A+B’ press detection. Buttons operate in a typical inverted electrical mode, where a pullup resistor ensures a logical ‘1’ when the button is released, and a logical ‘0’ when the button is pressed. Both A and B buttons are connected to GPIO pins that are also accessible on the micro:bit edge connector.

 item   details
 Type   2 tactile user buttons, 1 tactile system button
 Debounce   (A & B) software debounced, 54ms period
 Pullup   (A & B) external 4K7, (System) 10K

Display

The display is a 5x5 array of LEDs. It is connected to the micro:bit as a 3x9 matrix. Runtime software repeatedly refreshes this matrix at a high speed, such that it is within the user persistence of vision range, and no flicker is detected. This LED matrix is also used to sense ambient light, by repeatedly switching some of the LED drive pins into inputs and sampling the voltage decay time, which is roughly proportional to ambient light levels.

Power Supply

Power to the micro:bit may be provided via the USB connection, via the interface chip (which has an on-board regulator), or via a battery plugged into the top connector. It is also possible (with care) to power the micro:bit from the 3V pad at the bottom. The 3V pad at the bottom can be used to supply a small amount of power external circuits.

 item  details
 Operating range  1.8V .. 3.6V
 USB current  120mA max
 Onboard Peripherals budget  30mA
 Max current provided via edge connector  90mA

Set up your micro:bit

It’s really simple to get started with the BBC micro:bit

Step 1: Program it

The micro:bit is a tiny computer that makes coding tangible and promotes digital creativity. You create a program to tell it what to do using one of the online code editors, and download it to your computer as a .hex file - a version of your program that your micro:bit can read. For more details follow

Step 2: Transfer your program

When you've created your program in the online editor, transfer it to your micro:bit to make it run independently of your computer. You can even unplug your micro:bit from the computer, attach a battery pack, and your program still runs. More information by watching the video below.
Transferring your program to the BBC micro:bit

Step 3: Connect your micro:bit

Plug the micro USB cable into the USB socket on the top of your micro:bit, and connect the other end of the cable to your computer so you can transfer your program.

  • Connect-your-micro-bit

Step 4: Find your micro:bit, copy your program file

When you plug the micro:bit into your computer's USB socket, it will show up automatically like any other USB storage or memory stick as a drive called 'MICROBIT'.

 ➥ Use the pictures below, how it works in Windows:

  • Copy-Hex-File

JavaScript Blocks Editor

With the JavaScript Blocks Editor you can program in two ways - on the one hand with predefined blocks, on the other hand with real lines of code. Programming with predefined blocks is ideal for children and beginners, as it is the easiest way to develop software. The program commands are lined up one below the other in the form of blocks and thus formed into a functioning program.

  • JavaScript-1

 ➥ The screenshot above shows that a simulation is running in the left area of the display. Here the user can see if his program works.
  In the middle there is a sorted list of commands. From this list, the user selects the desired program parts and drags them to the work area
  on the right side of the screen. There he puts the individual commands together in a logical sequence and thus creates his computer program.
  This option is particularly suitable for gaining initial experience and for learning the basic relationships of a program logic.

 ➥ The following screenshot shows the second way to learn coding is real, genuine JavaScript. No predefined blocks are moved and put together here.
   With this micro:bit editor you learn the actual commands of the programming language JavaScript.

  • JavaScript-2

 ➥ The screenshot shows the button "Blocks | JavaScript" at the top of the menu bar. With this button, the user can quickly and easily switch
   between the two programming variants of the JavaScript Editor with just one click.

Python-Editor

The Python editor is ideal for people who have already gained some experience and now want to deepen their programming skills. As the name suggests, the code in this editor is written in the Python programming language. As with the JavaScript editor, you will receive a short introduction to the programming language before using the Python editor.

 ➥ On the following link: Microbit-Official-Homepage under "Let's code" → "Python editor". You can find the "Python editor".

  • Micro-bit-Lets-code
  • Python-Editor

Connection to the Smartphone

Micro:bit offers smartphone users their own app. With the micro:bit app you can use your micro:bit also via Bluetooth.

In the app there are 4 buttons with which the following main functions can be started:

 ➥Connect: Establishes a connection between smartphone and micro:bit using Bluetooth.

 ➥Flash: Using this function, the user sends a code file (.HEX) from the smartphone to the connected micro:bit.

 ➥Create Code: Opens the desired editor on the website. Programs are written and edited here.

 ➥Discover: This function leads to a website with reference projects - a source of inspiration for teachers and students.

  • Micro-Bit-App

Firmware

You may need to update the firmware on your micro:bit to use features like WebUSB

Checking your firmware version

To find out what version of the firmware you have on your micro:bit, Plug it in via USB, open up the DETAILS.TXT file from the MICROBIT drive and look for the number on the line that begins 'Interface Version'. In this example, the firmware version is 0250:

#DAPLink Firmware - see https://mbed.com/daplink Unique ID: 9900000031634e4500624014000000320000000097969901
#HIC ID: 97969901
#Auto Reset: 1
#Automation allowed: 0
#Overflow detection: 0
#Daplink Mode: Interface
#Interface Version: 0250
#Git SHA: 682d8303e37355532402b8d93c4f240a3cec02a9
#Local Mods: 0
#USB Interfaces: MSD, CDC, HID, WebUSB
#Interface CRC: 0x3f2b7e12
#Remount count: 0URL: https://microbit.org/device/?id=9900&v=0250 

How to update the firmware

 ➥ Disconnect the USB cable and battery pack from the micro:bit.

 ➥ Hold the reset button at the back of the micro:bit and plug the USB lead into the device. You should see a drive appear in your file manager
   called MAINTENANCE (instead of MICROBIT).

  • Update-Firmware

 ➥ The MAINTENANCE drive will look like this, depending on your computer:

  • Windows-Firmware.JPG

 ➥ Download the hex file from this page to your computer: Download Firmware

 ➥ Drag and drop the new firmware .HEX file you downloaded from this page onto the MAINTENANCE drive and wait for the yellow LED on the back of
   the device to stop flashing. When the upgrade is completed, the micro:bit will reset, ejecting itself from the computer
   and re-appear in normal MICROBIT drive mode.

 ➥ Finally, check the DETAILS.TXT file that is on the MICROBIT drive and make sure that it has the same version number as the
   .HEX firmware that you just downloaded and flashed to the interface chip.

Used Hardware

 ➠ BBC micro:bit

Links for learning

 ➠ Beating heart  ➠ Emotion badge  ➠ Dice  ➠ Make some noise  ➠ Basics for Teachers Part 1  ➠ Basics for Teachers Part 2

References

 ➠ https://microbit.org/get-started/user-guide/features-in-depth/#buttons

 ➠ http://www.microbit.at/

 ➠ https://tech.microbit.org/hardware/schematic/

 ➠ https://tech.microbit.org/hardware/#getting-started-with-the-microbit-hardware

 ➠ https://microbit.org/get-started/first-steps/set-up/

 ➠ https://makecode.microbit.org/reference

 ➠ https://microbit.org/get-started/user-guide/features-in-depth/#pins