GithubHelp home page GithubHelp logo

simple-iot-project's Introduction

simple-iot-project

A simple project that demonstrates how to setup an IoT application using AWS IoT core and AWS Greengrass.

Below is the high level architecture.

component-diagram

Requirements:

  1. A Virtual machine with access to a webcam. (Host computer can also be used but VM is preferred) with following tools installed

    1. AWS CLI
    2. Python runtime
  2. AWS Account

If you are using an Oracle Virual box to create VM then chekout this article which explains how to connect host webcam to VM.

Steps

Create AWS resources

  1. Create a s3 bucket. bucket name: autonomous-vehicle-iot-proj-bucket bucket configuration: Provide public access to the bucket.

Copy the artificats (Python code) to the s3 bucket

aws s3 cp  AVPubSub.py s3://autonomous-vehicle-iot-proj-bucket/artifacts/AVPubSub.py
  1. Create an IAM policy with the below permissions. Policy-name: greengrass-access-policy Update the policy for more granular control of resources as per your requirment.
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents",
                "logs:DescribeLogStreams",
                "s3:GetBucketLocation",
                "greengrass:*",
                "iot:*",
                "s3:*",
                "iam:*"
            ],
            "Resource": "*"
        }
    ]
}
  1. Create an IAM user. username: av-edge-server-management-user Policy: greengrass-access-policy

    Create Access key, secret key for the user and export them as environment variables in the VM.

VM Setup

Install python and AWS CLI tool. Export the AWS ACCESS KEY and SECRET KEY that was created in earlier steps.

AWS Greengrass setup

Go to AWS IOT Service: https://us-east-1.console.aws.amazon.com/iot/home?region=us-east-1#/home

Go to core devices section which is under Manage -> GreenGrass Devices

  1. Add a new core device in AWS IoT Core. Core-device-name: AV_Edge_Server. Create a new group or reuse existing group.

    Follow the instrcutions mentioned in the wizard.

Once this step is completed, you should see a new core device in the AWS. A new IAM policy also will be created once the greengrass is installed on the VM Make sure to update that policy by giving access to s3 bucket (autonomous-vehicle-iot-proj-bucket) that was created.

  1. Create new component: The receipe JSON can be found at this location.

  2. Create new Deployment: name: AV_Edge_Server_Deployment Mention the Core device added in previous step. Select components: AV_PubSub aws.greengrass.nucleus aws.greengrass.Cli

    The code from the s3 bucket (autonomous-vehicle-iot-proj-bucket) will be deployed to the edge server.

Debugging steps:

Run below command in the VM to check logs

sudo tail -F  /greengrass/v2/logs/AV_PubSub.log

If Camera is not accessible to the python application, it might be user permission issue. Run the below command to provide access

sudo usermod -a -G video ggc_user 

Testing:

AWS IoT Core platform provides a MQTT Test client which is available under Test section.

Demo.mp4

simple-iot-project's People

Contributors

sagartrimukhe avatar

Watchers

 avatar  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.