BBC micro:bit and BIPES – a simple demo with IoT

This is a simple demo of BIPES and BBC micro:bit using BIPES with BIPES EasyMQTT bridge feature sending data to the BIPES IoT cloud and making it available for everyone on real time! Thanks for the micro:Bit Brasil community and Hackids for motivating this post!

Setup

First, install MicroPython on your BBC micro:bit board (simply copy the .hex file to the MICROBIT thumb drive):

Dowloard the .hex file from here:

https://github.com/mcauser/microbit-tm1637/tree/master/firmware

Plug the micro:bit board on a computer and copy the file to the thumb drive created by the micro:bit board.

More information at BIPES website:

Create your program

Now you can go to BIPES web site and create your program:

https://bipes.net.br/ide/

On the top right of the screen, select BBC Microbit:

Next, click on the connect button, select the USB port and check the Console tab. You should be able to interact with the MicroPython interpreter on the BBC micro:bit:

Ready!

Now you can create block-based programs with BIPES for the BBC micro:bit. Here is an example:

If you which, you can directly access this program by clicking on the link below:

https://bipes.net.br/beta2/ui/#xdq677

And the result is:

Note that MicroPython supports many micro:bit features, but just a few are implemented on BIPES (lack of time). Here is a list of supported features and MicroPython commands for micro:bit:

https://microbit-micropython.readthedocs.io/en/v2-docs/

But no problem just a few are supported. You can easily build your own blocks like I did:

Plot data using USB port

Note that the program listed above has the “Show data on IOT tab” block. This block “prints” data to the console and such data are routed to the IOT tab. There you can easily customize several types of gadgets for real-time data visualization using BIPES data source.

Again, just access the link:

https://bipes.net.br/beta2/ui/#xdq677

Click on IOT tab, and connect to the board. When the program is running you will automatically see the data being updated. This happens thanks to the BIPES-DATA messages sent from the board to the console:

Share data with the world!

Note that on the Console tab there is a “Bridge data to EasyMQTT” switch. When this switch is active, data received on the USB port are forwarded to BIPES EasyMQTT server and made available to anyone on the Internet. You can view the raw data on the EasyMQTT URL:

http://bipes.net.br/easymqtt/?session=5000

The result is:

You can also download all the data on the server for a give topic:

And the result is:

The nice part is that now we can configure our IOT tab to get data over the Internet using EasyMQTT:

https://bipes.net.br/ide/#vmtvhw

And the result is:

The shared link can be generated by clicking on the share button and will allow anyone, on any device to view data from your micro:bit on real time! The data goes from the micro:bit using USB to your browser, then to BIPES server and to the world!

Other Cool features

BIPES OFFLINE

If you have Internet connection problems, you can download BIPES offline and use almost all BIPES features offline, without the need of any connection or without the need to install anything. Simple unzip the BIPES OFFLINE zip and click on index.html.

Download link:

https://github.com/BIPES/BIPES/releases/

File manager

BIPES has a unique feature for boards with MicroPython, including micro:bit, which is a file manager on the web browser. It allows you to load programs and files on the board. You can also download and interactively edit files and MicroPython programs and click “Run” to test them. The code automatically generated by the blocks is also available for text mode editing. All the files are permanently stored on the board, so you can have multiple programs, select the one you want to run, create data log files, etc!

Multiple programs

BIPES allows you to work simultaneously with multiple block-based programs. Click on the user button on the top right area on the screen and alternate between programs. This great feature has been implemented by Jorge.

TODO

There are some bugs on the File manager when the board is BBC micro:bit v1. We plan to fix them as soon as possible. Moreover, we plan to create blocks to all features of MicroPython on BIPES. This is quite easy using BlockFactory (https://blockly-demo.appspot.com/static/demos/blockfactory/index.html) , but takes time. Want to help? 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s