SlideShare a Scribd company logo
1 of 24
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Webinars
Anton Shmagin, Partner SA
Wednesday, July 19th, 2017
AWS IoT with ESP32 and
Mongoose OS
AWS IoT
Espressif
Company behind popular ESP8266 and ESP32 modules
• ESP32:
• 240 MHz dual core Tensilica LX6 MCU (600 DMIPS)
• Integrated 520 KB SRAM
• Integrated 802.11BGN HT40 Wi-Fi transceiver
• Integrated dual mode Bluetooth (classic and BLE)
• 16 MByte flash
Find out more at https://www.espressif.com
Espressif and AWS are co-sponsoring this workshop
Cesanta Mongoose OS (mongoose-os.com)
• Hardware agnostic: ESP32, ESP8266, TI CC3200, STM32 and others
• Secure: SSL/TLS, Microchip ATECC508A crypto-chip support, ESP32
encrypted flash support
• Develop in C or JavaScript, or both
• Networking: MQTT, WebSocket, COAP, HTTP/ HTTPS and other
• Mongoose Embedded Web Server and Networking Library
The power of the ESP32
X.509
Certificate
Private
Key
Prerequisites
• AWS CLI configured with valid credentials in the AWS account that
you intend to use
http://docs.aws.amazon.com/cli/latest/userguide/installing.html
• ESP32 Dev board
• A (good!) USB cable to connect the ESP32 board to your computer
• mos – The Mongoose OS flashing tool. Download at
http://www.mongoose-os.com
• git clone of the Mongoose OS repository from GitHub:
Ø git clone -b release https://github.com/cesanta/mongoose-os
Let’ Get Started
• Plugin in the USB cable to your laptop and the ESP32
• The LED module will blink
Start Mos Console:
Ø mos console
You should see:
Using port /dev/cu.SLAB_USBtoUART
Tock uptime: 8.25607 RAM: 166700
Tick uptime: 9.25616 RAM: 166700
Exercise #1 (publish button presses to AWS IoT)
Once you clone git repo, change directory to:
Ø cd mongoose-os/fw/examples/mjs_base
Then execute:
Ø mos build --arch esp32
Ø mos flash
Ø mos wifi SSID PASSWORD
Ø mos aws-iot-setup --aws-region REGION --aws-iot-policy
mos-default
* mos-default is demo quite permissive policy. Please use more restrictive policies in production!
Change the value of highlighted values to reflect your setup
LED will stop blinking
Exercise #1 (publish button presses to AWS IoT)
Start mos console:
Ø mos console
You should see:
Using port /dev/cu.SLAB_USBtoUART
Tock uptime: 8.25607 RAM: 166700
Tick uptime: 9.25616 RAM: 166700
Tock uptime: 10.2566 RAM: 166700
Published: yes topic: /devices/esp32_xxx/events message:
{"free_ram":166632,"total_ram":0}
I (13755) wifi: pm start, type:0
Exercise #1 (publish button presses to AWS IoT)
• Log in to your AWS IoT account and go to AWS IoT service page
• Click on Test
Exercise #1 (publish button presses to AWS IoT)
• Subscribe to topic /devices/#
Exercise #1 (publish button presses to AWS IoT)
• Pressing button on your ESP32 will publish free RAM to the MQTT topic
/devices/esp_XXX
/devices/esp_XXX
Exercise #2 (create AWS IoT Rule to publish to S3 bucket)
• Navigate to AWS IoT ⇒ Rules
• Click “Create a rule”
Exercise #2 (create AWS IoT Rule to publish to S3 bucket)
• Enter Name and Description (“Publish2S3”, “Send FreeRAM values to S3”)
• Define which attributes you would like to store
• Click “Add Action” and choose “Store messages in an Amazon S3 bucket”
Exercise #2 (create AWS IoT Rule to publish to S3 bucket)
• Create a new S3 bucket or use existing one (If creating use unique name)
• Create a new role “iotPublish2S3”
• Enter the key as shown
• Click “Add action”
Exercise #2 (create AWS IoT Rule to publish to S3 bucket)
• Click “Create Rule”
Exercise #2 (create AWS IoT Rule to publish to S3 bucket)
• Press the button on ESP32 few times
• Go to S3 ⇒ {your bucket}
• You should see number of files similar to this picture:
Exercise #3 (Shadow State sets LED)
In the mjs_base directory, copy over the Shadow code:
Ø cp ../mjs_aws_shadow/init.js fs/init.js
Ø edit fs/init.js and change GPIO to:
Ø // TODO: support other platforms
Ø let LED_GPIO = 5;
From mjs_base directory execute:
Ø mos build --arch esp32
Ø mos flash
Ø mos wifi SSID PASSWORD
Ø mos aws-iot-setup --aws-region REGION --aws-iot-policy
mos-default
Exercise #3 (Shadow State sets LED)
Start mos console:
Ø mos console
You should see when you press the button:
[Jul 11 18:05:18.108] Click! Updated: true
[Jul 11 18:05:18.120] mgos_aws_shadow_ev Update: {"state":
{"desired":{"ledOn":false,"foo":2}}, "clientToken": "d7d06332"}
[Jul 11 18:05:18.213] mgos_aws_shadow_ev Version: 5 -> 6 (5)
[Jul 11 18:05:18.225] Event: 3 (UPDATE_ACCEPTED)[Jul 11 18:05:18.235]
mgos_aws_shadow_ev Version: 6 -> 6 (7)
[Jul 11 18:05:18.246] Event: 5 (UPDATE_DELTA)
[Jul 11 18:05:18.252] Reported state: {}
Exercise #3 (Shadow State sets LED)
• Log in to your AWS IoT account and go to AWS IoT service page
• Click on Registry
• Select device
Exercise #3 (Shadow State sets LED)
• View the current shadow state
Exercise #3 (Shadow State sets LED)
• Pressing button on your ESP32 will toggle the LED and the Shadow state
Follow up steps
Go to https://mongoose-os.com/#videos
Follow the examples:
• Internet button
• Smart heater
• ECC508A crypto-element
Cesanta is running a Give Away
https://mongoose-os.com/awsloft
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Webinars
Thank you!
@awscloud
@EspressifSystem
@MongooseOS

