micro: bit Expansion Board wiki



Based on micro: bit, this environment expansion board is closely concerned with natural science. We hope through the natural subjects' combination, the maker education can be close-to-life.

Therefore, we integrated multiple sensors in this expansion board like atmospheric pressure, temperature, humidity, UV rays, light, color, sound, water quality, water temperature, soil moisture and so on. Which covers all basic aspects of natural science and daily life.

In the process of learning, students can learn the measurement principles of various natural data. And by programming their own graphical program to measure the relevant data, it deepens the understanding of knowledge, as well as the recognition of natural science.


warning_yellow.png NOTE

  • The probe cannot be used in water above 55°C.
  • The probe cannot be left too close to the edge of the container, otherwise it will affect the reading.
  • The head and the cable of the probe are waterproof, but the connector and the signal transmitter board are not. Please be careful!

Board Overview

board overview

Basic makecode tutorial: click to enter the makecode online graphical programming tutorial.

Library Address: http://https://github.com/DFRobot/pxt-NaturalScience


Part1: Get to Know and Protect Nature

We live together on this beautiful blue planet: on Earth. On the earth, there are blue seas, green forests, clear streams, yellow deserts, colorful flowers, a variety of plants and animals; All this makes our home flourish and vibrant.

However, the population expansion, the acceleration of urbanization, the expansion of industry, deforestation, the air becomes cloudy, the streamlines no longer clear...

Environmental protection is not only the public welfare but also the responsibility of everyone, no matter what we do, as large as afforestation, as small as garbage classification. Everyone should make effort to protect the environment. But what kind of things are we capable of to protect the environment?

To begin with, let’s get to know and understand nature itself. Through the learning, we can not only learn all kinds of nature knowledge, such as temperature, humidity, atmospheric pressure, ultraviolet light, color, light, water quality and so on... We can also learn how to use micro: bit to measure and use this data, so as to better protect nature and cherish our living environment.

Part2: The Comfortable Degree Evaluation of Environment: Temperature and Humidity

1.How Temp & Humidity affect the environmental comfort degree?

Among many meteorological elements, temperature and humidity are the biggest impacts on human health and comfort.

Generally, the human body feel comfortable when the temperature between 18-28 degrees and the humidity between 50%-60%. The ultra-low humidity will lead to excessive drying, one is easy to produce static electricity and increase the density of dust easily, so 50%-60% humidity is appropriate.

So, what affects the temperature and humidity of the environment? How can we measure temperature and humidity?

2.How to measure Temp & Humidity?

It’s too hard to control temp and humidity in the atmosphere, but it will not be hard to control the indoor temp and humidity with equipment such as air conditioners, humidifiers, electric fans and so on. Now, let’s get to know the units and measurements of temperature and humidity.

Unit and Measurement

In the age of the Internet of Things, we also use a device called a "temperature sensor" and a "humidity sensor" to measure temperature and humidity, and can display the measured data on a screen or to a computer for analysis. Smaller and easier to use.


3.Measure the environmental Temp & Humidity


  1. micro: bit Environment Expansion Board x1
  2. micro: bit x1
  3. AAA Battery x1
  4. USB Cable x1

As the image above shows, we prepared the necessary tools. Then let’s program the code to monitor temperature and humanity.

Download the code and check the result:

The first line of the OLED display shows the temperature is 27.28°C and the second line shows the humidity is 58.42%RH.

Hereafter, let’s check which hardware is designed to monitor temperature and humidity. In the top of the board, a tiny component in the center of the cloud and sun is the one that measures temperature, humidity and atmospheric pressure (what is the atmospheric pressure? We will introduce it in the next part)

Try holding our fingers down to this sensor, as shown in the figure:

We will find that two data changes, especially the temperature, the change is very obvious, the temperature is constantly rising, because our body temperature is higher than the ambient temperature, by holding down the sensor, the body temperature is transmitted to the sensor.


Temperature Alarm: we'll do some functional extensions to the program, as shown in the figure. The buzzer starts to alert us when the temperature exceeds 30 degrees.



