DF ROBOT BOSON KIT Safety guide

A STARTER GUIDE
OF BOSON KIT
FOR MICRO:BIT

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
2/ 86
Contents
.................................................................................................................1
Contents......................................................................................................................................................2
Chapter 1: MakeCode and micro:bit .......................................................................................................5
An Introduction to MakeCode ..................................................................................................................5
A Brief Introduction to micro: bit................................................................................................................5
How to Use micro:bit ...................................................................................................................................6
STEP 1: Open MakeCode........................................................................................................................7
STEP 2: Connect micro: bit to computer...............................................................................................7
STEP 3: Start a New Project......................................................................................................................8
STEP 4: Download the program and upload to micro: bit ...............................................................10
Chapter 2:What Makes a Machine “Come to Life” ..........................................................................14
Interactive devices....................................................................................................................................14
Input Unit —— sensor .............................................................................................................................14
Control Unit ——micro: bit.....................................................................................................................14
Output Unit —— actuator .....................................................................................................................14
Relationship between Program and Hardware ....................................................................................15
The Boson Expansion Board for micro: bit...........................................................................................15
Chapter 3:Get hands on! ......................................................................................................................16
Project 1: The Mysterious Micro: bit.........................................................................................................16
Components list .........................................................................................................................................16
Connection.................................................................................................................................................17
Program.......................................................................................................................................................17
Exercises ......................................................................................................................................................20
Project 2:Flashing LED Light ...................................................................................................................21
Components list .........................................................................................................................................21
Connection.................................................................................................................................................22
Program.......................................................................................................................................................22
Exercise........................................................................................................................................................24

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
3/ 86
Project 3: Notification Light......................................................................................................................25
Components list .........................................................................................................................................25
Connection.................................................................................................................................................26
Program.......................................................................................................................................................26
Exercise:.......................................................................................................................................................30
Project 4: Electric Fan...............................................................................................................................31
Components list .........................................................................................................................................31
Connection.................................................................................................................................................32
Program.......................................................................................................................................................33
Chapter 4: A bit further ............................................................................................................................37
Project 1: Electronic Candle....................................................................................................................37
Components list .........................................................................................................................................37
Connection.................................................................................................................................................38
Program.......................................................................................................................................................38
Project 2: Automatic Door .......................................................................................................................42
Components list .........................................................................................................................................42
Connection.................................................................................................................................................43
Program.......................................................................................................................................................43
Project 3: Music Box .................................................................................................................................48
Components list .........................................................................................................................................48
Connection.................................................................................................................................................49
Program.......................................................................................................................................................49
Project 4: Colorful LED Strip ......................................................................................................................54
Components list .........................................................................................................................................54
Connection.................................................................................................................................................55
Program.......................................................................................................................................................55
Chapter 5: Become an expert ................................................................................................................63
Project 1: Electronic Stabilizer .................................................................................................................63
Components list .........................................................................................................................................63
Connection.................................................................................................................................................64
Program.......................................................................................................................................................64
Exercises ......................................................................................................................................................66
Project 2: DJ panel ...................................................................................................................................67

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
4/ 86
Components list .........................................................................................................................................67
Connection.................................................................................................................................................68
Program.......................................................................................................................................................68
Exercises ......................................................................................................................................................70
Project 3: Remote Doorbell......................................................................................................................71
Component list...........................................................................................................................................71
Connection.................................................................................................................................................72
Program.......................................................................................................................................................73
Exercise........................................................................................................................................................76
Project 4:Escape the maze ...................................................................................................................77
Components list .........................................................................................................................................77
Connection.................................................................................................................................................78
Program.......................................................................................................................................................78
Exercise........................................................................................................................................................85
Remember to check out the DFRobot blog for more tutorials, projects and latest trends. The link
can be found on the top left corner of the page.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
5/ 86
Chapter 1: MakeCode and micro:bit
An Introduction to MakeCode
MakeCode for micro: bit is one of the most widely used graphical programming environment from
the micro: bit website. It is an open source project developed by Microsoft.
A Brief Introduction to micro: bit
micro:bit is a pocket-sized microcontroller designed for kids and beginners learning how to
program, letting them easily bring ideas into DIY digital games, interactive projects and robotics.
micro:bit comes with a variety of on-board modules, including a 5x5 LED matrix (also supports light
detection), 2 programmable buttons, motion detector, Compass and Bluetooth® Smart module.
Additionally, you may attach more modules such as a servo motor, RGB LED lights through 5 I/O
rings or 20 edge connectors.
The micro:bit can be used to realize many cool ideas. Everything you can imagine, a robot,
electric instrument, or even a home automation system. The possibilities are endless! The micro: bit
holds a host of innovative features such as 25 red LEDs to display messages and two
programmable buttons to control game or control music. It can detect motion, recognize gesture,
and be interconnected with other devices or the Internet via Bluetooth connection.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
6/ 86
The micro: bit is equipped with light and temperature sensors and other common sensing devices, which
means that it itself can also produce a lot of common smart products used in our daily lives.
How to Use micro:bit
If you are new to micro: bit, you can start with the online programming platform- The MakeCode
Editor, to learn about how to program the micro: bit.
Before getting started, please make sure that the following items are ready by your hand. In
addition, you will also need a computer running operating systems such as Windows 10 / Mac OS /
Linux and with Internet connectivity.
COMPONENTS LIST:
Micro:bit Mainboard USB cable

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
7/ 86
The following steps are based on Windows 10 OS. It can be used as a reference for other operating
systems.
STEP 1: Open MakeCode
Visit the MakeCode page from the following link: https://makecode.microbit.org/
STEP 2: Connect micro: bit to computer
Micro: bit connects to computer via the USB cable. The power indicator on the back side of the
micro: bit will light up when connected.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
8/ 86
Before programming, we should make sure that the mainboard is recognized by the computer.
When micro: bit is connected, a "MICROBIT" directory will show up in “My Computer”.
STEP 3: Start a New Project
Before starting a new project, we will need to first get familiar with the programming interface.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
9/ 86
Simulation window: simulates the operating status of micro: bit. During the process of programming,
you can always check how your program looks like the through the window.
Function area: Where you can find all the function blocks, including input, output, loop, logic, etc..
Programming area: Dragged the blocks from “Function area”, stack them up and build your
program here.
Click "Project" at the top of the simulation window.
Then, click "New Project".

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
10 / 86
STEP 4: Download the program and upload to micro: bit
When we have finished our program, we can now download it from the website and uploaded to
micro: bit. We can also rename the project and save it in the browser. The project will stay in “my
stuff ”.
Before downloading, we can check the simulated results in the simulation window. The buttons in
the lower part of the simulation window can be used to control the analog micro:bit.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
11 / 86
Click "Download" in the lower part of the simulation window and select "Save As" in the pop-up
dialog box.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
12 / 86
Choose to save the “.hex”file to "MICROBIT Disk" and click "Save".
During the process of downloading, the power indicator on the back of micro: bit will blink. When
completed, it will stop flashing and keep on going.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
13 / 86
Now you are all good for basic setups. Remember to visit our blog to check out more micro: bit
projects. Please also leave a comment if there you have question or new idea to share.
https://www.dfrobot.com/index.php?route=DFblog/blogs

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
14 / 86
Chapter 2:What Makes a Machine “Come to Life”
Interactive devices
In the next few chapters, we'll build interactive projects such as a button controlled single LED, a
simple colorful LED animation, or even make our own music. These devices can be categorized as
"interactive devices." In order to help build a better understanding of their mechanisms, we need
to first understand how they are composed.
The simplest interaction device consists of 3 parts:
Input unit for command acceptance or data
collection
Control unit for data or signal processing
Output unit for sending data or executing actions
You must be confused by these conceptions and eager to know how they actually function. Let’s
taking our own body as an example, we collect information in the form of light, sound, taste, and
power through our eyes, ears, nose, and skin. These information enter our brains and determine
what response to take. Ultimately, we take physical actions based on these information to change
the material environment. Specifically, your friend, for example, says "hello" to you, and you
respond "hello". Here, your ears act as input units, your brain acts as a control unit, and your mouth
plays the role of output unit.
Similarly, while building projects by using the micro: bit, we will use a variety of sensors as the input
units, the micro:bit as the control unit, and the actuator as the output unit.
Input Unit —— sensor
Sensors (also called transducers) are physical components that detect the environmental
characteristics such as light, temperature, humidity, etc. and convert them into signal data. In this
tutorial, sensors such as buttons, sound sensors and temperature sensors will be applied.
Control Unit ——micro: bit
The micro: bit will act as a control unit in this tutorial, using the signal pins to establish connections
between input units and output units and processing the data in the calculation processing
module.
Output Unit —— actuator
The actuator is the one responsible for moving or controlling a system or a mechanism. It converts
electrical energy into motion, sound and light. In this tutorial, the actuators such as LEDs, small fans
and servos will be applied.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
15 / 86
Relationship between Program and Hardware
The input unit, control unit and output unit mentioned above are physical components. As for
human-being, the hardware includes the body, brain and limb. However, what actually controls
the behavior of our physical body is our “mind”. The program here is like our mind and what we will
explain is how to setup the “mind” of the micro: bit so it will do whatever we ask it to do.
The Boson Expansion Board for micro: bit
The Boson expansion board is to enable micro: bit to connect external modules, including buttons,
switches modules, and sensors. It not only simplifies the circuit connection, but also make micro: bit
more powerful.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
16 / 86
Chapter 3:Get hands on!
You may now have a rough idea about what micro: bit and expansion board are and how
MakeCode operates. You must be eager to get a hand on it by yourself. So, let's start the magical
journey of Boson for micro: bit!
Project 1: The Mysterious Micro: bit
We will start our first project, a simple emojis panel, to get a bit more familiar with what we have just
learned in the previous chapter.
Emojis can be seen on almost every smartphone and computer, they might appear as follow:
love be cool I am watching you
In this chapter, we will show you how to design your own emojis by programming the micro:bit.
There are 5 * 5 (25) on-board LEDs on the micro: bit. We can control these LEDs to form different
patterns to show the emojis.
Components list
1 ×micro:bit
1 ×USB cable

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
17 / 86
Connection
Connect micro: bit to computer via USB cable.
Program
Open MakeCode: https://makecode.microbit.org/.
STEP 1: Start a new project. You may go back to the last chapter if you forget how to do it.
STEP 2: Click "Basic" at the top of the function area and find the "show leds" function.
STEP 3: The module "on start" will automatically appears in the programming area after you first
open the online website of MakeCode, or you can drag the "on start" function on the bottom of
"Basic" to the programming area.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
18 / 86
STEP 4: Drag the "show leds" function to the programming area and place it in "on start".
When "show leds" function is inside the “on start” module, you can then click the light blue dot
inside the block to edit the pattern. Also, whatever we draw inside the block will be displayed in
the simulation window.

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
19 / 86
STEP 5: Here, we draw a heart in the block. To help us remember, we may rename it as "heart".
STEP 6: Click "Download" to save the file to MICROBIT to the computer, or you may directly save it to
micro: bit. If everything goes well, the micro: bit will then display a "heart " emoji. (If you forget how
to upload the code, go back and check the STEP 4 in Chapter 1)

Welcome to the DFRobot blog:www.dfrobot.com/blog-tag-microbit.html
20 / 86
Exercises
Try to design an emoji that can switch between two different patterns.
Table of contents
Other DF ROBOT Computer Hardware manuals
Popular Computer Hardware manuals by other brands

Aaeon
Aaeon UPN-EHLCB Quick installation guide

Alcatel
Alcatel onetouch v100 quick start guide

Epson
Epson CMOS 32-Bit Single Chip Microcomputer... Technical manual

Rabbit
Rabbit RabbitCore RCM4100 user manual

Adaptec
Adaptec ACB-232XD installation guide

Lucent Technologies
Lucent Technologies Definity Audix System Pocket reference

Resolution Products
Resolution Products RE926S-03-00 OWNER'S OPERATION AND INSTALLATION MANUAL

ASROCK Rack
ASROCK Rack EP2C621D12 WS Quick installation guide

Delta Tau
Delta Tau PMAC2-PC/104 installation manual

RAK
RAK LB801 user manual

ZALMAN
ZALMAN CNPS9X OPTIMA user manual

Advantech
Advantech CPC-2520 user manual