More Related Content

What's hot

Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)Drew Fustini
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsDivye Kapoor
 
Understanding the Windows Server Administration Fundamentals (Part-1)
Understanding the Windows Server Administration Fundamentals (Part-1)Understanding the Windows Server Administration Fundamentals (Part-1)
Understanding the Windows Server Administration Fundamentals (Part-1)Tuan Yang
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell ScriptingRaghu nath
 
Python for the Network Nerd
Python for the Network NerdPython for the Network Nerd
Python for the Network NerdMatt Bynum
 
Chapter10 Server Administration
Chapter10     Server  AdministrationChapter10     Server  Administration
Chapter10 Server AdministrationRaja Waseem Akhtar
 
Moving to PCI Express based SSD with NVM Express
Moving to PCI Express based SSD with NVM ExpressMoving to PCI Express based SSD with NVM Express
Moving to PCI Express based SSD with NVM ExpressOdinot Stanislas
 
Linux programming lecture_notes
Linux programming lecture_notesLinux programming lecture_notes
Linux programming lecture_notesIMRAN KHAN
 
쿠키런: 킹덤 대규모 인프라 및 서버 운영 사례 공유 [데브시스터즈 - 레벨 200] - 발표자: 용찬호, R&D 엔지니어, 데브시스터즈 ...
쿠키런: 킹덤 대규모 인프라 및 서버 운영 사례 공유 [데브시스터즈 - 레벨 200] - 발표자: 용찬호, R&D 엔지니어, 데브시스터즈 ...쿠키런: 킹덤 대규모 인프라 및 서버 운영 사례 공유 [데브시스터즈 - 레벨 200] - 발표자: 용찬호, R&D 엔지니어, 데브시스터즈 ...
쿠키런: 킹덤 대규모 인프라 및 서버 운영 사례 공유 [데브시스터즈 - 레벨 200] - 발표자: 용찬호, R&D 엔지니어, 데브시스터즈 ...Amazon Web Services Korea
 
오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기영우 김
 
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성OpenStack Korea Community
 
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)Amazon Web Services Korea
 
Microsoft System Center Configuration Manager for Education
Microsoft System Center Configuration Manager for Education Microsoft System Center Configuration Manager for Education
Microsoft System Center Configuration Manager for Education Herman Arnedo
 

What's hot (20)

Linux file system
Linux file systemLinux file system
Linux file system
 
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOs
 
Understanding the Windows Server Administration Fundamentals (Part-1)
Understanding the Windows Server Administration Fundamentals (Part-1)Understanding the Windows Server Administration Fundamentals (Part-1)
Understanding the Windows Server Administration Fundamentals (Part-1)
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Scale Kubernetes to support 50000 services
Scale Kubernetes to support 50000 servicesScale Kubernetes to support 50000 services
Scale Kubernetes to support 50000 services
 