Through the learning above, we have learned the following: Learned the effects of temperature and humidity on human comfort. Mastered the current temperature and humidity measurement methods. We measured the temperature and humidity around us through programming, and actually experienced the sensor's measurement.


Part3: Get to Know and Measure the Pressure


Air pressure is the atmospheric pressure acting on the unit area, i.e. the gravity of the vertical air column that is numerically equal to the vertical air column that extends upward in the upper boundary of the atmosphere. The famous Magdeburg hemispheric experiment proved its existence. The international unit of air pressure is Pascal, or Pa, and the symbol is Pa. In meteorology, people usually use kPa as a unit.

2.Atmospheric Pressure V.S. Altitude

The air pressure is related to altitude, atmospheric temperature, atmospheric density, etc. Generally, the atmospheric pressure will decrease as the altitude increases. And, during the year, winter is stronger than summer atmospheric pressure. E.g.

From the data above, we can see that as the altitude increases, the greater the atmospheric pressure is lower. There is a formula that can roughly calculate the altitude, which can be done to understand.

The relationship between atmospheric pressure and altitude:

The calculation height formula is:

P.s. H- Altitude, P0-Atmospheric (0°C, 101.325kPa)

3.How to measure Atmospheric Pressure

In the previous section, we learned the basics of atmospheric pressure and the relationship with altitude, so how do we measure atmospheric pressure? There are three common ways to measure, mercury barometer, metal membrane barometer, and pressure sensor.

Mercury Barometer: the first mercury barometer was invented by Moreland in 1670. Then a German A. Sprung modified the original mercury barometer. The mercury barometer is a device to measure atmospheric pressure, the principle is based on the Torricelli experiment. Taking advantage of the principle that the mercury weight inverted in the glass tube column inside the mercury tank balances the surrounding atmospheric pressure, the height of the mercury column indicates atmospheric pressure. A standard atmospheric pressure (atm, standard atmosphere) is equal to the height of a 76 cm mercury column.

Metal Membrane Barometer: taking advantage of the difference between a standard atmospheric pressure filled internally and the air pressure of the outside world, which changes the metal form and reflected on the pointer.

Pressure Sensor: the air pressure sensor is an internal thin film that is sensitive to air pressure strength. When the pressure of the gas under test decreases or increases, the deformation of the film causes the internal resistance value to change, which causes the voltage to change. After an A/D conversion, it becomes a computer-readable air pressure data. The air pressure sensor is not only high-precision, but also small in size and easy to use. It is widely used in outdoor equipment, such as mountaineering watches, signal base stations, drones, etc.

4.Get to Know and Measure the Pressure

From the last part we know that the sensor in the center of the cloud and sun can measure the atmospheric pressure.

Now let's re-modify the program to test the local atmospheric pressure. Please write the following code and copy it to micro: bit. This program will automatically detect the local atmospheric pressure and display it on the display.



Through the learning above, we have learned the following:

Part4: Sound

1.The principle of sound

Sound is a sound wave produced by the vibration of an object. It is a fluctuation that transmitted by a medium (air or solid, liquid) and is perceived by a person or animal's auditory organ. When playing an instrument, tapping a door or a tabletop, their vibration will lead to a rhythmic vibration of the air, causing the surrounding air to change dense, which will form a dense vertical wave, so sound waves produced and this phenomenon will continue until the vibration disappears.


2.How could we hear sound?

The occurrence and transmission of sound in nature is a kind of vibrational sound wave. The vibrational sound wave received through the outer ear, passed through the ear canal to the eardrum. The vibration of the eardrum causes the hammer bone, the shin bone, the tibia three listening bone in the inside of the ear to vibrate one by one, and the sound wave turns into a solid vibration.

Then, the "inner ear" cochlear receives vibrations from the middle ear and activate the body's most important auditory receptor the Corti’sorgan to turn vibration into nerve impulses.

Neural impulses along the "listening nerve" to the brain's auditory center, the auditory center to complete the tasks of auditory information, analyzing, processing, integration, processing, hereafter the auditory produced.

