← Micro:bit

Chapter 1 · Book pp. 7–15

Meet the Micro:bit

Micro:bit บอร์ดไมโครคอนโทรลเลอร์เพื่อการเรียนรู้ระดับโลก

The Micro:bit is a small computer, only 4 × 5 cm, made for learning to code. A normal computer runs many programs on a screen. A microcontroller (ไมโครคอนโทรลเลอร์) runs one program and connects directly to lights, buttons and sensors.

Why the BBC built it

In the 1980s the BBC Micro computer taught a whole generation of British students to program. The BBC wanted to do that again, because it sees computing (วิทยาการคำนวณ) as a basic skill for everyone.

So it worked with partner companies, and Lancaster University helped design a board that was cheap and easy to learn on. About 1 million boards were given free to students in Year 7, the same age as Thai M.1.

What can you make?

  • A dice that rolls when you shake it
  • Rock, paper, scissors with a friend
  • An electronic compass
  • A name badge, or a doll or bag with a picture that changes
  • Games between boards, using radio

The book’s idea is to start with something real you can hold, then move on to the abstract ideas. You see your code do something in your hand.

Next: the hardware →

1.1 What is on the board ความสามารถของฮาร์ดแวร์

🔍 Front of the board

A B 0123VGND

Click a dashed area.

🔍 Back of the board (V1)

USB RESET BATTERY MAIN CPU MOTION COMPASS USB CHIP

Click a dashed area.

Power

The board runs on 3.3 V. USB gives 5 V, and the KL26Z chip lowers it to 3.3 V. A battery pack gives about 3 V directly through the small JST socket. Connect one or the other.

✏️ Book correction

The book calls the pins “GPIB”. The usual word is GPIO, General Purpose Input/Output, and GPIB is a different thing. The book also numbers two different pictures as Fig 1-8.

Next: V1 and V2 →

V1 and V2 (not in the book)

The book was written in 2018 for V1. A newer V2 arrived in 2020. The buttons, display and pins stay in the same places, so the labs in this course work on both. To check yours, turn it over: V2 has a notched gold edge and a small microphone hole.

FeatureV1 (the book)V2
ProcessornRF51822, 16 MHznRF52833, 64 MHz
Flash memory256 KB512 KB
RAM16 KB128 KB
SpeakerNoYes
MicrophoneNoYes
Touch logoNoYes

Next: the software →

1.2 Software for the Micro:bit ซอฟต์แวร์สำหรับพัฒนาโปรแกรม

Good hardware does nothing without code. You have three main choices.

EditorYou writeGood for
MakeCode BlocksColoured blocks you drag togetherBeginners. This course uses it.
MakeCode JavaScriptText, one click away from your blocksMoving from blocks to text
MicroPythonPython text, with no blocksStronger programmers

This is the beating heart from Chapter 3, written in MicroPython:

from microbit import *

while True:
    display.show(Image.HEART)
    sleep(100)
    display.show(Image.HEART_SMALL)
    sleep(100)

From your code to the board

  1. You build a program in the browser.
  2. The editor turns it into a .hex file.
  3. You copy the file to the MICROBIT drive.
  4. The board restarts and runs it.

🕒 Changed since the book

  • The book says you must register. You do not: open makecode.microbit.org and start.
  • The book says code is sent to mbed.com to compile. MakeCode now does this in your browser.
  • “Microsoft PXT” is now called Microsoft MakeCode.
  • The book sometimes says “Java”. It means JavaScript, a different language.
  • The Python editor is now at python.microbit.org.

Next: the community →

1.3 A strong community Community ที่แข็งแกร่ง

Teachers, programmers and students around the world share projects and lessons. Companies make add-on boards, such as breadboard adapters, robot car kits and INEX’s AX-microBIT+ from Thailand, which we use in the next chapter.

Start at microbit.org for projects, lessons and technical details. Its menus have changed since the book, so look for the same topics rather than the same button names.

Next: review →

Chapter summary

  • The Micro:bit is a small microcontroller board that the BBC created to teach coding.
  • It has 25 LEDs, two buttons, motion and compass sensors, Bluetooth and an edge connector.
  • You can code it with MakeCode blocks, JavaScript or MicroPython.
  • Programs reach the board as .hex files.
  • V2 is faster and adds a speaker, a microphone and a touch logo.

🛠️ Activity · Know your board

  1. Pick up a Micro:bit and find every part from the two diagrams, without looking.
  2. Decide whether your board is V1 or V2. How can you tell?
  3. List three things you would like to make with it, and the parts each one needs.

Check yourself

The book has no end-of-chapter questions, so these are my own, based on its pages.

1. Who started the Micro:bit project?
2. How many LEDs does the display have?
3. Which part lets the Micro:bit notice that you shook it?
4. What does the KL26Z chip do on the V1 board?
5. Which of these does a V2 board have that the book’s V1 does not?
6. You want to drag blocks and then switch to text. Which editor do you use?
7. Which language does the MicroPython option use?
8. What file do you put on the Micro:bit to run a program?