Maker.io main logo

Access BLE data remotely

2021-11-12 | By Sheikh Shuhad

License: GNU Lesser General Public License

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.

Access BLE data remotely

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.

Access BLE data remotely

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.

Access BLE data remotely

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 (Stops 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.

Access BLE data remotely

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/

制造商零件编号 SSD005/4-V2W
BLUETOOTH 5 LOW ENERGY USB DONGL
Smart Sensor Devices
¥256.49
Details
制造商零件编号 SSD005/4-V2B
BLUETOOTH 5 LOW ENERGY USB DONGL
Smart Sensor Devices
¥256.49
Details
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum