Javascript, WASM, BLE and Web Bluetooth

I am always interested in multiple ways to connect devices. So this is a general thread about Javascript, WASM and BLE Bluetooth.

Background: You make your incredible Edge Impulse Machine Learning embedded device that seemingly magically solves a huge issue for your business, but then how do you communicate that solution to those who need it.

Solutions for this have been covered else-where from Display Screens, Sirens, LED’s, but also Cellular, Wifi, LoRa and yes, for close range BLE. For many businesses BLE could be the best solution and I have some code that allows one BLE device when moved in and out of range of multiple BLE devices to sequentially interact with those devices.

Examples:

Drone flies around a farm collecting data from BLE devices, or worker walks or drives around a business collecting data. If combined with: Cellular, Wifi and LoRa then one device could publish on the web information from multiple devices or using IFTTT could send notifications, text or emails to inform the correct people.

However most computers and cell phones now have BLE and Apps can be specifically made for that computer or cell phone. (App/program design is really interesting, but has a slow learning curve which gets slower the more devices you try to reach. ) Side note: I miss teaching https://build.phonegap.com/ when webpages easily converted to IOS and Android apps. Lots of other choices now for easily making apps, however expect a fair bit of time until you become an expert.

Another possible solution is Web Bluetooth a simple webpage displayed in your browser on either a computer or cell phone that access your BLE devices that are within range. Now that Github supports GitPages, developer webpages are much easier to make and maintain than Apps.

Unfortunately as far as I can tell Web-Bluetooth is fairly flaky, my browser locks up and scanning for devices needs a flag set in your chrome settings. I have to test it but the Android Samsung Browser may have BLE support fully activated. Here is an example page or Web Bluetooth demos, which does get some results if you know the exact name of the BLE device, and that you (strangely) have location services activated.

https://googlechrome.github.io/samples/web-bluetooth/

.

If you are writing code using an Arduino device and the BLE library ArduinoBLE then setting the device name is as easy as

  BLE.setLocalName("myDeviceName");

.

Wondering if anyone on this forum has had any better luck with Web Bluetooth, mainly browser stability. I would be interested in the Javascript side, but I should probably ask @janjongboom if he has had any success with the WebAssembly, WASM side of BLE connectivity?

I’ve actually worked on WebBluetooth for Firefox back in 2014, but not recently. When I toyed around with the implementation in Chrome on Android back in 2016 (while at Arm doing things with micro:bit) it was indeed very brittle, random disconnects, hard to get proper speed from the device. Unfortunately no recent experience, we’re doing some new things with Nordic but that’ll be a native app.

1 Like

@janjongboom almost everywhere I search on Github, I find an open-source solution that you have been a part of. Fairly impressive how many sites you have contributed to.

@janjongboom is a true LEGEND!:sunglasses::top:

1 Like