Linux Internals - Interview essentials - 1.0
Linux Internals - Interview essentials - 1.0Linux Internals - Interview essentials - 1.0
Linux Internals - Interview essentials - 1.0
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Windows Server 2019 -InspireTech 2019
Windows Server 2019 -InspireTech 2019Windows Server 2019 -InspireTech 2019
Windows Server 2019 -InspireTech 2019
 
Python for the Network Nerd
Python for the Network NerdPython for the Network Nerd
Python for the Network Nerd
 
Chapter10 Server Administration
Chapter10     Server  AdministrationChapter10     Server  Administration
Chapter10 Server Administration
 
Linux OS presentation
Linux OS presentationLinux OS presentation
Linux OS presentation
 
Moving to PCI Express based SSD with NVM Express
Moving to PCI Express based SSD with NVM ExpressMoving to PCI Express based SSD with NVM Express
Moving to PCI Express based SSD with NVM Express
 
Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0
 
Linux programming lecture_notes
Linux programming lecture_notesLinux programming lecture_notes
Linux programming lecture_notes
 
쿠키런: 킹덤 대규모 인프라 및 서버 운영 사례 공유 [데브시스터즈 - 레벨 200] - 발표자: 용찬호, R&D 엔지니어, 데브시스터즈 ...
쿠키런: 킹덤 대규모 인프라 및 서버 운영 사례 공유 [데브시스터즈 - 레벨 200] - 발표자: 용찬호, R&D 엔지니어, 데브시스터즈 ...쿠키런: 킹덤 대규모 인프라 및 서버 운영 사례 공유 [데브시스터즈 - 레벨 200] - 발표자: 용찬호, R&D 엔지니어, 데브시스터즈 ...
쿠키런: 킹덤 대규모 인프라 및 서버 운영 사례 공유 [데브시스터즈 - 레벨 200] - 발표자: 용찬호, R&D 엔지니어, 데브시스터즈 ...
 
오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기오픈스택 멀티노드 설치 후기
오픈스택 멀티노드 설치 후기
 
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
 
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
 
Microsoft System Center Configuration Manager for Education
Microsoft System Center Configuration Manager for Education Microsoft System Center Configuration Manager for Education
Microsoft System Center Configuration Manager for Education
 

Similar to AWS IoT with ESP32 and Mongoose OS

Rapid Prototyping with AWS IoT and Mongoose OS on ESP8266, ESP32, and CC3200 ...
Rapid Prototyping with AWS IoT and Mongoose OS on ESP8266, ESP32, and CC3200 ...Rapid Prototyping with AWS IoT and Mongoose OS on ESP8266, ESP32, and CC3200 ...
Rapid Prototyping with AWS IoT and Mongoose OS on ESP8266, ESP32, and CC3200 ...Amazon Web Services
 
Starting Raspberry Pi
Starting Raspberry PiStarting Raspberry Pi
Starting Raspberry PiLloydMoore
 
IDF_Eclipse_Plugin_EclipseCon2020_v2.pdf
IDF_Eclipse_Plugin_EclipseCon2020_v2.pdfIDF_Eclipse_Plugin_EclipseCon2020_v2.pdf
IDF_Eclipse_Plugin_EclipseCon2020_v2.pdfKondal Kolipaka
 
PowerShell: A Language for the Internet of Things #ATLPUG
PowerShell: A Language for the Internet of Things #ATLPUGPowerShell: A Language for the Internet of Things #ATLPUG
PowerShell: A Language for the Internet of Things #ATLPUGTaylor Riggan
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with PythonLelio Campanile
 
Open source technologies in Microsoft cloud
Open source technologies in Microsoft cloudOpen source technologies in Microsoft cloud
Open source technologies in Microsoft cloudAlexey Bokov
 
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335xMoksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335xPrabindh Sundareson
 
Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Marcus Tarquinio
 
Qiscus bot esp8266
Qiscus bot esp8266Qiscus bot esp8266
Qiscus bot esp8266Ashari Juang
 
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)Nicolas Brousse
 
Mikrotik® MPLS/VPN Lab Part 1
Mikrotik® MPLS/VPN Lab Part 1Mikrotik® MPLS/VPN Lab Part 1
Mikrotik® MPLS/VPN Lab Part 1Kaveh Khosravi
 
Joanna Rutkowska Subverting Vista Kernel
Joanna Rutkowska   Subverting Vista KernelJoanna Rutkowska   Subverting Vista Kernel
Joanna Rutkowska Subverting Vista Kernelguestf1a032
 
MIKE BY DHI SAAS - New features as of October 2014
MIKE BY DHI SAAS - New features as of October 2014MIKE BY DHI SAAS - New features as of October 2014
MIKE BY DHI SAAS - New features as of October 2014Stephen Flood
 

