KS0361 (KS0365) Microbit V2.0 Sensor Learning Kit
KS0361 (KS0365) Microbit V2.0 Sensor Learning Kit
Contents
1. Introduction.......................................................................................................... 5
2.Kit List.................................................................................................................... 12
4.Instructions.......................................................................................................... 18
4.2 Makecode:............................................................................................. 25
4.3.Quick Download..................................................................................... 26
5. Projects................................................................................................................ 38
Project 1: Heartbeat..................................................................................... 38
Project 7: Accelerometer............................................................................. 61
Project 9: Speaker......................................................................................... 74
6. Resources:...................................................................................................... 224
1. Introduction
This new version, that’s the micro:bit 2.0 board, has a touch-sensitive
logo and a MEMS microphone. And there is a built-in buzzer which can
play sounds. The golden fingers and gears added provide a better
long press the Reset & Power button on the back of it. More
importantly, the CPU capacity of this version is much better than that of
reset the Micro: Bit and rerun the program. If you hold it tight, the red
LED will slowly get darker.When the power indicator flickers into
darkness, releasing the button and your Micro: Bit board will enter
sleep mode for power saving .This will make the battery more durable.
And you could press this button again to “wake up” your Micro:bit.
https://tech.microbit.org/hardware/
https://microbit.org/new-microbit/
https://www.microbit.org/get-started/user-guide/overview/
https://microbit.org/get-started/user-guide/features-in-depth/
(3) Pinout
https://tech.microbit.org/hardware/edgeconnector/
https://microbit.org/guide/hardware/pins/
b. Its IO port is very weak in driving since it can merely handle current
via the battery of 3V. The IO port of this board is 3V, so it does not
blocking them from the matrix or the LEDs may display randomly and
2.Kit List
Quanti
No. Components Picture
ty
Keyestudio Micro:
V2
Keyestudio
2 White LED 1
Module
Keyestudio Red
3 1
LED Module
Keyestudio 3W
4 1
LED Module
Keyestudio RGB
5 1
LED Module
Keyestudio
Analog
6 1
Temperature
Sensor
Keyestudio
7 1
Photocell Sensor
Keyestudio
8 Analog Sound 1
Sensor
Keyestudio
9 Potentiometer 1
Sensor
Keyestudio
10 Passive Buzzer 1
Module
Keyestudio
11 Active Buzzer 1
Module
Keyestudio
12 1
Digital Push
Button
Keyestudio
13 1
Digital Tilt Sensor
Keyestudio Photo
14 Interrupter 1
Module
Keyestudio
15 Capacitive Touch 1
Sensor
Keyestudio Traffic
16 1
Light Module
Keyestudio Hall
17 1
Magnetic Sensor
Keyestudio Line
18 1
Tracking Sensor
Keyestudio
19 Infrared Obstacle 1
Detector Sensor
Keyestudio PIR
20 1
Motion Sensor
Keyestudio
21 1
Flame Sensor
Keyestudio Crash
22 1
Sensor
Keyestudio
23 Analog 1
Gas Sensor
Keyestudio
24 Analog Alcohol 1
Sensor
Keyestudio
25 Reed 1
Switch Module
Keyestudio
26 Water 1
Sensor
Keyestudio Soil
27 1
Humidity Sensor
Keyestudio
LM35 Linear
28 1
Temperature
Sensor
Keyestudio
29 1
Vibration Sensor
Keyestudio
30 Thin-film 1
Pressure Sensor
Keyestudio
GUVA-S12SD
31 1
3528 Ultraviolet
Sensor
Keyestudio
32 1
1602 I2C Module
Keyestudio
TEMT6000
33 1
Ambient Light
Sensor
HC-SR04
34 Ultrasonic 1
Module
Keyestudio
35 1
Joystick Module
Keyestudio
36 Micro:bit 1
Servo
Keyestudio
37 Single 1
Relay Module
Keyestudio
38 1
Steam Sensor
40 USB Cable 1
6 AA Battery
41 1
Holder
again.
If it is you first time to use micro:bit main board, then you will have to
First of all, connect the micro:bit to your computer using a USB cable.
And enter website
https://www.dropbox.com/sh/w5mv8mvvufti0uj/AADTFPTV8NBN0IxQ
4.Instructions
The following instructions are applied for Windows system but can also
This chapter describes how to write program with the Micro: bit main
https://microbit.org/guide/quick/
Step 1: connect the Micro: bit main board V2 with your computer
Firstly, link the Micro: bit main board V2 with your computer via the
Note that if you are about to pair the board with your phone or tablet,
https://microbit.org/get-started/user-guide/mobile/
Secondly, the red LED on the back of the board is on, which means the
board is powered. Then Micro: bit main board V2 will appear on your
(If you are running Windows 10 system, it is also viable to edit on the
APP MakeCode for micro:bit , which is exactly like editing in the website.
And the link to the APP is
https://www.microsoft.com/zh-cn/p/makecode-for-micro-bit/9pjc7sv4
8lcx?ocid=badgep&rtc=1&activetab=pivot:overviewtab
Write a set of micro:bit code. You can drag some modules in the Blocks
As for loading test code , please turn to Chapter 4.5. And introduction
If you are writing program through the website, following these steps:
like the process that you copy the file to the USB driver. If you are
running Windows system, you can also right-click and select ‘Send to
→ MICROBIT (E:) ‘to copy the hex file to the Micro: bit main board V2
You can also directly drag the "hex" file onto the MICROBIT (E:) disk.
During the process of copying the downloaded hex file to the Micro:
bit main board V2, the yellow signal light on the back side of the board
flashes. When the copy is completed, the yellow signal light will stop
After the program is uploaded to the Micro: bit main board V2, you
could still power it via the USB cable or change to via an external power.
The 5 x 5 LED dot matrix on the board displays the heartbeat pattern.
This chapter has described how to use the Micro: bit main board V2.
can also write Micro: bit programs in other languages. Go to the link:
Code editing
area
“+” zoom in
“-”zoom out
Download code
Save Undo
the block only executes once, while“forever”implies that the code runs
cyclically.
4.3.Quick Download
However, if you use Google Chrome, suitable for Linux , macOS and
You could refer to the following steps to connect and pair devices.
Device pairing:
refer to
https://makecode.microbit.org/device/usb/webusb/troubleshoot
https://microbit.org/guide/firmware/
If the links are too troublesome for you , then you can also turn to our
figure below:
4.5 Input test code
We provide hexadecimal code files (project files) for each project. The
file contains all the contents of the project and can be imported directly,
or you can manually drag the code blocks to complete the program for
the code.
Makecode.
Click“Import File”
Select “ ../Makecode Code/Project 1_ Heart beat/Project 1_ Heart
beat.hex” ;
compiler above, you can also drag the the test code file provided into
the code editing area of the Makecode compiler, as shown in the figure
below:
the serial port simulator. However, you need to read the corresponding
digital signal or analog signal.So what can we do? You can use the
CoolTerm software to read the serial port data of the microbit. Next
(3) Unzip file and open it. (also suitable for Mac and Linux system)
(4)Double-click .
The functions of each button on the Toolbar are listed below:
Format
5. Projects
Project 1: Heartbeat
USB cable and a computer. The micro:bit LED dot matrix will display a
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
No need to worry though you are not good at programming. You will
get help.
to find more information about micro: bit blocks. Then this link
After uploading test code to micro:bit main board V2 and keeping the
connection with the computer to power the main board, the LED dot
quickly.)
If the downloading is not smooth, please remove the micro USB from
the main board and then reconnect them and reopen Makecode to try
again.
board V2 to shine.
(2) Components Needed:
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
(4)Introduction of components:
order to locate these LEDs quickly, as the figure shown below, we can
marking those in rows from 0 to 4 from top to bottom, and the ones in
columns from 0 to 4 from the left to the right. Therefore, the LED sat in
the second of the first line is (1,0)and the LED positioned in the fifth of
After uploading test code to micro:bit main board V2 and powering the
main board via the USB cable, the LED in (1,0) lights up for 1s and the
Dot matrices are very commonplace in daily life. They have found wide
The LED dot matrix of Micro: bit main board V2 contains 25 LEDs in a
by integrating its position value into the test code. Supported by the
same theory, we can turn on many LEDs at the same time to showcase
like to display. Last but not the least, we can design patterns by
ourselves.
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
After uploading test code to micro:bit main board V2 and powering the
main board via the USB cable, we find that the 5*5 dot matrix start to
button, the circuit is connected when pressing the button and it is open
Micro: Bit main board V2 boasts three buttons, two are programmable
buttons(marked with A and B), and the one on the other side is a reset
together and the LED dot matrix shows A,B and AB respectively. Let’s
get started.
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
(4) Test Code 1:
After uploading test code to micro:bit main board V2 and powering the
main board via the USB cable, the 5*5 LED dot matrix shows A if button
together.
(6) Test Code 2:
After uploading test code to micro:bit main board V2 and powering the
main board via the USB cable, when pressing the button A the LEDs
turning red increase while when pressing the button B the LEDs turning
red reduce.
Project 5: Temperature Detection
USB cable*1
Attach the Micro:bit main board V2 to your computer via the Micro USB
cable.
(4) Test Code:
After uploading test code to micro:bit main board V2, powering the
main board via the USB cable, and clicking “Show console Device”,
below:
If you're running Windows 7 or 8 instead of Windows 10, via Google
You could open CoolTerm software, click Options, select SerialPort, set
COM port and baud rate to 115200 (after testing, the baud rate of USB
OK, and Connect. The CoolTerm serial monitor shows the change of
below :
Project 6: Geomagnetic Sensor
This project aims to explain the use of the Micro: bit geomagnetic
sensor, which can not only detect the strength of the geomagnetic field,
but also be used as a compass to find bearings. It is also an important
part of the Attitude and Heading Reference System (AHRS). Micro: Bit
experiment, the compass will be introduced first, and then the original
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
(4) Test Code 1:
After uploading test code to micro:bit main board V2 and powering the
board via the USB cable, and pressing the button A, the board asks us
to calibrate compass and the LED dot matrix shows “TILT TO FILL
SCREEN”. Then enter the calibration page. Rotate the board until all
LED dot matrix displays an arrow pointing to the top right. Since 0.5
cannot be inputted in the code,the values added in the code are 293
and 338.Then add other logical criteria to form a compete test code as
shown below:
(7) Test Results 2:
Upload the test code to micro:bit main board V2, power the board via
the USB cable, and finish the calibration process following the
instructions.
Rotating the Micro: Bit main board V2, the LED dot matrix shows
Project 7: Accelerometer
8/10/12 bits. The code section sets the range to 1g, 2g, 4g, and 8g.
board with the accelerometer. And then have a look at the original
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
After uploading the test code to micro:bit main board V2 and powering
the board via the USB cable, if we shake the Micro: Bit main board V2,
no matter at any direction, the LED dot matrix displays the digit “1”.
When it is kept upright (put its logo above the LED dot matrix) as
When it is kept upside down( make its logo below the LED dot matrix) ,
When it is placed still on the desk, showing its front side, the number 4
appears.
When it is placed still on the desk, showing its back side, the number 5
will exhibit.
When the board is tilted to the left , the LED dot matrix shows the
When the board is knocked to the floor, this process can be considered
as a free fall and the LED dot matrix shows the number 8. (Please note
that this test is not recommended for it may damage the main board.)
Attention: if you’d like to try this function, you can also set the
Upload test code to micro:bit main board V2, power the main board via
schematic diagram of the Micro: Bit main board V2, the accelerometer
You could open CoolTerm software, click Options, select SerialPort, set
COM port and baud rate to 115200 (after testing, the baud rate of USB
OK, and Connect. The CoolTerm serial monitor shows the data of X
In this project, we focus on the light detection function of the Micro: Bit
main board V2. It is achieved by the LED dot matrix. And it can be
viewed as a photosensor.
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
(4) Test Code:
Upload the test code to micro:bit main board V2, power the board via
exposed to light, the value displayed gets bigger with the light
light level is less than or equal to 20, the moon will appear on the LED
dot matrix. If it's bigger than 20, the sun will appear.
You could open CoolTerm software, click Options, select SerialPort, set
COM port and baud rate to 115200 (after testing, the baud rate of USB
The Micro: Bit main board V2 has an built-in speaker, which makes
air all kinds of tones, such as playing the song "Ode to Joy" .
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
(4) Test Code 1:
After uploading the test code to micro:bit main board V2 and powering
the board via the USB cable, the speaker utters sound and the LED dot
https://en.wikipedia.org/wiki/Numbered_musical_notation
After uploading the test code to micro:bit main board V2 and powering
the board via the USB cable, the board airs the song "Ode to Joy".
Project 10: Touch-sensitive Logo
logo, which can act as an input component and function like an extra
button.
electric field when pressed (or touched), just like your phone or tablet
screen do. When you press it , you can activate the program.
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
(4) Test Code:
After uploading the test code to micro:bit main board V2 and powering
the board via the USB cable, the LED dot matrix exhibits the heart
The Micro: Bit main board V2 is built with a microphone which can test
LED indicator will turn on. Since it can measure the intensity of sound,
you can make a noise scale or disco lighting changing with music. The
microphone is placed on the opposite side of the microphone LED
indicator and in proximity with holes that lets sound pass. When the
USB cable*1
Attach the Micro:bit main board V2 to your computer via the USB
cable.
After uploading test code to micro:bit main board V2 and powering the
board via the USB cable, the LED dot matrix displays pattern “ ”
Upload test code to micro:bit main board V2, power the board via the
When the sound is louder around, the sound value shows in the serial
the value of the biggest volume( please note that the biggest volume
can be reset via the Reset button on the other side of the board ) while
when clapping, the LED dot matrix shows the pattern of the sound.
Project 12: Bluetooth Data Reading
The Micro: Bit main board V2 comes with a nRF52833 processor (with
USB cable.
(3) Procedures:
the Micro: Bit firmware to a folder or desk, and upload the downloaded
Firstly, turn on the Bluetooth of your Apple device and open the APP
Please make sure that the Micro: Bit main board V2 and your computer
not release them until you are told to) and press Reset & Power button
Release the Reset & Power button, you will see a password pattern
shows on the LED dot matrix. Now , release buttons A and B and click
“Next”.
Set the password pattern on your Apple device as the same pattern
Still click “Next” and a dialog box props up as shown below. Then
click "Pair". A few seconds later, the match is done and the LED dot
matrix displays the "√" pattern.
After the match with Bluetooth, write and upload code with the App.
code program for uploading is the one saved just now and named "1"
and then click the other "Flash" to upload the code program "1".
If the code is uploaded successfully a few seconds later, the App will
emerge as below and the LED dot matrix of the Micro: Bit main board
The LED blink is one of the most basic experiments. In the above
micro:bit. In this project, you will learn how to control an LED blink
micro:bit.
USB Cable*1
micro:bit you will see an LED blink on the module, with an interval
The light breath experiment is a little bit similar to the previous project.
This time we connect the keyestudio LED module to the sensor shield.
Pinout diagram of micro:bit, you can get the P0 can be used as Analog
IN.
This lesson you will learn how to control the brightness of LED on the
module, gradually becoming brighter and dimming, just like the LED is
breathing.
USB Cable*1
become brighter, then gradually dim, circularly just like the LED is
breathing.
Project 15: LED Blinks and Breathes
In this project, we combine the project 13 and project 14. You will learn
how to control the LED on the module blink for two times, then breath
for two times, circularly. This time we use keyestudio 3W LED module,
USB Cable*1
micro:bit you should see the LED on the module firstly blink two times,
There are two kinds of buzzer, active buzzer and passive buzzer. In this
lesson, we will use Micro:bit to drive an active buzzer. The active buzzer
inside has a simple oscillator circuit which can convert constant direct
USB Cable*1
micro:bit you should hear the buzzer module sound and then stop,
In this project, you will learn how to play music with keyestudio passive
One is to directly control the High and Low level input of micro:bit P0
end, set two square waves to control the buzzer sound. The other is to
use the software's own function, input the square waves of different
(The input PIO port can only be P0, can not be other interfaces).
Done wiring and powered up, send the code 1 to micro:bit, you should
hear two sounds produced from passive buzzer circularly. If send the
code 2 to micro:bit, the buzzer will play the song Ode To Joy! Really
amazing. Right? You can try to change the tone to play other music.
Project 18: Change Colors
In this project, we will use a keyestudio RGB LED module. This Common
Anode RGB LED module is a fun and easy way to add some color to
micro:bit, then control the P0, P1, P2 Analog Input of micro:bit main
board. You will learn how to control the RGB LED on the module firstly
show three colors (Red, Green and Blue), then quickly change the color
state.
USB Cable*1
micro:bit you should see the RGB module firstly show three colors,
separately red, green and blue light. Then change the color quickly and
circularly.
The micro:bit main board has two built-in buttons, however, sometimes
still need to use external button when design the circuit. So in this
project, you will learn how to use our push button module to control
USB Cable*1
Keyestudio Digital Push Button*1
button module.
Then the micro:bit will show . If the digital button module is not
When design the circuit, sometimes you will need to test whether an
object is tilted left or right, so in this case you can use our tilt sensor. In
this project, you will learn how to use our digital tilt sensor to control
USB Cable*1
(5)Test Results
Done wiring and powered up, send the code to micro:bit. When the
sensor is tilted to the left, the LED matrix will show ; however, if
USB Cable*1
Wire up the components, upload code and plug in power. When you
cover the notch of sensor with a piece of paper, the image will be
time, we are going to replace the button switch with a capacitive touch
sensor. In this project, you will learn how to use Keyestudio touch
USB Cable*1
Wire up the components, upload code and plug in power. If you touch
When walking at the crossroad, you can see the traffic light command
module to our sensor shield, controlling traffic light blink with micro:bit.
USB Cable *1
Done wiring and powered up, send the code to micro:bit, eventually
you should see the green LED lights 5 seconds then off, and yellow LED
starts to blink 3 times with an interval of 0.5 second, then off, followed
by red LED lights up for 5 seconds then off. Up to this moment, green
In this project, you will learn how to use our hall magnetic sensor to
The main component used in this sensor is A3144E. This hall magnetic
3cm.
Note that it can only detect whether exists a magnetic field nearby but
USB Cable*1
Wire up the components, upload code and plug in power. When the
When doing DIY experiments, you perhaps see such a smart car that
can follow a black line and not beyond the black area. How can achieve
this? Yeah, make use of line tracking sensors. In this project, we will use
black line. You can get the result shown on the LED display of micro:bit.
tube.
to the color, then convert the strength of the reflected signal into a
current signal.
When sensor detects a black line, the infrared rays are not emitted or
the intensity of emitted ray back are not sufficiently strong, so that the
level.
USB Cable*1
Done wiring and powered up, send the code to micro:bit. When sensor
detects no object or detects a black line, the infrared rays are not
emitted or the intensity of emitted ray back are not sufficiently strong,
so that the sensor’s signal terminal will output a High level, LED on the
Note: on the module, you can rotate the potentiometer to make the
When doing DIY experiments, you perhaps see such a smart car that can
automatically avoid an obstacle ahead. How can achieve this? Yeah, make
automatically avoid it. You can get the result shown on the LED display of
micro:bit.
USB Cable*1
147
www.keyestudio.com
Wire up the components, upload code and plug in power. When sensor
148
www.keyestudio.com
detects an object ahead, its signal terminal will output a Low level, and LED
matrix on the micro:bit will show the number 0. Or else show the number 1.
Note: for obstacle sensor, you can rotate the two potentiometers on the
sensor to adjust its sensitivity. Rotate the potentiometer near the infrared
transmitter tube clockwise to the end, and then adjust the potentiometer
near the infrared receiver. Sled light is turned off and keeps the critical
You may see such a lens in a film or television. When someone wants to
attack a target, but not close to the target, they were directly found and the
alarm sounded. When some special forces go to the target, they will be
covered with moist mud, so that they will not be discovered by the other
party. Why ?
Originally, the human body will emit a certain wavelength of infrared rays
of about 10um. The relevant sensors are installed near the targets that are
being attacked to sense the infrared rays emitted by the human body and
then alarm. After the mud is applied, the sensors can not sense the infrared
149
www.keyestudio.com
In this project, you will learn how to use a PIR motion sensor and micro:bit
USB Cable*1
150
www.keyestudio.com
Note: when you adjust the PIR motion sensor clockwise, the detected
range will increase; on the contrary, the sensed distance will reduce.
151
www.keyestudio.com
Wire up the components, upload code and plug in power. When the sensor
detects the people moving, the micro:bit will show ; otherwise, the
152
www.keyestudio.com
In daily life, it is often seen that a fire broke out without any precaution. It
will cause great economic and human loss. So how can we avoid this
situation? Right, install a flame sensor and a speaker in those places that
easily break out a fire. When the flame sensor detects a fire, the speaker
In this project, you will learn how to use a flame sensor and an active
This flame sensor can be used to detect fire or other light sources with
You can rotate the potentiometer on the sensor to control its sensitivity.
Adjust the potentiometer to make the LED at the critical point between on
USB Cable*1
153
www.keyestudio.com
154
www.keyestudio.com
Wire up the components, upload code and plug in power. When the sensor
detects the flame, the buzzer will chime; otherwise, it won’t emit a sound.
During the DIY, we may usually use a machine-3D printer. You can use it to
print any elements with different structures. And limit switch is essential in
155
www.keyestudio.com
the printing, which mainly provides the information whether XYZ axis of
essence the same as button module. When printer reaches the top to crash
the spring plate of module, module outputs Low level. If loosen the spring
In this lesson, you will learn how to use a collision sensor and a digital
USB Cable*1
156
www.keyestudio.com
157
www.keyestudio.com
When the spring plate of crash sensor is pressed, the buzzer will chime,
In this project, you will learn how to use a keyestudio reed switch module
and micro:bit to detect the magnetic field. Finally show the result on the 25
LED matrix of micro:bit. Actually in the project 13, we have used a hall
is the differences between hall magnetic sensor and reed switch module?
USB Cable*1
158
www.keyestudio.com
159
www.keyestudio.com
Wire up the components, upload code and plug in power. When the
module is close to the magnetic field, the micro:bit will display ; if not,
160
www.keyestudio.com
directly connect the switch to the 220V AC circuit, once electric leakage
In this project, you will learn how to use our relay module and micro:bit to
control an LED module on and off. (note that for easy wiring, the circuit
USB Cable*1
161
www.keyestudio.com
162
www.keyestudio.com
Ultrasonic sensor is great for all kind of projects that need distance
163
www.keyestudio.com
In this project, you will learn how to use a ultrasonic module and micro:bit
Ultrasonic module will emit the ultrasonic waves after trigger signal. When
the ultrasonic waves encounter an object and are reflected back, the
from the time difference between trigger signal and echo signal.
USB Cable*1
164
www.keyestudio.com
(5) Code 2
Search sonar
165
www.keyestudio.com
166
www.keyestudio.com
Connect micro:bit to computer via USB cable and transfer code to micro:bit.
Open CoolTerm, click Options and select SerialPort, set COM port and
The detected distance value can be shown on the micro:bit and CoolTerm
monitor.
167
www.keyestudio.com
It is seen that sensors are everywhere in our daily life. Some public street
night. Why?In fact, those lights make use of a photosensitive element that
In the evening, when outside brightness becomes lower, the street light is
168
www.keyestudio.com
In this project, you will learn how to use our keyestudio photocell sensor
and micro:bit to control the brightness of external light. Show the result on
USB Cable*1
169
www.keyestudio.com
170
www.keyestudio.com
Connect micro:bit to computer via USB cable and transfer code to the
micro:bit.
Open CoolTerm, click Options and select SerialPort, set COM port and
CoolTerm monitor shows the corresponding analog signal, with the light
the analog value will grow and LED will become brighter.
171
www.keyestudio.com
172
www.keyestudio.com
As for those corridor lights, when we walk through the corridor to make a
sound, the corridor light will automatically light up, after that, quiet down,
the lights are off. Why? Actually inside the lighting circuit, it has installed a
sound sensor. When detects the sound, light is turned on, or else LED off.
detect the outside sound via reading the analog value of P0.
The greater the external sound, the greater the analog value.
You can see the analog value is displayed on the micro:bit LED matrix, or
Note: you can rotate the potentiometer to adjust the sound intensity.
USB Cable*1
173
www.keyestudio.com
174
www.keyestudio.com
SerialPort, set COM port and baud rate(115200). Click OK and Connect.
You can see the sound value on the micro:bit and monitor.
175
www.keyestudio.com
connected to micro:bit P0. By reading the analog value of P0, rotate the
176
www.keyestudio.com
In the experiment, set well the circuit, convert the resistance changes into
voltage changes, then input the voltage changes into Analog Input of
micro:bit via signal end, getting the analog value via programming.
(2)Components Needed:
USB Cable*1
(3)Connection Diagram
177
www.keyestudio.com
(4)Test Code
178
www.keyestudio.com
(5)Test Results
Connect micro:bit to computer via USB cable and transfer code to micro:bit.
Open CoolTerm, click Options and select SerialPort, set COM port and
When you adjust the potentiometer, you will see the detested data on the
179
www.keyestudio.com
In this project, you will learn how to use an analog Alcohol sensor and
This analog sensor-MQ3 is suitable for detecting the alcohol. It can be used
It has two signal pins, Analog A0 and Digital D0. The higher the alcohol
potentiometer.
USB Cable*1
180
www.keyestudio.com
181
www.keyestudio.com
Wire components up, plug in external power and transfer code to the
micro:bit. The higher the concentration of alcohol, the larger the data. The
Open CoolTerm, click Options and select SerialPort, set COM port and
182
www.keyestudio.com
In real life, gas leakage events often occur. If toxic or flammable and
explosive gas are leaked out, there exist huge potential hazards to people’
various gas contents in the air, which can timely alarm to process the
leaking gas.
In this project, you will learn how to use an analog gas sensor and micro:bit
to detect the flammable gas in the air. Show the analog value of gas on the
USB Cable*1
183
www.keyestudio.com
184
www.keyestudio.com
The stronger the combustible gas is, the larger the data displays. You can
Open CoolTerm, click Options and select SerialPort, set COM port and
185
www.keyestudio.com
In the previous project 23, we only get the analog value of temperature in
USB Cable*1
186
www.keyestudio.com
187
www.keyestudio.com
Open CoolTerm, click Options and select SerialPort, set COM port and
Then the CoolTerm monitor and the micro:bit display the current
188
www.keyestudio.com
photocell. But this time we will use keystudio TEMT6000 light sensor whose
You will learn how to use a TEMT6000 sensor and micro:bit to test the
189
www.keyestudio.com
ambient light. Show the analog value on the micro:bit LED matrix or on the
CoolTerm monitor.
USB Cable*1
190
www.keyestudio.com
191
www.keyestudio.com
Open CoolTerm, click Options and select SerialPort, set COM port and
Then the CoolTerm monitor and the micro:bit display the light intensity
192
www.keyestudio.com
In life, you may often water some flowers and plants from time to time to
prevent them from withering, but not need to pour more. It may requires
In this project, you will learn how to use a soil sensor and micro:bit to
detect the humidity of your plants’ soil. Display the analog value on the
micro:bit LED matrix or on the serial monitor. The greater the humidity, the
USB Cable*1
193
www.keyestudio.com
194
www.keyestudio.com
SerialPort, set COM port and baud rate(115200). Click OK and Connect.
Insert soil humidity sensor into soil. The humidity value varies with the
humidity. The higher the humidity is, the larger the humidity value is.
195
www.keyestudio.com
In real life, when heavy rain occurs, the water level in a river or a reservoir
will rise sharply. When reaching a certain water level, it is necessary to open
a floodgate to solve the safety hazard. However, how to detect the water
module to detect the water level in the glass, if beyond level, buzzer should
make an alarm.
Keyestudio V2 Shield*1
USB Cable*1
196
www.keyestudio.com
197
www.keyestudio.com
Wire components up, plug in external power and transfer code to micro:bit.
Open CoolTerm, click Options and select SerialPort, set COM port and
The micro:bit and CoolTerm software show the analog value. The stronger
198
www.keyestudio.com
In this project, you will learn how to use Ultraviolet sensor and micro:bit to
detect the ultraviolet light. Show the analog value on the micro:bit LED
USB Cable*1
199
www.keyestudio.com
200
www.keyestudio.com
open CoolTerm, click Options and select SerialPort, set COM port and baud
The CoolTerm serial monitor shows the analog signal read by ultraviolet
sensor. The greater the Ultraviolet light, the greater the value.
201
www.keyestudio.com
Our lives are surrounded by air everywhere. The air contains many
ingredients, some of which are useful, some are harmful, some of which
have a significant impact on the human body, and some of which have a
So in this lesson, you will learn how to use a steam sensor and micro:bit to
detect the vapor content in the air. Show the analog value on the micro:bit
USB Cable*1
202
www.keyestudio.com
203
www.keyestudio.com
Open CoolTerm, click Options and select SerialPort, set COM port and
The CoolTerm serial monitor shows the analog signal read by steam sensor.
The higher the vapor content is in the air, the greater the value is.
204
www.keyestudio.com
so on. Now, let ’ s use the Keyestudio thin-film pressure sensor and
USB Cable*1
205
www.keyestudio.com
206
www.keyestudio.com
open CoolTerm, click Options and select SerialPort, set COM port and baud
The stronger the pressure is on the thin film, the larger the analog value is,
207
www.keyestudio.com
In this project, you will learn how to use a vibration sensor and micro:bit to
structure is a metal ball fixed on a special spring as a pole, and the other
USB Cable
208
www.keyestudio.com
209
www.keyestudio.com
When the vibration signals are detected by the vibration sensor, the white
LED is on.
210
www.keyestudio.com
For some DIY projects, you perhaps use a component, that is, joystick
In this lesson, you will learn how to control a joystick module and micro:bit
On the joystick module, it has 3 signal interfaces, which can simulate the
three-dimensional space. The signal pins X and Y will simulate the X-and
X- or Y-axis.
Another signal pin Z( labeled B on the module) will simulate the Z-axis of
211
www.keyestudio.com
USB Cable*1
212
www.keyestudio.com
SerialPort, set COM port and baud rate(115200). Click OK and Connect.
If you operate the joystick, the analog value on X, Y and B will change, as
213
www.keyestudio.com
For those DIY smart cars, they often have a function of automatic obstacle
module to rotate left and right, and then to detect the distance between
214
www.keyestudio.com
set a pulse of a certain frequency and a certain width in order to control the
servo angle.
But if use the micro bit main board to control the servo angle, we only need
In this project, you will learn how to control the micro servo rotate back
USB Cable*1
215
www.keyestudio.com
216
www.keyestudio.com
Done wiring and plug in external power,send the above code to micro:bit.
You should see the servo turn back and forth between 0° and 90°.
217
www.keyestudio.com
experiments. You can DIY a variety of small items. For example, use a
In the following, we will use keyestudio 1602 I2C module as the display,
connect it to I2C pin headers of micro:bit shield. You will learn how to
USB Cable*1
218
www.keyestudio.com
Copy and search the following extension library lcd1602 in the extension:
https://github.com/xuefengedu/pxt-lcd1602_CN
219
www.keyestudio.com
220
www.keyestudio.com
Note: You can adjust the potentiometer at the back to make the displayed
Wire up the components, upload code and plug in power, then 1602LCD
will show“keyestudio”on the first line, and numbers on the second line.
221
www.keyestudio.com
environment, that is, temperature. You will learn how to use an analog
voltage changes, then input the voltage changes into Analog Input of
micro:bit via signal end. Actually the analog value of micro:bit can be
USB Cable*1
222
www.keyestudio.com
223
www.keyestudio.com
6. Resources:
https://fs.keyestudio.com/KS0361-0365
https://makecode.microbit.org/
https://tech.microbit.org/hardware/
https://microbit.org/new-microbit/
https://www.microbit.org/get-started/user-guide/overview/
224
www.keyestudio.com
https://microbit.org/get-started/user-guide/features-in-depth/
https://tech.microbit.org/hardware/edgeconnector/
https://microbit.org/guide/hardware/pins/
https://microbit.org/guide/quick/
https://microbit.org/get-started/user-guide/mobile/
https://microbit.org/code/
https://microbit.org/projects/
225