Access BLE data remotely

Bleuio tech - Nov 12 '21 - - Dev Community

Suppose you have some BLE devices at your home and want to control or scan for those devices while at your workplace. In this project, we will discuss how to access BLE data remotely.  

We have already created a script that communicates through BleuIO dongle remotely and gives us the response. You can access the script at 

https://github.com/smart-sensor-devices-ab/bledata_remote_access.git

You are free to clone the script and make changes as you wish. 

In this script, JavaScript is used to connect to the dongle using google chrome’s serial port. There is a simple PHP script that helps pass data through the cloud.

Step 1: Uploading

Upload the API folder in any server that supports PHP. This script reads and writes data to a JSON file upon request.

We have uploaded the file at http://smartsensor.io/api/api.php

You can use this URL if you don’t have a server to upload.

Step 2: Home computer setup

Open the index.js file found in the root folder and update the URL of the API file on both occasions. 

You can leave the url as it is if you want to use file from our server.

Now connect a BleuIO dongle to your home computer and open the index.html file from the root folder.

Click connect and select the COM port where the dongle is connected.

Step 3: Office / Workplace / remote computer setup

Open the index.html file found in the user folder and update the URL of the API file on both occasions.

You can leave the url as it is if you want to use file from our server.

Now open this file in a browser and start writing AT commands.

Currently, You can access the following AT commands 

  • ATI ( Returns firmware version, hardware type and unique organization identifier, device connection status )
  • AT+CENTRAL (Sets the device Bluetooth role to central role.)
  • AT+PERIPHERAL (Sets the device Bluetooth role to the peripheral.)
  • AT+DUAL (Sets the device Bluetooth role to dual role. Which means it has both Central and Peripheral role capabilities.)
  • AT+ADVSTART (Starts advertising)
  • AT+ADVSTOP (S_tops advertising. Returns ERROR if not already advertising_)
  • AT+GAPSTATUS (Reports the Bluetooth role)
  • AT+GAPSCAN=2 (Starts a Bluetooth device scan with the timer set in seconds. Make sure to set a timer for the scan.)

Once you type one of the above commands, you will start to see the response from the dongle on your browser screen.

I am trying to scan for BLE devices at my home where BleuIO dongle is connected. Here I got a list of devices showing on my browser screen. Make sure the device is on central mode to scan for devices.

You can add more AT commands to the script as required. All you need to do is update the index.js file found in the root folder. 

Find the list of AT commands our from getting started guide at

https://www.bleuio.com/getting_started/docs/commands/

. . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player