Giter Club home page Giter Club logo

learning-aws-iot's Introduction

Exploring AWS IoT

AWS provides IoT services for building end-to-end IoT solutions that connect and manage billions of devices. It also provides easy integration with other AWS services for storage (i.e. DynamoDB), analytics (i.e. AWS IoT Analytics, AWS Data Pipeline), visualization (i.e. AWS Quicksight), Machine learning (i.e. AWS Sagemaker), streaming (i.e. AWS Kinesis), and serverless functions using AWS Lambda. Connected devices such as sensors, actuators, microcontrollers can connect to AWS IoT core via HTTPs,MQTT, and Websockets protocol. AWS IoT also provides SDKs for different languages and proper documentation to navigate each service.

Simple examples

Demo Project

Building a simple serverless IoT system using NodeMCU (based on ESP8266 Wi-Fi SoC) and AWS IoT.

Scope of the Project

This project demonstrates how microcontrollers can be used to communicate with the AWS IoT core via MQTT to publish readings from multiple low-cost sensors, and control devices (i.e. light bulbs and other AC loads) in a stateful manner using device shadows. An interactive web dashboard was also developed using HTML,CSS, and JavaScript to demonstrate how the system can be integrated with web and mobile clients to deliver value to end-users.

Requirements

Hardware Requirements

  • ESP8266-based NodeMCU board
  • DHT11 (low-cost Temperature and Humidity sensor)
  • LDR (Light dependent resistor)
  • 1-channel relay module (for controlling AC loads)
  • 5v power supply source
  • LEDs (for simple indication)
  • Light bulb (or any alternative AC load)
  • 10k resistor (1)

Software Requirements

  • Arduino IDE (for programming and uploading code to the microcontroller).
  • Main IDE (i.e. VSCode)
  • Arduino Libraries used:-
    • AdaFruit DHT library
    • ArduinoJSON (for serialization and deserialization of JSON payloads, extremely useful and productive),
    • ESP8266WiFi (for connection to WiFi in station mode),
    • PubSubClient (for simple pub/sub messaging with the AWS IoT MQTT device message broker.)

Configuration steps

  • Create a thing in AWS IoT core
  • Attach a certificate, private key to the created thing. NOTE:- The client certificate and private key will be required by the MCU to connect to the AWS IoT device gateway for pub/sub over MQTT.
  • Create a thing shadow
  • Create a cognito Identity pool. NOTE:- The Cognito identity pool will be required by the web client to connect via websockets over MQTT.
  • Create IoT rules i.e. for inserting data into DynamoDB, ingesting data into an AWS IoT Data pipeline channel, for triggering SNS notifications etc. from your desired topic filters.

Architecture Diagram

Architecture

To program the NodeMCU

  1. Clone the repository to access the required files
$ git clone https://github.com/rexsimiloluwah/learning-aws-iot
$ cd esp8266-aws-iot
  1. Change the credentials in the secrets.h header file to your required credentials (AWS IoT endpoint, client certificate, private key, and root CA), Kindly note that the credentials there are dummy credentials for security purposes.

  2. Connect the components following the circuit diagram (Circuit diagram to be provided soon)

  3. Copy the code in main.ino file to your Arduino IDE, Upload the sketch to the microcontroller.

To run the web dashboard

  1. Clone the repository to access the HTML,CSS, and JavaScript files: -
$ git clone https://github.com/rexsimiloluwah/learning-aws-iot
$ cd web-dashboard
  1. Change the credentials in config/aws-configuration.js to your generated credentials for cognito identity pool ID and AWS IoT endpoint.
let AWSConfiguration = {
   poolId: '<YOUR-COGNITO-IDENTITY-POOL-ID>',
   endpoint: '<YOUR-AWS-IOT-ENDPOINT>',
   region: '<YOUR-AWS-REGION>'
};
  1. Run the index.html file and open in your browser

Screenshot of the web dashboard

Web dashboard

Analytics

Sensor data streams are ingested into an AWS IoT Analytics channel, transformed via a simple ETL-like workflow and stored in a DynamoDB table. A simple Lambda function is used to fetch that data in a paginated manner. The data is also displayed on the web dashboard in the analytics page

Web dashboard

Video Demonstration

learning-aws-iot's People

Contributors

rexsimiloluwah avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.