Git Product home page Git Product logo

aws-iot-robot's Introduction

AWS IoT Robot

The code and kit list in this repository enables the building of an AWS IoT and AWS Greengrass (v2) controlled Raspberry Pi robot. This repository provides the code and assets for an AWS IoT workshop - please refer to that workshop (URL TBC) for detailed build instructions.

There are a number of physical components required to build the robot itself, and this has been done using readily available and low cost parts to hopefully give more people the opportunity to build their own IoT Robot.

Introduction

You will need an AWS account in which to build this solution. The solution demonstrates a number of different capabilities of AWS IoT and different ways of implementing those capabilities with the aim of bringing them together to help understand the different approaches and determine what is the best one for a given situation.

The core components of the solution are:

  • A Web site/application - Using Angular, the web app displays robot movements, a WebRTC video stream from the PiBot camera and allows control of the camera direction
  • Robot - A Raspberry Pi running AWS IoT Greengrass for managing the Lambda functions that control the PiBot actions
  • Remote Control - A second Raspberry Pi (Pi Zero W) acts as a remote controller for the robot, using MQTT for communication over wireless. The remote uses an accelerometer - you tilt the remote and the robot moves in that direction.

CloudFormation templates are provided to create the core AWS resources and also the AWS IoT specific resources.

What will you build

A robot :-)

robot and remote

And a web application that can also control and track the robot and receives a video feed from the camera.

robot web application

Architecture

The architecture diagram below shows the components of the service:

architecture

Chassis Build

3D printer files are provided for the chassis of the robot, or you can use your own

chassis

How it works

Communication Flow

The diagram below shows the communication flow between the PiRemote and PiBot, via IoT Core:

architecture

Trusted User Provisioning App

architecture

Parts List

The below list is not exhaustive and covers the key components required. Additional components such as wheels, wiring, breadboard, batteries will be required to complete the build of a full robot

  • Raspberry Pi 3 or 4
  • Raspberry Pi Zero W (suggest using Lithium-Polymer battery and Li-Po shim)
  • 2 x 28BYJ-48 Stepper Motor
  • 2 x ULN2003 Motor Driver Board
  • 1 x ADXL 345 Accelerometer
  • 1 x HC-SR04 ultra-sonic proximity detector
  • 2 x push buttons (normally open)
  • 5v Battery pack suitable for driving Pi and motors

Build

The overall build sequence is as follows:

  • Setup a Cloud9 IDE
  • Build the physical robot, chassis and electronics
  • Create Cognito user pools using CloudFormation template
  • Implement Greengrass pre-requisites (IAM roles, Fleet Provisioning Template)
  • Build the Trusted User Provisioning application
  • Provision the robot as an IoT Thing and Greengrass Core Device
  • Install Kinesis WebRTC on the robot
  • Create and deploy the Greengrass v2 Components
  • Build the physical remote control (optional)
  • Build the Robot web application
  • Create an IoT rule for re-publishing

Steps

