BBC Micro Bit
Introducing an alternative Arduino-type board
The Micro Bit board is an incredible and powerful microcontroller device that is the perfect budget solution to create home experiments for newbies and hobbyists, as well as for developing advanced home projects. In our first project, we will look at how to make a soil humidity sensor. To make the construction easy, I have used some 3D-printed components, however these are easily replaced with common materials.
What is it?
The BBC Micro Bit is a board designed for education, as well as the graphical programming language Blocks — something similar to the Scratch language — specifically designed to teach programming, microcontrollers, and robotics to children; for teaching STEM; and for making robotics experiments.
Based on the ARM Cortex M0 processor, the Micro Bit board includes everything you need to start. To make a comparison with the popular Arduino Uno, imagine it as a sort of all-inclusive electronic device replacing the Arduino and a bunch of Arduino Shields. The Micro Bit board consists of:
• a 32-bit microcontroller CPU running at 16MHz
• 16KB of RAM
• Bluetooth Low Energy (LE)
• a radio link to communicate with radio-controlled toys and other Micro Bit boards
• 25 individually programmable LEDs
• two programmable buttons
• a triple-axis accelerometer and inclinometer, motion sensor
• a digital compass
• a temperature sensor
• a light sensor
• a USB connection
• 25 easy-to-access I/O pins (analogue, digital, and pulse-width modulation [PWM]).
The BBC Micro Bit is available
To make a comparison with the popular Arduino Uno, imagine it as a sort of allinclusive electronic device replacing the Arduino and a bunch of Arduino Shields
online from the distributor Kitronik — kitronik.co.uk/microbit.html — which ships to New Zealand.
Taking care of plants
The humidity level is basic information for any kind of plant watering system. Depending on the kind of plants we are growing, the terrain humidity is a good indicator of the health status of the plant and a helpful way to know when it is time to water the soil. It would not be difficult for this simple project to evolve into something more complex, including checking the environment temperature and the daylight intensity for the best time to water the plant. By adding the control of a water pump (the board can support it) we can reach the next level — an automated plant watering system.
In this project I have used three different containers filled with soil — respectively, wet, humid and dry — to set up the sensor readings in all the possible conditions. (When testing and calibrating I used sand instead of soil as it is easier to set as dry, humid, or wet.)
Components
The only part requiring assembly is the sensor itself. Below is a list of components to be used to assemble it, as shown in the step-by-step images:
• the 3D-printed soil sensor case — alternatively you can use a plastic box and a couple of wooden kebab skewers
• some electric cable
• copper adhesive tape — this can be replaced by aluminium cooking foil
• 1mΩ resistor
• 10kΩ resistor
• three crocodile clips
• a potted plant that will survive after the experiment.
The build
The first step is the creation of the humidity soil sensor. This build requires some soldering and gluing. The board will power the sensor, then the soil resistance is read, comparing the value with the internal resistance of the circuit. This circuit works in a similar way to a potentiometer, where the variable resistance is read from the soil.
After assembling the sensor, connect it to the Micro Bit. Plug the GND (black) cable crocodile clip to the GND ring of the Micro Bit. Then plug the data (yellow) cable crocodile clip to ring one of the Micro Bit. Software will set up this pin as an analogue input for signal reading.
If we power the circuit, attaching the power (red) cable crocodile clip to the 3V ring of the Micro Bit, the circuit works. Keeping the sensor always powered will drain a lot of battery and we don’t really need a continuous reading to monitor the soil humidity level. What would be sufficient, for example, would be a reading every five seconds.
For this reason, we will connect the circuit power to ring two of the board. Software will set up this pin as ‘digital output’, powering the circuit only when it is needed, setting the pin value to 1. This simple change drastically reduces the power consumption.
The software
Now it is time to programme the board. One of the most interesting characteristics of the Micro Bit is how easily it is to programme. Here you could consider using Blocks, the graphical language, but the Micro Bit also supports JavaScript and Python. Blocks programming hides behind the corresponding JavaScript source code. It is possible to switch between the two versions of the same source — Blocks and JavaScript — with a one-click command. This is a good way to learn the logic of a more complex programming language.
Programming is easy — you don’t need to install any development environment; you only need the browser. The board can be programmed with a PC, tablet, iPad, etc.
To start writing down the code blocks, you should go to the https://makecode. microbit.org site. The web programming interface includes the main area where you put the blocks, a left-side column with all the available standard blocks organized by features, and a simulator — a small graphical Micro Bit design that instantly runs the code you write to see what happens step by step.
The corresponding JavaScript source of this experiment and more detailed information on the software logic can be found at the GitHub repository: https://alicemirror.github.io/SoilMoistureSensor_microbit/, and you can find more on the Micro Bit board at the official site: http://microbit.org/.