Micro:bit bluetooth servo problem

Hi, I am trying to connect via bluetooth with a micro:bit. The micro:bit is plugged into a breakout board by which it is connected to a SG90 position servo. How can I control the servo?


Here is what I found out so far:

  • There is: snap . birdbraintechnologies . com It allows me to control several features of the micro:bit. It does not support the control of a servo which is connected via breakout board. (It is designed for the HummingbirdBit.)

  • There is: excite . techlit . org / snap I think, I succeeded in connecting a micro:bit via bluetooth a few years ago. Right now, it just won't work. I guess, I would need a step-by-step tutorial, just to do the bluetooth pairing. (Is this project still active?)

  • There is: snap . berkeley . edu / snap / snap . html # cloud:Username=birdbraintech&ProjectName=MicrobitStarterProject Since it is promoted at this prominent location ( snap . berkeley . edu / extensions ), I thought, it would be the best option. Sadly, I cannot find an appropriate "Snap!" PWM block in this project.

  • My favorite USB way is by using: microblocks . fun It's just working out of the box. So, I am sure that there is no hardware problem.


Greetings to the community. Keep up your work.
Any suggestions would be appreciated. Feel free to ask for further details.

Why not try using Bluetooth with MIcroBlocks?

I've not tried it myself (I've never got on with Bluetooth) but I think there's been some recent work with MicroBlocks and Bluetooth communication

MicroBlocks have their own forum over at Discord

@cymplecy Thanks for the recommendation. I'll take a look at that, but it doesn't solve my problem: For this particular problem the usage of "Snap!" is required.

SnapCon video


Snap side: Devices exposing UART service over BT/BLE sometimes install virtual serial port drivers, which can be accessed via the Serial Ports library. Right now, I'm not aware of any general-purpose, direct, Web Bluetooth library for :snap:

MB side: BLE UART support was implemented behind a conditional directive and required MB firmware built on purpose.
Maybe @tguneysu can provide some information about the current status of the BLE/BT support in MicroBlocks.

@dardoro - could you check for my email from Mar.29 sent to ddoro@poczta.onet.pl ?
Thx.

MicroBlocks supports IDE connectivity over BLE, meaning one can program the microcontroller devices without the USB cable.

Additionally, MB advertises a BLE SERIAL UART service, that can be used to communicate with other environments supporting the BLE UART service. An example is communicating to/from APP inventor programs using this protocol.

We have also demonstrated the possibility of a SNAP Bridge! like connectivity using the broadcasting facility of the MicroBlocks VM over BLE connection to an Android device (min ver 6.0.1 required). That means, one can send and receive commands to/from Android devices over BLE.

Another interesting but a bit long-winded option is to use an interim microcontroller device as a gateway to SNAP. In this model, a microcontroller would be connected to SNAP via the SNAP Bridge! connectivity described in the WIKI. Commands exchanged with this device can be relayed to other devices, depending on the capabilities of the interim device used. eg:

  • micro:bit - can act as a RADIO relay to other micro:bits and as a BLE UART relay to devices other than micro:bit.
  • ESP32 - can act as a WIFI relay, as well as a WIFI Radio relay, specifically utilizing the WIFI Radio feature, very similar to the micro:bit. It can also act as a BLE UART relay, since it also supports BLE.

Using these communication methods, A SNAP program can be made to talk to other microcontrollers and APP Inventor type applications.

The strong point in applying these communications methods is that all programming and exchange protocols involved are under the control of the user. There are no other unknown APPs or APIs involved. The user is in full- control of the entire implementation. I personally value that very much.

Note that none of these are as ideal as SNAP supporting WEB Bluetooth directly. Unfortunately, that does not seem to be available yet!

@dardoro @tguneysu Thanks for the insights. This helps me to understand the different functionalities.

The nature of my problem seems to be less fundamental. It's just a practical issue. I'll put it this way:

  • I'm trying to use "Snap!" (not MicroBlocks - this would be another issue).

  • I succeeded in using the first link of snap . berkeley . edu / extensions (Krissie Lauwers / birdbraintech) and snap . birdbraintechnologies . com .

  • This way just won't work on my Windows11 system: excite . techlit . org / snap - I am aware of the browser settings mentioned in this corresponding video.

  • I am just looking for a "Snap!" block in order to control my directly connected SG90 servo. (I don't possess a HummingbirdBit.)

Again: Thanks for your answers. Please, let me know, if you already gave me the solution and I just didn't get it.

(BTW: I am not able to send links in this forum. But that's another story...)

The ExCITE Project (which has received scale up funding to 2028) is updating the open source microb:bit BLE library, and developing a "trigger" project that will start the BLE pairing process.

The new Bluetooth service library implemented on m:b v2 has caused some delays. Once this work is complete and thoroughly tested, we will ask Jens and Brian to consider adding the trigger block to the library, which would greatly simplify loading/pairing.

Since we are working with HS students on a tightly timed course (US AP CSP), we do not want to add another language (microblocks) to the mix, and intend to use Snap BLE capability.

In the meantime, we use Birdbrain Technologies Hummingbird kits, which does support servos. They have also developed a very simple Snap "trigger" project that initiates pairing, and loads the Berkeley Snap with all the control libraries loaded. Here is the starter code.

@atgordon Thank you very much. It's good to here that there is progress. I am looking forward for the upcoming development.


I tested your mentioned program "BirdBrainStarterProjectBLE". For testing purposes, I succeeded to use the compass block.

Sadly, I'm still missing a block that allows me to use my SG90 servo that is directly connected via breakout board. (I don't possess a Humbingbird board.) I need a PWM control which - I guess - had to be implemented by using JavaScript. Perhaps, a small modification of the Hummingbird Position Servo block might do the trick.

Any suggestions?

If you have a v1.n m:b, you can use the ITEEA BLE and pairing code to run a servo on a generic BO board that has independent power supply (m"b can't power a servo).

Since I can't share any links on the board (BS*100) - not even Snap code, let me know your email address and I'll send you the last working hex and pairing trigger.

Tony

@atgordon Thank you for your answer. I just contacted you via e-mail. (I hope, I connected the dots correctly in order to reach you.)

@atgordon As mentioned via e-mail: Thank you.

I just carefully followed the instructions given by: excite . techlit . org / snap
It's finally working.

Problem solved.

Where exactly are the instructions - I'm seeing this at that URL
image

@cymplecy Due to the fact that we weren't able to share links in this forum "atgordon" supported me via e-mail. Sorry for keeping it short on this forum.

Hardware:
I am using a micro:bit version 1. I am aware that powering the servo might be an issue, but in my experience just connecting the three wires to the micro:bit's breakout board did it's job.

Software:
These are the documents that were most helpful to me. Go to:
excite . techlit . org
And then:
... / videos / ExciteLowCostKitDemo-Bluetooth . mp4
... / snap / hexFile /
... / snap / useSnap . html

Got it

For others, download the .hex file from Directory /snap/hexFile and install that onto your Microbit

Then (using Chrome) goto Excite Low Cost Kit Snap!

Make sure you goto chrome://flags/#enable-experimental-web-platform-features and enable the setting

And then watch the video at https://excite.techlit.org/videos/ExciteLowCostKitDemo-Bluetooth.mp4 for how to use