Sound sources → sound waves (gas vibrations) → ear profiles (collect sound waves) → outer ear canals (sound wave conduction) → the eardrum (convert sound waves into solid vibrations) → cochlear (convert vibrations into nerve impulses) → listening nerves (pass nerve impulses) → the auditory center of the brain (integrate information and produce hearing).


3.Principle and Applications of Sound Sensor

We have already known the principle of sound and how the ear hears sound. But how does sound sensors work? Where will sensors be used?

Introduction and Principle

A sound sensor is a sensor that detects the size and frequency of a sound by the vibration of the vibratory membrane and converts the vibration into an electrical signal. Through a series of conversions and analysis of electrical signals by chip, the strength of sound can be detected intuitively.


Sound sensors are widely used in daily life, industrial agriculture and military. E.g. KTV, command traffic shouters, mobile phones, walkie-talkies…


So, which is the sound sensor on the natural science board? Let's see.

Here we can see a small sound sensor in the board which with a logo speaker. Small but sensitive, it can grasp the clapping, speaking sound and input the sound to micro: bit to calculate. Let's program to get the sound strength.


In the above program, we convert the sound to the moving position of the micro: bit dot matrix, the louder the sound, the more the dot matrix lighting up scrolls to the right.


Programming as follows, record the number of 1 to 9 pat times and display the corresponding number on the dot matrix, and display the current sound strength in real time on the OLED screen. In this program, you will learn how to use the multithreaded programs as well as to judge and use sound strength.



Through the learning above, we have learned the following:

Part5 Get to know light and Its Application


2.How do we see light?

Living in this world, we can see the sunlight, moonlight, lamp light, movies, television, the fundamental reason is the light. Eyes, a sophisticated camera. The eye, like the camera, can also be divided into two parts according to its function, the front cornea, lens and glass equivalent to the camera lens, which belong to the refractive system.

The retina at the back equals to the film of the camera and belongs to the photosensitive system. The refractive system is actually like a lens that brings images of the vast world to converge into a tiny retina.

3.How to measure the light strength?

Light has different strength, strong or weak. Light strength is not the same in the morning, noon, evening and night. So, how do we measure the intensity of light? Typically, we use something called a "light sensor" to measure the intensity of light. A light sensor is a device that uses the size of the light value to change the output resister or output voltage. The following image is one of the light sensors:


The device in the red circle below is the on-board light sensor: it is a mini high-sensitivity optics hardware that not only can detect the intensity of the light, but also distinguish colors.

Let's write a program to detect the ambient light values, as follows: This is a simple program that detects the intensity of light and displays the light intensity data obtained on the OLED screen.



We get the intensity of the light, but how could we use this data? In real life, where might light sensors be used? For example, street lamps does not light in the daytime, but at night, the street lights on both sides of the road will automatically light. Here it may use two principles. One is to light ON and extinguish automatically at the fixed time. The other is to use light sensors to detect ambient light, when the light is dim, turn on the street lights automatically. Let's use this principle to make a funny day-lighting auto wake-up service program.


The program simulates a scenario. When the light from the window hits the sensor in the morning, the horn makes a musical sound to remind you that it's time to get up. So, you press the A key, the music stops playing, and the bedside light lights up. When you are dressed, press the B key, the bedside lamp goes out and the program enters the next waiting state.


Through the learning above, we have learned the following:

Part6: Color principle and color recognition

In this beautiful and colorful world, we can see a variety of colors: green trees, blue sky, rainbows, cartoons, different clothing colors and so on, then how these colors are formed? How do people's eyes see all kinds of colors?


1.The principle of color formation

Light has a variety of color spectra. When visible light projected onto objects, different objects absorb different colors of the spectrum, a part of the wavelength of light is absorbed, a part of the wavelength of light is reflected to stimulate the human eye, forming a different color.

People's retina has three photosensitive pigments red, green, blue. They are not only sensitive to light, but also very sensitive to color. Light into the retina can cause the three cells to change in different degrees. Along different neural channels, the transformed cells transport into the visual center of the cerebral cortex, resulting in the corresponding color perception.

