Simple serverless solution to build a home monitor dashboard using AWS IoT.
Hardware used in this solution:
- ESP8266 with BMP280 sensor to act as a sensor node
- Raspbery Pi 3 to act as GreenGrass Core
Software and services used in this solution:
- AWS IoT to stream metrics from sensor nodes
- AWS DynamoDB to store metric's data
- AWS Cognito to use a identity provider -- although only unauthenticated access is being controlled
- AWS S3 to store and host dashboard's website
- Mongoose-os as the firmware on the sensor
Optional steps, if GreenGrass is used:
- Install NodeJS and Python
- Create a GreenGrass group and a GreenGrass core -- to link to AWS documentation
- Download and install GreenGrass on the target core
Steps:
- Clone this repository
- Install mos -- or build it for your system
- Build firmware for your specific platform: mos build --platform=esp8266
- Flash the microcontroller: mos flash
- Set up WiFi on your device: mos wifi "SSID" "Password"
- Set up AWS IoT: mos aws-iot-setup --aws-region REGION. If using greengrass: mos aws-iot-setup -aws-region REGION --aws-enable-greengrass
- Enable MQTT server: mos config-set mqtt.enable=true
- Create DynamoDB table to store data
- Create AWS Cognito Identity Provider -- modify the unauthorized IAM role to be able to query DynamoDB
- Create a S3 bucket and enable Website Hosting -- remeber to set it public
- Create a AWS IoT rule to insert shadow data to DynamoDB split by columns -- use shadow/update/accepted topic and the following query SELECT state.reported.* from '$aws/things/MY-THING/shadow/update/accepted'
- Upload the content of the web folder into S3, and modify Congito Identity Pool ID on refresh.js
Debugging: To debug the code on the microcontroller, use mos console. To debug GreenGrass, look at the log files on the var/log/system folder of GreenGrass folder