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.
- Platform Scheme
- How It Works
- Serverless
- Features
- Back-end
- Front-end
- Requirements
- Setup
- Deployment
- Offline Development
- Connect Device
- Device Simulation
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.
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.
- Back-end IoT application template based on AWS.
- Web-dashboard for display device data.
- Automation of deployment process.
- Local (offline) development without deploying in the cloud.
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.
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.
- Bluetooth module should be connected to PC.
- aws cli should be available on the host system. See configuration guide.
- Node.js 8+ should be available on the host system. See setup guide.
- noble with dependencies should be installed on the host system. See prerequisites.
- Clone the repository.
- Go to the project directory.
- Install dependencies by running CLI command
npm install
. - Copy config.sample.yml to
config.dev.yml
and set your own settings. Note: Replace OWN_API_KEY inconfig.dev.yml
for a valid Open Weather Map API Key. - Setup local dependencies (serverless-local-dynamo) by running
npm run setup
. - Deploy back-end to your AWS account.
- After that [connect device](#connect device) or use device simulation.
For deployment to your AWS account perform the following:
- Go to project directory.
- Deploy back-end to AWS by running
npm run deploy:sls
. - Deploy front-end to S3 by running
npm run deploy:spa
.
For local development serverless-offline plugin is used. To launch app in offline mode perform the following:
- Go to project directory.
- 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
To setup connection to your Nordic Thingy:52 perform the following:
- Switch on your Nordic Thingy:52.
- Push central button to wake up the device.
- Go to the project directory.
- Launch connection task by running
npm run thingy52:device:connect
. - Select your device from the list by MAC-address.
If you don't have a Nordic Thingy:52 you can use program simulation of the device. For launch simulation do following:
- Go to the project directory
- 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.
- Build Tools
- Libraries and SDK
- CLI Tools
- Daemons
- Cloud Services