Build a Bluetooth Low energy application with the Chrome. Web Bluetooth vs Web Serial (Bluetooth Dongle)
June 3, 2022In general, most of us think of Bluetooth as a simple device-to-device connection used to do things like play music or other audio (speakers/headsets), offer quick access (smartwatches), or perform other tasks. But there is a new Bluetooth standard and it allows the browser to control Bluetooth devices nearby.
These features can be accessed using Web Bluetooth or Web serial API. What is promising is that both features are already available in Chromium-based browsers (Google Chrome, Edge, Opera). It makes it easy for web developers to interact with users’ peripherals in their homes – if the user would of course allow them.
Web applications are adapting to face the challenges of a competitive native environment. There is a concern that the browser may connect to nearby Bluetooth devices – wondering what kind of information the site can access is a question that needs to be asked. The good news is that, as with all other APIs built into browsers like Chrome, every website has to request access. The browser shows a pop-up asking for permission to access the site in question, just as it does for messaging, site access or the webcam. If the user does not respond, the request will be denied automatically. Users can also change this permit decision at any time.
What is Web Bluetooth?
Web Bluetooth allows websites to communicate with nearby Bluetooth devices. That means no need to install any dedicated native app to connect to a beacon, heart rate monitor, smart light bulb, or any other Bluetooth Low Energy device. Using Web Bluetooth, developers can easily connect to nearby BLE devices and read/write Bluetooth characteristics. However, web Bluetooth has certain limitations when it comes to developing a complex Bluetooth application.
What is Web Serial?
A serial port is a bidirectional communication interface that allows sending and receiving data byte by byte. The Web Serial API provides a way for websites to read from and write to serial devices with JavaScript. These devices may be connected via a serial port, or by USB or Bluetooth devices that emulate a serial port.
Developing a complex Bluetooth Low Energy application for a web browser is relatively easy with Web Serial and a Bluetooth USB dongle BleuIO. The AT commands available on Bluetooth Low Energy USB dongle called Bleuio helps to do BLE operations easily. List of AT commands can be found here, https://www.bleuio.com/getting_started/docs/commands/
Another advantage of using Web Serial; there are good web serial libraries available along with BleuIO’s own JS library , which makes it easier to develop Bluetooth Low Energy applications.
We think both the API has the potential to revolutionize how companies will create the BLE devices of the future, allowing users to manage and configure these devices by simply using a browser. We also hope this becomes officially supported by more browsers.