Developing the IoT BBC micro:bit and Wi-Fi Toolkit by Simon Wihl

2019-04-30T07:49:22+01:00April 29th, 2019|

The internet of Things (IoT) is developing at a pace and already there are many devices around from parking sensors to Google Home and Amazon Echo. We are at the beginning of this road and it’s a good place to be. At the present time we are lucky in that there are a variety of devices and sensors available to the home and educational establishment that can be used to design and build many types of IoT devices not available a short time ago. This is fortuitous, as in industry as well as in government there is a recognition of a shortage of engineers and we can utilise this technology to inspire and excite young people to become the engineers of the future.

At Ingenuity Studio the challenge we were given was to provide a Toolkit for a river flood warning system designed around an IoT device and potentially use the LoraWan (Long Range Wide Area Network) network to notify everyone of a forthcoming flood. The idea was to interest young people and provide a day of experience and fun to design and build such a system.

To develop an IoT Toolkit we needed a system that could be built by learners who have had no experience of electronics or software. In addition, it also needed to be built in a day, a tall order you might say?  However, having had previous experience of using a BBC Micro:bit for similar developments we had no qualms in selecting this device for such an outcome. This little but powerful micro-controller comes with a large selection of programming languages and is supported by many hardware developers. The obvious choice of language is the Block Editor. This is very similar to Scratch which is known by many people and is a simple almost pictorial language that is easily and quickly picked up by most people. It has a hidden depth which can be revealed as users gain experience, which allows them not to get too confused by more advanced constructs. More importantly it allows people with no programming experience to achieve just that, program a micro-controller!

So, we had our micro-controller but now needed some way of detecting the water level and communication this to the wider public. The LoraWAN is a simple low bandwidth crowd sourced network available all over the world. Its use is ideal for IoT devices for which you don’t need a network provider and you potentially can access it in the middle of a field. It is easy to use if you have the hardware to access it, however currently there are no ‘off the shelf devices’ that connect to the micro:bit. We could have spent time designing our own or look for another way to achieve the same result. Designing your own takes time and resources and this we did not have. So, given the choice we decided the internet would do the job. This is already setup for such devices and searching around we found the ‘Thingspeak’ web server which allows devices to connect to it and display information in the form of graphs. Most importantly you can setup a trigger level to send out a ‘Tweet’ warning message; this service is also free, perfect!

The next question was how to communicate to the Internet? Luckily this question had also occurred to many people around the world before us and a solution had already been developed. This comes in the form of a handy device with the memorable device number of ‘ESP8266’ or in layman’s terms a Wi-Fi transmitter-receiver. Not only was it readily available but someone had thoughtfully created an extension to the Micro:bit  blocks language to access it.

Now for the sensing device. Here again there are ‘many ways to cut the cake’ but there were two main constraints, cost being the first and ease of use the second. Having discarded ultrasonic sensors and the like and more complex circuitry we finally decided on a simple and cost-effective device.  This consisted of several strips of metal on a circuit board alternatively connected to ground and the positive rail. As water touches the strips an electrical circuit is made from which the Micro:bit can measure the voltage. As water rises up the strips the resistance goes down and so does the voltage. This is counter intuitive as it’s natural to think of water rising and so does the measured voltage. Something we make sure learners understand in the toolkit.

So we now had all the parts to meet the challenge the Micro:bit to control our IoT device, a water sensor, a means to transmit the data and a way of displaying the information and notifying a flood was imminent. Now to put it all together so that it’s easy to understand and with a little bit of help learners can build it themselves.

Most circuits are held together by soldering and we could have utilised this technique, however to make life easier for everyone and more importantly allow us to repeatedly use the same components we decided to use a ‘breadboard’. This small piece of kit allows users to place circuit boards on it and connect them together using special connectors called ‘Dupont wires’ with pins and sockets on.  This means that for the toolkit users they have an easy way to connect everything together, whilst at the same time once everyone has finished, the whole lot can be taken apart without damaging the components. To help with connecting the Micro:bit we utilised an edge connector. The Micro: bit can be connected directly but, in our case, using the bread board, the edge connector is more useful and also helps to preserve the Micro:bit from wear and tear. To make sure users had a stable platform to attach everything to, we fabricated a board on the studio laser cutter and printed some separators on the printer. Thus, everything could be held on one board. Finally, to power all the circuitry we had to add a small power supply which connects to the USB. This luckily also fitted onto the breadboard.

We have now used this setup several times and largely everyone has completed the toolkit without a hitch. We have had some challenges connecting to the Internet (who doesn’t?). Some of the Wi-Fi boards seem less inclined to connect and can take several minutes to respond. The sensor requires calibrating and this is part of the Toolkit. The maths involved although at GCSE level is a challenge to some however everyone has completed the tasks. Learners have had a taste of what it is to be an engineer. They got to write some software, wire up electronics, make some measurements to calibrate a sensor and create an IoT device that communicates to the outside world.  Oh, and they have fun! We believe we have achieved our goal of providing an insight into the exciting and fun world of engineering.