White colors are displayed when the three photosensitive pigments are stimulated equally. When they are stimulated by mixture with different proportions, they can form a variety of color perceptions, and that's how people recognize and perceive this colorful world.

2.Three-color principle

In nature, there are many colors, such as: red, orange, yellow, green, green, blue, purple, white and so on.

Later, it was found that almost all colors of light in nature are obtainable by mixing the colors red, green and blue, that is the principle of tri-color.

Three-base colors refer to red, green and blue, abbreviated as RGB. As shown in the following image we can see:


3.The principle of RGB LED and applications

According to the principle of color formation and the principle of eye recognition of color, people invented colorful lamps, cameras, color recognition sensors and other scientific and technological products. In this section, let's learn about RGB lamps and color sensors.

(1) First, we prepare an RGB lamp module, as follows:

(2) Connect the module to the P1 port, as follows:

(3) Let's write a program to intuitively feel the RGB tricolor blending principle: In the program, we called the RGB lamp library. And set the RGB led connected to the P1, the number is 1.

In the program, we found that the range of RGB tricolor is: 0 to 255. You can try changing the values of the three parameters of the RGB to see what color will show with different values.


Try covering a piece of paper on the RGB lamp and you'll find that the color blends better, as follows:

4.Color recognition sensor

First, let's look at what a color recognition sensor looks like, as follows: Maybe you'll ask: Isn't this a light sensor? Yes, this sensor can detect light intensity and different color values.

Let's use this sensor to actually test the values of the various colors in daily life. First, we write a detection program:


Download the program and let’s find some objects with bright colors to put above the sensor in about 5mm height, this time, the display can show the current RGB values. Of course, because the influences like light, distance and others, this value may not be as accurate as we think, the accurate data need to be modified by various algorithms. But in this way, we can understand how colors are read. And we can also try recording the color values we read, then light the RGB led in the program, and see what colors the color sensor will sees.



Through the learning above, we have learned the following:

Part7 Ultraviolet light affection

1.What is UV? Where did it come from?

Ultraviolet light is the general term for radiation in the electromagnetic spectrum with wavelengths ranging from 10nm to 400nm, and our eyes cannot see ultraviolet light directly.

In 1801, German physicist Ritter discovered the presence of ultraviolet light by discovering the presence of ultraviolet light in a section of the purple-end section of the solar spectrum that can sense light from photographic negatives containing silver bromide, hereafter the ultraviolet light is discovered.

Divide according to wavelength, the ultraviolet light can be divided to near UVA, far UV UVB and ultra-short UV UVC. The penetration of ultraviolet rays in human skin is different. The shorter the wavelength of ultraviolet light, the greater the harm to human skin. Short-wave UV rays can pass through the leather, and medium-wave can enter the leather.

2.Advantages and disadvantages of ultraviolet rays to the human body


Ultraviolet rays have a certain bactericidal effect, but excessive exposure to ultraviolet light is harmful to the human body.

3.Get to know ultraviolet sensor and its application

Moderate exposure to UV rays is good for the human body, but excessive exposure is harmful to the human body. So, we need to measure UV light to serve humans and avoid excessive UV rays harm. Let's take a look at the device for UV measurement The UV sensor shown below:

Ultraviolet sensor uses photosensitive elements to convert UV signals into electrical signals. It is only sensitive to ultraviolet light, insensitive to other lights like the usual sunlight, lamp light. So, we can measure the intensity of UV light more accurately. With the knowledge of UV sensors, let's measure the intensity of UV rays by programming.


4.Measure the intensity of UV rays in different environments

First, we prepare a table like this:


We recorded data from tests at different locations and time, and tried measuring ambient temperature, light intensity at that time, and then tried to understand the relationship between temperature, light intensity and UV intensity by comparing and summarizing.


Through the learning above, we have learned the following:

Part8 Source of Life: Water

1.Basic knowledge of water

