Overview: Sending BLE data to Google Firebase Cloud
In this article, we will see how to send BLE data to the cloud, i.e Google Firebase 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. Then we will send the data to the firebase cloud.
For this project, we will need
- BleuIO USB dongle
- HibouAir – Air Quality Monitor
- Firebase account
Steps to send BLE data to Google Firebase Cloud
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 it’s 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.
|
1 |
{ "rules": { ".read": true, ".write": true } } |
Now open the 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/webapp/
Once it’s installed, go to the app root folder and type parcel index.html on your console.
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 then you have to make it central.
Click on the central button. And recheck device information. The dongle will stay in central mode until you reset or remove the dongle.
Step 5:
Let’s scan for nearby devices.
Click on the scan button and look at the list of scanned devices 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.
On the browser, screen click on send data to the cloud. If your firebase configuration is correct, you should see data showing on your cloud database.
Right now, it’s sending data every 5 seconds. You can stop the process by clicking stop sending data.
Video Tutorial & Guide
Have a look at the following video for a better understanding.






