Awesome Open Source
Awesome Open Source

Nordic Thingy Demo Platform

Platform demonstrates a Nordic Thingy:52 and AWS integration use case. The back-end and front-end are entirely powered by Amazon Web Services. The device sends metrics to AWS IoT via BLE connector (PC).

You can see the live demo here.

Contents

Platform Schema

How It Works

Nordic Thingy:52 is used as a demo device. It is a "thing" for the AWS IoT service. Listener (PC) connects to the device over Bluetooth via middleware. Middleware subscribes to sensors updates and resends data to AWS IoT. It updates its shadow with sensors data every second. Following environmental sensors are supported: Temperature, Humidity, Air pressure, Air quality (CO2 and TVOC), Color and light intensity. Following motion sensors are supported: Tap detection, Orientation, Step counter, Quaternions, Euler angles, Rotation matrix, Gravity vector, Compass heading. Time series data is stored in the cloud. And you can observe actual data and history on a dashboard. Also after clicking on the button a marker is being sot on charts.

Serverless

Back-end (AWS-base) and front-end (SPA) are running on AWS, deployment is provided via serverless.
serverless.yml - is a serverless template which provides all resources for cloud setup.

Features

  1. Back-end IoT application template based on AWS.
  2. Web-dashboard for display device data.
  3. Automation of deployment process.
  4. Local (offline) development without deploying in the cloud.

Back-end

Back-end is entirely powered by Amazon Web Services. See platform schema. If you don't have an AWS account, create one. Amazon provides AWS Free Tier for new accounts. Demo platform is lightweight and should fit into the free tier limits.

Front-end

It is a React and Redux application which renders the board sensors data as D3.js charts. On the application start, initial data set is fetched from a public API endpoint. By default data for the last 4 hours is rendered. Charts are updated in a real time with the data coming from the Cloud via MQTT over WebSocket protocol. They have two visualization modes: line and area. Here are links to dashboard source code and live demo.

Requirements

  1. Bluetooth module should be connected to PC.
  2. aws cli should be available on the host system. See configuration guide.
  3. Node.js 8+ should be available on the host system. See setup guide.
  4. noble with dependencies should be installed on the host system. See prerequisites.

Setup

  1. Clone the repository.
  2. Go to the project directory.
  3. Install dependencies by running CLI command npm install.
  4. Copy config.sample.yml to config.dev.yml and set your own settings. Note: Replace OWN_API_KEY in config.dev.yml for a valid Open Weather Map API Key.
  5. Setup local dependencies (serverless-local-dynamo) by running npm run setup.
  6. Deploy back-end to your AWS account.
  7. After that [connect device](#connect device) or use device simulation.

Deployment

For deployment to your AWS account perform the following:

  1. Go to project directory.
  2. Deploy back-end to AWS by running npm run deploy:sls.
  3. Deploy front-end to S3 by running npm run deploy:spa.

Offline Development

For local development serverless-offline plugin is used. To launch app in offline mode perform the following:

  1. Go to project directory.
  2. Start local development server by running npm run offline.

Note: For local AWS IoT we use Mosquitto Broker, setup on local machine with enabled WebSocket protocol (127.0.0.1:1883), without auth

Connect Device

To setup connection to your Nordic Thingy:52 perform the following:

  1. Switch on your Nordic Thingy:52.
  2. Push central button to wake up the device.
  3. Go to the project directory.
  4. Launch connection task by running npm run thingy52:device:connect.
  5. Select your device from the list by MAC-address.

Device Simulation

If you don't have a Nordic Thingy:52 you can use program simulation of the device. For launch simulation do following:

  1. Go to the project directory
  2. Launch simulator by running npm run thingy52:simulator:aws

Note: Current version of device simulator is AWS-based, you should deploy serverless stack before launch it.

External Resources
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Javascript (1,089,895
Aws (38,644
Sensor (15,786
Iot (12,044
Amazon (11,080
Serverless (9,998
Offline (5,534