Connect with us


Stream heart rate data to QuestDB via Google IoT Core





Thanks to the growing popularity of fitness trackers and smartwatches, more and more people are closely tracking biometric data and integrating the IoT into their daily lives. When I searched the DIY heart rate tracker, I found a good walkthrough from Brandon Freitag and Gabe Weiss that stream data from a Raspberry Pi with a heart rate sensor to BigQuery via IoT Core and Cloud Dataflow using Google Cloud services.

Cloud Dataflow supports streaming insertion into BigQuery, but I wanted to take this opportunity to try out a new time series database called QuestDB. QuestDB is a fast open source time series database compatible with the Postgres and Influx line protocols. The live demo on the website queries over 1.6 billion rows of NYC taxi ride datasets in milliseconds, so I was excited to try this database. To conclude the end-to-end demo, I used Grafana to retrieve and visualize data from QuestDB.


In this tutorial, you will use Debian images and Python scripts to send simulated sensor data over IoT Core. If you want to send the actual sensor data from the Raspberry Pi, the kit above includes everything you need along with the installation instructions. If you have a Raspberry Pi without a kit, you can replace it directly with the following VM instance to run the provided Python script or add your own input.

Google Cloud Setup

To use Cloud IoT Core and Cloud Pub / Sub, you first need to create a Google Cloud Platform account and a new project (my name is questdb-iot-demo).invite

APIs and Services-> Enable APIs and Services-> Search APIs and Services

Enable the following APIs.

IoT Core Pub / Sub Compute Engine IoT Core

IoT Core is Google’s fully managed IoT service that helps you securely connect and manage your IoT devices. In this demo, we will create a registry called heartrate and send MQTT data.[レジストリの作成]Click to set the registry ID and region based on the nearest geographic region (it was us-central1 for me).

Next, you need to configure a Pub / Sub topic to publish your device data.[クラウドPub /サブトピックの選択]so,[トピックの作成]Click and specify the topic ID heartratedata.

After configuring the registry properties and CloudPub / Sub topic,[作成]Click.

Compute Engine

Then add the simulated device. The public key must be added for the device to communicate with IoT Core. Go to Compute Engine-> Create.

The default options (e2-medium, Debian 10 image, us-central1) work in the simulator. If you select something other than us-central1, make sure the region matches the IoTCore registry region. When the VM is ready,[接続]Under[SSH]Click the button and use the following command to install the project code.

Pub / Sub

Finally, you need to create a subscription to the Pub / Sub topic in order to pull the message and insert it into QuestDB. Go to’Pub / Sub’and click on the heartratedata topic. Name your subscription questdb,[作成]Click.

IoT device setup

Once you have the ec_public.pem key, you will be returned to the IoT core registry.[デバイス]Under[デバイスの作成]Click.[デバイスID]Enter raspberryHeartRate in[通信],[クラウドログ],[認証]Expand the dropdown.

[認証]So, change the public key format to ES256, paste the key from the VM or Raspberry Pi,[作成]Click.

QuestDB setup

At this point, Google Cloud has everything to send data to Pub / Sub topics. Next, you need to write the code to get these messages and insert them into QuestDB. Let’s start by launching QuestDB via Docker.

The above command pulls the latest QuestDB image (v5.0.6) and maps port 9000 in the console UI to port 8812 in the Postgres connection. By naming the container questdb-heartrate, you can reference the container after it has been stopped and heart rate data has been retained.

Open the QuestDB console at ( and create the heart_rate table.

Note: If you don’t see the heart_rate table in the Tables and Schema Explorer panel, click the refresh icon above the table. )

Pub / Sub to QuestDB

Since there is no native Pub / Sub integration, you need to write a simple program to listen for new Pub / Sub messages and insert the data into QuestDB. I’m using NodeJS v14.15.4, but I can achieve the same with similar client libraries for Pub / Sub and Postgres.

First, configure your gcloud SDK to authenticate with your GCP project without downloading your service account (see Simple GCP Authentication with Service Accounts for more information).

Then create a new NodeJS workspace and install the @ google-cloud / pubsub and pg packages. You can use the code below to listen for Pub / Sub and stream it to QuestDB.

Send data