Similar to AWS IoT with ESP32 and Mongoose OS (20)

Rapid Prototyping with AWS IoT and Mongoose OS on ESP8266, ESP32, and CC3200 ...
Rapid Prototyping with AWS IoT and Mongoose OS on ESP8266, ESP32, and CC3200 ...Rapid Prototyping with AWS IoT and Mongoose OS on ESP8266, ESP32, and CC3200 ...
Rapid Prototyping with AWS IoT and Mongoose OS on ESP8266, ESP32, and CC3200 ...
 
Starting Raspberry Pi
Starting Raspberry PiStarting Raspberry Pi
Starting Raspberry Pi
 
IDF_Eclipse_Plugin_EclipseCon2020_v2.pdf
IDF_Eclipse_Plugin_EclipseCon2020_v2.pdfIDF_Eclipse_Plugin_EclipseCon2020_v2.pdf
IDF_Eclipse_Plugin_EclipseCon2020_v2.pdf
 
PowerShell: A Language for the Internet of Things #ATLPUG
PowerShell: A Language for the Internet of Things #ATLPUGPowerShell: A Language for the Internet of Things #ATLPUG
PowerShell: A Language for the Internet of Things #ATLPUG
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with Python
 
Open source technologies in Microsoft cloud
Open source technologies in Microsoft cloudOpen source technologies in Microsoft cloud
Open source technologies in Microsoft cloud
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335xMoksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335x
 
IOT Ecosystem
IOT EcosystemIOT Ecosystem
IOT Ecosystem
 
Esp8266 Workshop
Esp8266 WorkshopEsp8266 Workshop
Esp8266 Workshop
 
Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1
 
Qiscus bot esp8266
Qiscus bot esp8266Qiscus bot esp8266
Qiscus bot esp8266
 
IoT Workshop in Macao
IoT Workshop in MacaoIoT Workshop in Macao
IoT Workshop in Macao
 
IoT Workshop in Macao
IoT Workshop in MacaoIoT Workshop in Macao
IoT Workshop in Macao
 
Esp8266 v12
Esp8266 v12Esp8266 v12
Esp8266 v12
 
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
 
Mikrotik® MPLS/VPN Lab Part 1
Mikrotik® MPLS/VPN Lab Part 1Mikrotik® MPLS/VPN Lab Part 1
Mikrotik® MPLS/VPN Lab Part 1
 
Joanna Rutkowska Subverting Vista Kernel
Joanna Rutkowska   Subverting Vista KernelJoanna Rutkowska   Subverting Vista Kernel
Joanna Rutkowska Subverting Vista Kernel
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 
MIKE BY DHI SAAS - New features as of October 2014
MIKE BY DHI SAAS - New features as of October 2014MIKE BY DHI SAAS - New features as of October 2014
MIKE BY DHI SAAS - New features as of October 2014
 

More from Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

