FREE E-BOOK Practical Internet of Things with JavaScript Build standalone exciting IoT projects with Raspberry Pi 3 and JavaScript

Practical Internet of Things with JavaScript Build standalone exciting IoT projects with Raspberry Pi 3 and JavaScript

FREE E-BOOK Practical Internet of Things with JavaScript: Build standalone exciting IoT projects with Raspberry Pi 3 and JavaScript
FREE E-BOOK Practical Internet of Things with JavaScript: Build standalone exciting IoT projects with Raspberry Pi 3 and JavaScript

Author (s): Arvind Ravulavaru

Publisher: Packt Publishing, Year: 2017


Comprehensive solutions for Internet of Things lovers and web developers

Feature guides
Take advantage of the Internet of Things capabilities with a mix of Raspberry Pi 3 and JavaScript (ES5 / ES6)
Develop a health monitor along with some cool projects like Smart Agriculture & Raspberry Pi 3.
A practical book that will help you create mobile / web / desktop applications explaining how to manage data from sensors and actuators and monitor them in real time.

Explanation of the book

In this world of technology upgrades, the Internet of Things is currently leading its promise to make the world a smarter and more efficient place.
This book will show you how to create simple IoT solutions that will help you understand how this technology works. Not only will we explore the suite of IoT solutions, but we'll also see how to do it with the world's worst programming language - JavaScript. Using Raspberry Pi 3 and Javascript (ES5 / ES6) as the basis for building all projects, you will begin to become familiar with the basics of IoT and then create a standard framework for developing all the applications covered in this book. You will then proceed to the construction of a meteorological station with temperature, humidity and humidity sensors, as well as Alexa integration. Moreover, you will build a smart wearable device to understand the concept of falling detection. You will then expand it using the "If This Then That" rule (IFTTT) to send an email when a fall is detected. Finally, you'll work with the Raspberry Pi 3 camera module and monitor with a little face detection using the Amazon Rekognition platform.
At the end of the book, you will not only be able to create standalone standalone IoT applications but also learn how you can expand your projects to another level.

What will you learn?

Integrate sensors and actuators with the cloud and control them for your smart weather station.
Upgrade your Amazon Alexa with your IoT solution
Define custom rules and perform tasks in specific data events using IFTTT
Build simple monitoring solutions with Amazon Recognition & Raspberry Pi 3
Design a fall detection system and build a notification system for it.
Use Amazon Rekognition to discover face and face recognition in your Surveillance project

For whom is this book

This book is aimed at IoT enthusiasts and web developers who want to create IoT-based applications using Raspberry Pi, Arduino, and JavaScript. Some knowledge of electronics and familiarity with programming concepts is expected (JavaScript - ES5 / ES6).

Table of Contents

Preface 1

Chapter 1: The World of IoT 7

The world of IoT 7

What is IoT? 8

A bit of history 9

IoT use cases 10

Technology overview 11

Product engineering 12

Summary 12

Chapter 2: IoTFW.js - I 13

Designing a reference architecture 13

Architecture 14

Smart device 14

Gateway 16

MQTTS broker 16

API engine 16

MongoDB 17

Web app 17

Mobile app 17

Desktop app 17

Data flow 18

Smart device to the apps 18

App to the smart device 19

Building the reference architecture 19

Installing Node.js on the server 20

Installing nodemon 20

MongoDB 20

Local installation 20

Using mLab 22

MQTTS broker - Mosca 25

API engine - Node.js and Express 28

Authorization 30

MQTT client 32

API engine testing 33

Communication between broker and API engine 36

Raspberry Pi software 39

Setting up Raspberry Pi 39

Raspberry Pi MQTTS client 40

Communication between the broker and the Raspberry Pi 42

Troubleshooting 43

Communication between the Raspberry Pi, the broker and the API

engine 43

Web app 48

Setting up the app 48

Project structure 49

App module 51

Web app services 53

Web app components 54

Launching the app 55

Summary 58

Chapter 3: IoTFW.js - II 59

Updating the API engine 59

Integrating web app and API engine 68

Testing an end-to-end flow using DHT11 and LED 70

Setting up and updating the Raspberry Pi 71

Updating the API engine 76

Updating the web app 79

Building the desktop app and implementing an end-to-end flow 86

Building the mobile app and implementing an end-to-end flow 94

Troubleshooting 104

Summary 104

Chapter 4: Smart Agriculture 105

Agriculture and IoT 105

Designing a smart weather station 106

Setting up Raspberry Pi 3 108

Raspberry Pi and MCP3208 109

Moisture sensor and MCP3208 109

Raspberry Pi and DHT11 109

Setting up the API engine 120

Setting up the web app 123

Setting up the desktop app 129

Setting up the mobile app 131

Summary 136

Chapter 5: Smart Agriculture and Voice AI 137

Voice AI 138

Test drive 140

Building a smart socket 140

Setting up relay with Raspberry Pi 141

Managing relay in an API engine 148

Updating the web app template 150

Updating the desktop app 157

Updating the mobile app template 160

Developing Alexa skill 165

Creating skill 166

Training the voice model 168

ngrok the API engine 174

Defining the lambda function 176

Deploying and testing 187

Summary 189

Chapter 6: Smart Wearable 190

IoT and healthcare 190

Smart wearable 191

Setting up smart wearable 192

Updating the API engine 199

Updating the web app 201

Updating a desktop app 207

Updating the mobile app template 209

Summary 213

Chapter 7: Smart Wearable and IFTTT 214

IFTTT and IoT 214

Fall detection 215

Updating Raspberry Pi 217

Building the IFTTT rules engine 224

Updating the web app 228

Updating the desktop app 230

Updating the mobile app 233

Summary 236

Chapter 8: Raspberry Pi Image Streaming 237


Setting up Raspberry Pi 238

Setting up the camera 239

Testing the camera 240

Developing the logic 241

Updating the API engine 243

Updating the web app 247

Updating the desktop app 251

Updating the mobile app 254

Motion-based video capture 257

Updating the Raspberry Pi 257

Testing the code 261

Summary 262

Chapter 9: Smart Surveillance 263

AWS Rekognition 263

Setting up smart surveillance 264

Setting up AWS credentials 264

Seeding the authorized faces 265

Testing the seed 269

Deploying to Raspberry Pi 271

Summary 275

Index 276