Finally, you’re ready to send the simulated data. Go back to Compute Engine and SSH into the VM again. Issue the following command to send the data to the IoT Core device.

If successful, you will see a log similar to the following:

When you run the NodeJS code, you’ll see that the QuestDB is populated.

Data visualization using Grafana

The QuestDB console provides out-of-the-box default visualizations, but configures a Postgres data source to visualize heart rate data to simulate scenarios that combine all metrics. To launch Grafana from Docker, do the following:

Go to http: // localhost: 3000 / login using your default credentials (admin: admin).[構成]->[データソース]Search for Postgres.

Enter the following login credentials (password: quest), make sure SSL is disabled,[保存してテスト]Click.

Finally, let’s create a dashboard. Add a panel to your Grafana dashboard and add the following SQL query.

If everything is working as expected, you can see the sample heart rate data.

If you run the same query in QuestDB, you have the option to visualize the same data points there for comparison using the charting feature.


At this point, you have an end-to-end system of devices that securely send data through the IoT Core and stream the data to QuestDB. To extend this example to multiple devices, add devices in IoT Core and scale the server to use pooled connections to add data to QuestDB more efficiently. For large scale, you can also see the aggregate instead of the raw data points (for example, avg (heartrate) as avg_hr from heart_rate SAMPLE BY 1d).

What Are The Main Benefits Of Comparing Car Insurance Quotes Online

LOS ANGELES, CA / ACCESSWIRE / June 24, 2020, / Compare-autoinsurance.Org has launched a new blog post that presents the main benefits of comparing multiple car insurance quotes. For more info and free online quotes, please visit https://compare-autoinsurance.Org/the-advantages-of-comparing-prices-with-car-insurance-quotes-online/ The modern society has numerous technological advantages. One important advantage is the speed at which information is sent and received. With the help of the internet, the shopping habits of many persons have drastically changed. The car insurance industry hasn't remained untouched by these changes. On the internet, drivers can compare insurance prices and find out which sellers have the best offers. View photos The advantages of comparing online car insurance quotes are the following: Online quotes can be obtained from anywhere and at any time. Unlike physical insurance agencies, websites don't have a specific schedule and they are available at any time. Drivers that have busy working schedules, can compare quotes from anywhere and at any time, even at midnight. Multiple choices. Almost all insurance providers, no matter if they are well-known brands or just local insurers, have an online presence. Online quotes will allow policyholders the chance to discover multiple insurance companies and check their prices. Drivers are no longer required to get quotes from just a few known insurance companies. Also, local and regional insurers can provide lower insurance rates for the same services. Accurate insurance estimates. Online quotes can only be accurate if the customers provide accurate and real info about their car models and driving history. Lying about past driving incidents can make the price estimates to be lower, but when dealing with an insurance company lying to them is useless. Usually, insurance companies will do research about a potential customer before granting him coverage. Online quotes can be sorted easily. Although drivers are recommended to not choose a policy just based on its price, drivers can easily sort quotes by insurance price. Using brokerage websites will allow drivers to get quotes from multiple insurers, thus making the comparison faster and easier. For additional info, money-saving tips, and free car insurance quotes, visit https://compare-autoinsurance.Org/ Compare-autoinsurance.Org is an online provider of life, home, health, and auto insurance quotes. This website is unique because it does not simply stick to one kind of insurance provider, but brings the clients the best deals from many different online insurance carriers. In this way, clients have access to offers from multiple carriers all in one place: this website. On this site, customers have access to quotes for insurance plans from various agencies, such as local or nationwide agencies, brand names insurance companies, etc. "Online quotes can easily help drivers obtain better car insurance deals. All they have to do is to complete an online form with accurate and real info, then compare prices", said Russell Rabichev, Marketing Director of Internet Marketing Company. CONTACT: Company Name: Internet Marketing CompanyPerson for contact Name: Gurgu CPhone Number: (818) 359-3898Email: [email protected]: https://compare-autoinsurance.Org/ SOURCE: Compare-autoinsurance.Org View source version on accesswire.Com:https://www.Accesswire.Com/595055/What-Are-The-Main-Benefits-Of-Comparing-Car-Insurance-Quotes-Online View photos

picture credit


to request, modification Contact us at Here or [email protected]