AWS IoT with ESP32 and Mongoose OS

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Webinars Anton Shmagin, Partner SA Wednesday, July 19th, 2017 AWS IoT with ESP32 and Mongoose OS
  • 3. Espressif Company behind popular ESP8266 and ESP32 modules • ESP32: • 240 MHz dual core Tensilica LX6 MCU (600 DMIPS) • Integrated 520 KB SRAM • Integrated 802.11BGN HT40 Wi-Fi transceiver • Integrated dual mode Bluetooth (classic and BLE) • 16 MByte flash Find out more at https://www.espressif.com Espressif and AWS are co-sponsoring this workshop
  • 4. Cesanta Mongoose OS (mongoose-os.com) • Hardware agnostic: ESP32, ESP8266, TI CC3200, STM32 and others • Secure: SSL/TLS, Microchip ATECC508A crypto-chip support, ESP32 encrypted flash support • Develop in C or JavaScript, or both • Networking: MQTT, WebSocket, COAP, HTTP/ HTTPS and other • Mongoose Embedded Web Server and Networking Library
  • 5. The power of the ESP32 X.509 Certificate Private Key
  • 6. Prerequisites • AWS CLI configured with valid credentials in the AWS account that you intend to use http://docs.aws.amazon.com/cli/latest/userguide/installing.html • ESP32 Dev board • A (good!) USB cable to connect the ESP32 board to your computer • mos – The Mongoose OS flashing tool. Download at http://www.mongoose-os.com • git clone of the Mongoose OS repository from GitHub: Ø git clone -b release https://github.com/cesanta/mongoose-os
  • 7. Let’ Get Started • Plugin in the USB cable to your laptop and the ESP32 • The LED module will blink Start Mos Console: Ø mos console You should see: Using port /dev/cu.SLAB_USBtoUART Tock uptime: 8.25607 RAM: 166700 Tick uptime: 9.25616 RAM: 166700
  • 8. Exercise #1 (publish button presses to AWS IoT) Once you clone git repo, change directory to: Ø cd mongoose-os/fw/examples/mjs_base Then execute: Ø mos build --arch esp32 Ø mos flash Ø mos wifi SSID PASSWORD Ø mos aws-iot-setup --aws-region REGION --aws-iot-policy mos-default * mos-default is demo quite permissive policy. Please use more restrictive policies in production! Change the value of highlighted values to reflect your setup LED will stop blinking
  • 9. Exercise #1 (publish button presses to AWS IoT) Start mos console: Ø mos console You should see: Using port /dev/cu.SLAB_USBtoUART Tock uptime: 8.25607 RAM: 166700 Tick uptime: 9.25616 RAM: 166700 Tock uptime: 10.2566 RAM: 166700 Published: yes topic: /devices/esp32_xxx/events message: {"free_ram":166632,"total_ram":0} I (13755) wifi: pm start, type:0
  • 10. Exercise #1 (publish button presses to AWS IoT) • Log in to your AWS IoT account and go to AWS IoT service page • Click on Test
  • 11. Exercise #1 (publish button presses to AWS IoT) • Subscribe to topic /devices/#
  • 12. Exercise #1 (publish button presses to AWS IoT) • Pressing button on your ESP32 will publish free RAM to the MQTT topic /devices/esp_XXX /devices/esp_XXX
  • 13. Exercise #2 (create AWS IoT Rule to publish to S3 bucket) • Navigate to AWS IoT ⇒ Rules • Click “Create a rule”
  • 14. Exercise #2 (create AWS IoT Rule to publish to S3 bucket) • Enter Name and Description (“Publish2S3”, “Send FreeRAM values to S3”) • Define which attributes you would like to store • Click “Add Action” and choose “Store messages in an Amazon S3 bucket”
  • 15. Exercise #2 (create AWS IoT Rule to publish to S3 bucket) • Create a new S3 bucket or use existing one (If creating use unique name) • Create a new role “iotPublish2S3” • Enter the key as shown • Click “Add action”
  • 16. Exercise #2 (create AWS IoT Rule to publish to S3 bucket) • Click “Create Rule”
  • 17. Exercise #2 (create AWS IoT Rule to publish to S3 bucket) • Press the button on ESP32 few times • Go to S3 ⇒ {your bucket} • You should see number of files similar to this picture:
  • 18. Exercise #3 (Shadow State sets LED) In the mjs_base directory, copy over the Shadow code: Ø cp ../mjs_aws_shadow/init.js fs/init.js Ø edit fs/init.js and change GPIO to: Ø // TODO: support other platforms Ø let LED_GPIO = 5; From mjs_base directory execute: Ø mos build --arch esp32 Ø mos flash Ø mos wifi SSID PASSWORD Ø mos aws-iot-setup --aws-region REGION --aws-iot-policy mos-default
  • 19. Exercise #3 (Shadow State sets LED) Start mos console: Ø mos console You should see when you press the button: [Jul 11 18:05:18.108] Click! Updated: true [Jul 11 18:05:18.120] mgos_aws_shadow_ev Update: {"state": {"desired":{"ledOn":false,"foo":2}}, "clientToken": "d7d06332"} [Jul 11 18:05:18.213] mgos_aws_shadow_ev Version: 5 -> 6 (5) [Jul 11 18:05:18.225] Event: 3 (UPDATE_ACCEPTED)[Jul 11 18:05:18.235] mgos_aws_shadow_ev Version: 6 -> 6 (7) [Jul 11 18:05:18.246] Event: 5 (UPDATE_DELTA) [Jul 11 18:05:18.252] Reported state: {}
  • 20. Exercise #3 (Shadow State sets LED) • Log in to your AWS IoT account and go to AWS IoT service page • Click on Registry • Select device
  • 21. Exercise #3 (Shadow State sets LED) • View the current shadow state
  • 22. Exercise #3 (Shadow State sets LED) • Pressing button on your ESP32 will toggle the LED and the Shadow state
  • 23. Follow up steps Go to https://mongoose-os.com/#videos Follow the examples: • Internet button • Smart heater • ECC508A crypto-element Cesanta is running a Give Away https://mongoose-os.com/awsloft
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Webinars Thank you! @awscloud @EspressifSystem @MongooseOS