top of page
Search
Writer's pictureCigdem Sengul

Micro:bit and the Internet of Things

Is the BBC micro:bit an Internet of Things  (IoT) device? My answer to this is: why not?

The micro:bit has sensors. It is able to perform computations better than certain platforms (Micro:bit wins the Grand Digital computer race). It can communicate with its radio. So, it is well equipped to be an IoT device.

But, what is IoT anyway? There is no standard definition. Yes, this is also the case for the communication and software standards for IoT – there are many of them.

Let’s check a few places for what IoT means.  For instance,  the definition in the Oxford dictionary:

Internet of things  noun The interconnection via the Internet of computing devices embedded in everyday objects,                   enabling them to send and receive data.

Depending on which standards body you are talking to, “the ability to send and receive data” may mean different things. According to the IETF (Internet Engineering Task Force), IoT is a large number of embedded devices that use communication services offered by Internet protocols (RFC 7452).  For operators,  Machine-to-Machine (M2M) communications represent IoT and the interactions between things and the cloud.

Yet, many would agree that  IoT is data-centric.  Hence, data collection, connectivity, and data analytics make up the majority of IoT applications. Without a doubt, all three are possible with micro:bit.


In the rest of the blog, I will show a light-sensing application with micro:bit as an example.

Light sensing application

All the code for this application is at https://github.com/ciseng/microbit_iot


The application runs with two micro:bits and a laptop. It has three parts:

  1. Sensing: One micro:bit will act as the sensing device, and will send its light measurements to a second micro:bit using its radio.

  2. Communications gateway: The second micro:bit is the gateway and sends what it receives to the laptop over the serial.

  3. Visualization: To show the incoming measurements, the laptop runs visualization scripts.

Sensing


The “light level” block is a function that gets the light level from 0 (dark) to 255 (bright). The light is measured by using various LEDs from the screen. The sensing micro:bit sends this number via its radio.

Communications


To communicate, both micro:bits need to be on the same radio group. To do one-to-one communication instead, check Chapter 5 of our Networking with the Micro:bit book.

Once the gateway micro:bit receives a number, it displays it using the “plot bar graph” block. It also sends this number over the serial.

Visualization


For visualization, a python script listens on the serial port. As the script receives numbers from the serial, it keeps a counter for the numbers it received.  It then displays them dynamically as points on the graph. For each point (x,y), x is the current counter value, and y is the received value. These points are connected by a line, which moves as new numbers are received. As the counter increases beyond 100, the x-axis of this graph starts moving too.

The following video shows the set-up and how it works.


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #454545}

As I mentioned earlier, micro:bit has other sensors, like a temperature sensor.  So, the application I described here can be modified easily for other purposes. Enjoy!

10 views0 comments

Recent Posts

See All

Comments


bottom of page