Please refer to the AWS IoT Workshop (https://catalog.us-east-1.prod.workshops.aws/workshops/446304b7-b946-4c40-b78f-08bf0025d8f6) for detailed and step-by-step build instructions.

Wiring for PiBot GPIO Pins

architecture

Setting up PiRemote

The PiRemote uses the AWS SDK to connect to IoT Core, so does NOT need Greengrass installed. The scripts on the Pi-Remote are Python 3 based - review the scripts for the Pi-zero-remote for the Python modules that you need to install to run the script.

There is no automated provisioning for the remote yet, so you will need to create the certificates in IoT Core for the Pi-Remote Thing and copy them to the device. Adapting the PiBot Trusted User Provisioning web app should be pretty simple to provision the Pi-Remote in the same way.

Wiring for PiBot Remote GPIO Pins

architecture

aws-iot-robot's People

Contributors

amazon-auto avatar dependabot[bot] avatar gemmerton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aws-iot-robot's Issues

Step 6 issues

Step 6.2.2
npm install error:
I had to reverse the changes in this pull-request (0b7717e) in order to get npm install to complete. Happened on both 32-bit bullseye and 64-bit Bookworm running on a Raspi 4 4gb.

Step 6.3.3
Not really an issue as it automatically fixes this for you, but "sudo a2enmod cgi" should be "sudo a2enmod cgid".

Thanks,
Noor

? Missing Instructions in AWS workshop

Hello. Thanks for providing the tutorial. I didn't see an obvious way to raise questions on AWS so thought I'd ask here. I can't seem to login (Step 7.2, PiBot Provisioning Login) and have worked backwards to try to solve the issue without success. It seems there are some instructions missing at step 6.3 (see image below and 2 arrows). I believe I was able to make the .py scripts executable (chmod +x), but can't confirm and I don't know how to adjust the green grass certificates. Any help would be appreciated.

Thanks,
Noor

AWS_PiBot_login AWS_PiBot

Step 13 Issue

Step 13.1
Site access error
When navigating to the cloudfront website, I kept getting access denied error. I double-checked the S3 bucket settings and troubleshooted here with no obvious reason as to why I was getting the error. Input would be appreciated.

Thanks,
Noor

Step 9 issues

Step 9.3.1
typo
In the tutorial, the "exec_path" line of start-webrtc.py reads: "/homels/pi....". Removed ls -> /home/pi...
This file is imported into Cloud9 in the beginning of the tutorial and does not contain the typo. Consider adjusting the tutorial to only change line 8 with CRED_EP variable instead.

Step 9.4
Component module import error
I was not able to deploy the move and proximity components. In the /greengrass/v2/logs, I keep getting ModuleNotFoundError: No module named 'awsiot' for move and 'boto3' for proximity on line "import awsiot.greengrasscoreipc". I've made sure they (as well as awsiotsdk) are installed as user and that /home/pi/.local/bin was in PATH. I then installed the modules globally and added /home/pi/.local/bin as well as other potentially pertinent paths to PATH for all users and still couldn't deploy successfully. I recreated the component and added a "RequiresPrivilege": true, lifecycle hook, but that didn't deploy either. Input would be appreciated.

The KVS component deployed successfully and I was able to view the stream on AWS Kinesis dashboard on 32-bit Bullseye. In case you run this on 64-bit Bookworm, I had issues with gstreamer and followed the instructions here to get streaming to show up.

Thanks,
Noor

Step 12 issues

Step 12.1
Typo
Remove ")" after ..role.json
ROLEARN=$(aws iam create-role --role-name "Cloud9-iot-republish-role" --assume-role-policy-document file://iam-assume-role.json) | jq -r '.Role | .Arn').

Step 12.2
: bad substitution
I kept getting : bad substitution error when trying to create the iot-rule.json. I had to manually create the rule via AWS IoT dashboard (message routing -> rules).

Thanks,
Noor

Step 8 issue

Step 8.7
running "make" fails on both 32-bit bullseye and 64-bit Bookworm:

I kept running into errors with openssl but was able to successfully build after modifying CMakelists.txt. See: https://github.com/dave-malone/aws-kvs-webrtc-demo-for-raspberry-pi/blob/main/build-kvs-webrtc.sh. I entered these lines in the terminal after running "cmake ..".

patch CMakeLists.txt; don't build openssl or mbedtls since those are installed via package manager

sed -i 's+build_dependency(openssl ${BUILD_ARGS})+#build_dependency(openssl ${BUILD_ARGS})+g' amazon-kinesis-video-streams-webrtc-sdk-c/CMakeLists.txt
sed -i 's+set(OPENSSL_ROOT_DIR ${OPEN_SRC_INSTALL_PREFIX})+#set(OPENSSL_ROOT_DIR ${OPEN_SRC_INSTALL_PREFIX})+g' amazon-kinesis-video-streams-webrtc-sdk-c/CMakeLists.txt
sed -i 's+build_dependency(mbedtls ${BUILD_ARGS})+#build_dependency(mbedtls ${BUILD_ARGS})+g' amazon-kinesis-video-streams-webrtc-sdk-c/CMakeLists.txt

Thanks,
Noor

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.