Water is the source of life. But how much do you know about water? Let's look at some little knowledge together.

  1. Water (H2O) is an inorganic substance consisting of hydrogen and oxygen, a transparent liquid that is colorless and odorless at room temperature and normal pressure.
  2. Water has three states: liquid, solid, and gas.
  3. Seventy-two percent of the earth's surface is covered with water.
  4. There are about 1.5 billion cubic kilometers of water on earth.


  1. Ninety-seven percent of the earth's water is salty, and 2.1 percent of the water is still frozen in the polar ice sheet, so the fresh water that we can drink directly is less than 1 percent.
  2. 60% to 70% of our bodies are made up of water, i.e. about 42 kg of water in a 70 kg human body.
  3. Where there is water on earth, there is life. Whether in almost boiling water or in strong acid.

2.Protecting water resources

We have just learned that we can drink less than 1% of the fresh water directly, and our drinking water resources are very limited.

Despite the limited freshwater resources, there is still a large amount of water that is polluted and wasted.

There are garbage and plastic bags floating in the river, industrial waste water sneaking into the river, etc....

What can we do to protect water resources? To protect water resources, what we can do is to start with the little things, save water, turn off the tap, and not pollute the water source.

3.Water Quality Measurement and Analysis

Introduction of TDS Water Quality

In the last section, we learned that our drinking water resources are very limited, we understand water pollution, we know how to save water, protect water resources and so on. So now let's learn about water quality measurements. To begin with, let's look at a noun: TDS. TDS is an important parameter that affects water quality.

(1) What is the TDS value?

The TDS value refers to the total dissolved solid, also known as the total amount of soluble solids, measured in mg/L. It shows how many milligrams of soluble solids are dissolved in 1L of water. The higher the TDS value, the more dissolved matter is contained in the water.

Simply put, the TDS value partly reflects the purity of the water. The lower the TDS value, the higher the water quality, the higher the TDS value, the more soluble solids contained in the water, but water with high TDS values is not equal to harmful.


For example, the water inside the river, TDS value is about 400. And tap water is about 100, bottled pure water is about 10, while the TDS value of juice is 500. From the values above, the purity of bottled pure water is very high, impurities are very small. The TDS value of fruit juice is 500, but it is harmless to humans.

But TDS is not the only criterion for determining water quality. TDS can only measure conductive substances in water, but cannot detect bacteria, viruses and other substances. We also need to comprehensively test the pH of water, acidity, bacterial content and so on project comprehensive assessment of whether water can be directly consumed. We also need to comprehensively test the pH of water, acidity, bacterial content and other projects to assess whether water can be directly consumed.

(2) Measurement and application scenarios for TDS values

The following image shows us the application scenario of TDS detection in actual production and life, such as water quality testing pen, water purifier, swimming pool, water treatment plant, etc. will do TDS value testing.

Although TDS value is not the only indicator to determine water quality, it is an important indicator to determine water quality.


4.Measure and analyze TDS values for different water sources

Here we programming a water quality testing program to test different water sources and record the corresponding TDS values. The program is as follows:




By selecting different water sources in different locations for testing and recording, we will come up with a set of TDS data that can intuitively understand the pollution of different water sources in different regions.


Through the learning above, we have learned the following:

Part9: Measurement and application of water temperature

1.What occasions do we need to measure and control water temperature?

In our daily life, we can come into contact with water at many different temperatures. For example, tea, coffee, bath, swimming and so on, involving equipment including heaters, water dispensers, water heaters, temperature controllers and so on. So how do we detect and control the water temperature? First of all, let's get to know the water temperature sensor.


2.Get to know the water temperature sensor

The water temperature sensor consists of a sealed metal housing and an internal temperature sensor, as shown below: when we put the water temperature sensor in the water, the temperature of the water is transmitted to the internal temperature sensor through the metal thermal conductor, which causes the sensor value to change. That’s how the water temperature sensor works.


3.Programming the water temperature control

Like the projects above, we can also write a program in a very simple way to measure the temperature of water:



