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.)
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 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.
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.
Above and below: The two sides of the BBC Micro Bit board
The steps to building the soil humidity sensor. First, the probes are 3D printed before being covered with adhesive copper tape. They are then inserted into the circuit box and hot-glued to fix them in place and keep them water-resistant. After soldering the two resistors to the sensor cables, the box is closed and hot-glued to prevent any dirt and humidity from damaging the circuit. The last step is crimping the crocodile clips to the sensor cables
Below: Before setting the final programme a test version is created to see the numeric readings of the sensor in the three experimental conditions — dry, humid, and wet. The analogue values are read in these three conditions, then used to set up the final programme. Based on the numeric values retrieved by the test programme, I define a range of readings to identify the three humidity soil conditions to monitor. Depending on the humidity level of the soil the Micro Bit displays an up arrow, indicating too much water, or a down arrow, meaning it is too dry
Above: The Micro Bit web programming environment. Some details on the programme blocks:(A) Block running once when the programme starts. It creates an array of messages shown in the various conditions of the programme and sets the reading value ranges corresponding to the humidity levels(B) Event generated when button B is pressed: shows a graph on the LED matrix corresponding to the numeric soil humidity reading. Converts the analogue value to a graph(C) Event generated when button A is pressed: a short text message scrolls past depending on the soil humidity reading(D) Background activity: periodically reads the sensor value and displays an arrow showing instantly if the humidity level is high or low
Simple schematic of the circuit and wiring design of the soil humidity sensor