Snap! connector for micro:bit: HEX and library for BLE access to all GPIOs

Just realized that I had never posted the work that our NSF project has done to enabling folks to access all the ports on the micro:bit using open source resources.

The aim of our work was to allow anyone to freely use a low cost breakout board to access all the digital and analog IO ports, as well as to support servos and motors on the micro:bit. It is vital that the m:b was untethered using BLE so we could support multiple feedback paths and complex control systems (the drip feeding ensures that we don't run out of m:b memory).

We did not want to call to any external API or program, wanting the students to do all the work in Snap! (hard enough to do without adding another darned language for HS students to master!).

Project ExCITE (NSF1923552) has developed a web app that enables:

  1. a means to scan and connect with micro:bit devices via BLE
  2. hosts a child page (iframe) in which the Berkeley Snap! web app runs.
    [Here is a link to the page].
    Please note: nothing will work until the micro:bit is initialized (next topic) and paired.

In addition, we have developed the HEX initialization file to enable to m:b to work with the web app: information can be found here: (Beauty and Joy of Computing) (click on ITEEA item 2 for setup info and HEX download).

The full IO control library will open once the m:b is paired with the webpage above. In the meantime, you can explore most of the blocks through this link. Have a look at the sensing palette!

There are some downside of our approach: if you want to use all the IO capability, you will see that you have to turn off Display ... it uses a 5x5 matrix that is driven by 6 of the IO lines, and it is not possible to share access simultaneously. That does mean that you have to include a turn off display command early in your program if the m:b has been used as a display unit (or, conversely, turn on display if you wish to use it).

The heavy lifting on this project has been undertaken by Steve Holmes, in conjunction with the ExCITE Computer Control team. Hofstra University has undertaken to support this work for a further 3 years.

We will be demonstrating the system during Snap!Con 22

If anyone want to learn more, or get a guide to the use of the block library and its parametrics, just ask!

@bh is a consultant on this project. We installed the hex file on a micro:bit and used it to control a DC motor. Here's a ten-second video clip:

Dropbox - MakerBit and Snap.mp4 - Simplify your life

This is a very exciting (no pun intended) development.

If anyone want to learn more, or get a guide to the use of the block library and its parametrics, just ask!

yes, please. Can you provide a link to the MakeCode program that created the hex?

Thank you!

Just a bit of feedback on 1st glance - I'd make a custom Snap! category for the blocks

I've asked Steve Holmes to reply.

Does category = palette? We were building upon the work done by BirdBrain Tech using Snap on their microb:bit Hummingbird controller. The control blocks fit quite well into the palettes, although there is some inconsistency in the Sensing one: in addition to all the Read blocks, there are a load of output blocks. I wonder how easy it is to add an Outputs palette?

Yes, category = palette

To create a custom category, just select option from main menu
image

I'm not able to turn pin 12 off (0) on the micro:bit. Pins 5-16 can be set either way (LED turns on, off, for example).

The ITEEA connector Snap blocks library doesn't use Pin 12 - it reads and writes (digital) from P1-16 skipping 12. On the analog side, it reads and writes 0-4 and 10.

image

This is from Steve Holmes (who created the hex): He's asking about the MakeCode program which generated the .hex file. There is none. The program which generated the .hex file is written in C++. If he's not afraid of that, then I'll give him the link to the GitHub Repo.

No worries, let me know the github or other link to the source, or let me know the best way. Thanks!

Hi
I just tried to use this but I'm not sure what sequence of steps is needed to get it working

I have downloaded the .hex file
https://excite.techlit.org/snap/hexFile/MicroBitCon
and uploaded it to my microbit - what do I do next?

We were able to control the micro:bit using Steve Holmes' software. When we're back in the office on Monday, we can send you a description of the exact sequence of steps that we used.

Thanks :slight_smile:

@cymplecy Here's a link to the hex file: ExCITE ITEEA MB Software - Google Drive

You want the one labeled "MicroBitConnector-Bluetooth".

With your microbit connected, drag and drop the hex file onto the device. Once it's copied, eject the device. It should now work properly with the Project ExCITE portal.