Send BLE data to cloud

2021-05-05 13:44:43
Send BLE data to cloud

In this article, we will see how to send BLE data to the cloud. Together with the BleuIO javascript library and BleuIO USB dongle, we will get BLE data from HibouAir. After getting the advertised data, we will pass it to a simple function that will give us an object with meaningful air quality data numbers. Then we will send the data to the firebase cloud. 

For this project, we will need 

Step 1:

Clone the GitHub repository using git clone https://github.com/smart-sensor-devices-ab/hbiouAirToFirebase.git

Step 2:

Create a firebase account from https://firebase.google.com/. After creating a firebase account, create a project and an app under this project. Make sure its a web app. Once the app is ready, collect your app information API key, apiKey etc.

Also, make sure your firebase database read-write rules are true.

{ "rules": { ".read": true, ".write": true } }

Now open firebaseconfig.js file from the root folder and paste your information.

Step 3:

Let's start the app. To run the app, we need to have a website bundler. We can use parceljs. Install parceljs from https://parceljs.org/getting_started.html

Once it's installed, go to the app folder and type parcel index.html

You will have your app running on the browser.

Step 4:

Connect your dongle to your pc. 

Open the app on your browser and click connect. 

Click on the device information. If you see the device is in peripheral mode than you have to make it central. 

Click on the central button. And recheck device information. 

Step 4:

Lets scan for nearby devices. 

Click on the scan button and look at the list of the scanned device on your console log. Pick any HibouAir devices and copy the device information. 

Open the index.js file and go to line 95

replace the scan target information with the one you copied.

Now save the page and click on send data to the cloud. If your firebase configuration is correct, you should see data showing on your cloud database. 

Right now, its sending data every 5 seconds. 

You can stop the process by clicking stop sending data.

Have a look at the following video for a better understanding. 

Enjoy.

Share this post on :