Blecon sensors are a new type of low-cost Bluetooth-based sensor designed for developers and application builders to feed real-world data into their products and applications.
In this article, I will show you an example of how you can integrate Blecon with AWS and DynamoDB to create a fully serverless real-world data ingestion pipeline.
This tutorial assumes an intermediate-level knowledge of AWS.
The architectural diagram below shows a high level overview of the solution.
Blecon feeds your integration with HTTP requests containing a JSON representation of a real-world events from any sensors that have been connected to it.
To log the data, I will create a Lambda function which creates records in a DynamoDB table. Lambda and DynamoDB are serverless, so this is a cost-effective and scalable way to record Blecon sensor data.
Let’s start with creating our database table. To do so, you’ll need an AWS account. This AWS getting started tutorial may be useful if you've never used AWS before.
Open the DynamoDB console at https://console.aws.amazon.com/dynamodb/.
Click Create Table.
In the Create DynamoDB table screen:
In the Table name box, enter SensorData
For the Primary key, in the Partition key box, enter DeviceID. Set the data type to String.
For the Sort Key, enter Timestamp
When your Blecon network receives readings from your sensors, it will forward it to an HTTP endpoint that you specify. To prepare to accept those sensor readings, let’s create a lambda function that will accept the HTTP request and then write the readings to our DynamoDB table.
import boto3, json
|
We’ll need to grant permissions so that your Lambda function can write to your database table.
You should now see the new policy attached to your Lambda role.
Your pipeline is now ready to use. The last steps are to tell Blecon the URL where to send sensor data.
Your Blecon Network is now forwarding a stream of sensor data to your AWS environment and storing it in your DynamoDB table.
This is the easy part! Connecting Blecon sensors and starting the data stream can be done very quickly and without any coding or configuration. All Blecon Enabled sensors work the same way, regardless of manufacturer.
For this example, we are using the Blecon B1 analytics tag.
To get your sensor connected, scan the Network QR code from the network you just created, then tap on the device to use NFC. For more information, see the quickstarts in the Blecon Documentation.
This quick tutorial shows one way that Blecon helps you add low-cost Bluetooth sensors to your application.
There are limitless ways to integrate sensor data into various cloud environments, from data warehouses to no-code platforms. We'll be exploring some of these possibilities in future articles.
Blecon is currently in limited preview. To apply for early access and receive a free device, get in contact and tell us what you want to build!