In the first chapter, we measured the temperature at a Celsius, and there is a "Fahrenheit" that is also a widely used unit of temperature measurement. Let's take a look and make the corresponding conversion. First, look at the definition of two units of temperature measurement.

Celsius: the temperature of the ice water mixture is set to 0 degrees C, the temperature of boiling water is set to 100 degrees C, and the two are divided into 100 equal parts, each of which is a unit of Celsius, called 1 degree Celsius.

Fahrenheit: at standard atmospheric pressure, the melting point of ice is 32 degrees F, the boiling point of water is 212 degrees F, the middle is 180 equal points, each equal unit is 1-degree Fahrenheit.

Formula to convert °C to °F: Fahrenheit = Celsius x 1.8 + 32°C

Use the conversion formula to convert the measured temperature value to Fahrenheit:


In this program, we use mathematical operators to convert the value of Celsius to a value of Fahrenheit, and we use two new program modules: truncation and combining strings.

Truncation: truncate the fraction already obtained values, only leaving integers.

Combining strings: combining two strings to show on one line.

In the end, the display shown the result as below:



Through the learning above, we have learned the following:

Part10: Plant a tree

1.Forest Knowledge

On earth, there are a lot of forests. Global forests are concentrated in South America, Russia, Central Africa and Southeast Asia. These four regions take up 60% of the world's forests, with Russia, Brazil, Indonesia and Congo’s accounting for 40% of the world's forests.

Total global forest cover is 32%, among them, North America takes 34%, South America and Europe are around 30%, Asia 15%, the Pacific 10% and Africa only 6%. The continent with the largest forests is Latin America, which accounts for 24% of the world's forest edified area and reaches 44% of forest cover. These forests play an important role in regulating the climate, preventing desert invasion and protect the natural ecology.

The United Nations Environment Office reports that global forests have been halved in history, mainly due to human activity. According to a report in 2001 by the United Nations Food and Agriculture Organization, global forests fell from 3.96 billion hectares in 1990 to 3.87 billion hectares in 2000. Nearly 10 million hectares of forest are lost each year worldwide. The role of plants in protecting the living environment of human beings.


2.Effects of the environment on plants

Water, sunlight, temperature, humidity, atmospheric pressure will have an impact on the shape and survival of plants, of which the water content has the greatest impact.

Moisture is an important part of plants. The average plant contains 60% to 80% water, or even more than 90%. Without water, the plants cannot take actions like absorption, transportation, as well as photosynthesis and breathing.

For example, the main characteristics of plants that can survive in desert environments are drought-resistant. The general desert plant leaves are relatively small in order to reduce the water loss caused by the role of steaming, mainly represented by the fairy ball, stick tree, aloe vera and so on.

In the rainforest, due to the abundance of rain, abundant water, a large number of broad-leaved plants, such as banana, eucalyptus and so on.


3.Plant moisture measurement

Through learning, we knew the importance of water to plants. Then, in the process of farming, we need to pay attention to the water situation of plants to prevent water shortage nor too much water which will cause plant roots to be flooded.

Let's use the soil moisture sensor in the kit to learn how to measure soil moisture. The soil moisture sensor is shown below:


Connecting the soil sensor:


Programming to calibrate the soil sensor Download the program to micro: bit, according to the figure shown as below to obtain and record the reading in dry and in water. My data is 841 in dry, 543 in the water.


Then modify the program and put the two calibration values in the previous dry and water to the program. In the program, we map 543 to 10, 841 to 0. In the actual test, the humidity is 0 when reaches the lowest, and the highest humidity is 10.


After downloading the program, insert the soil moisture sensor to the flower pot soil to be tested, it shows that the humidity value of the current soil is between 0 and 10. According to the water requirements of different plants, we can make a preliminary judgment on the suitability of humidity.


Through the learning above, we have learned the following:


Q&A Some general Arduino Problems/FAQ/Tips
Q I have a question!
A For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get micro:bit Environment Expansion Board from DFRobot Store or DFRobot Distributor.

Turn to the Top