Practical Internet of Things with JavaScript
eBook - ePub

Practical Internet of Things with JavaScript

Arvind Ravulavaru, vijaya kumar suda

Share book
  1. 296 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Practical Internet of Things with JavaScript

Arvind Ravulavaru, vijaya kumar suda

Book details
Book preview
Table of contents
Citations

About This Book

End to end solutions for IoT enthusiasts and web developersAbout This Book• Leverage the capability of IoT with the combination of Raspberry Pi 3 and JavaScript (ES5/ES6)• Develop a health monitoring device along with some cool projects like Smart Agriculture & Raspberry Pi 3 based surveillance.• A practical book which will help you build Mobile/Web/Desktop apps that will show how to manage and monitor data from sensors and actuators in real time.Who This Book Is ForThis book targets IoT enthusiasts and web developers who would like to build IoT-based applications with Raspberry Pi, Arduino and JavaScript. Some knowledge about electronics and familiarity with programming concepts (JavaScript - ES5/ES6) is expected.What You Will Learn• Integrate sensors and actuators with the cloud and control them for your Smart Weather Station.• Develop your very own Amazon Alexa integrating with your IoT solution• Define custom rules and execute jobs on certain data events using IFTTT• Build a simple surveillance solutions using Amazon Recognition & Raspberry Pi 3• Design a fall detection system and build a notification system for it.• Use Amazon Rekognition for face detection and face recognition in your Surveillance project In DetailIn this world of technology upgrades, IoT is currently leading with its promise to make the world a more smarter and efficient place.This book will show you how to build simple IoT solutions that will help you to understand how this technology works. We would not only explore the IoT solution stack, but we will also see how to do it with the world's most misunderstood programming language - JavaScript. Using Raspberry Pi 3 and JavaScript (ES5/ES6) as the base to build all the projects, you will begin with learning about the fundamentals of IoT and then build a standard framework for developing all the applications covered in this book. You will then move on to build a weather station with temperature, humidity and moisture sensors and further integrate Alexa with it. Further, you will build a smart wearable for understanding the concept of fall detection. You will then extend it with the 'If This Then That' (IFTTT) rules engine to send an email on fall detection. Finally, you will be working with the Raspberry Pi 3 camera module and surveillance with a bit of facial detection using Amazon Rekognition platform.At the end of the book, you will not only be able to build standalone exciting IoT applications but also learn how you can extend your projects to another level.Style and ApproachThis book will follow a project based approach where each chapter will teach the readers to build a standalone project. It will not only guide you to build exciting projects but will also teach you to extend your project to another level.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Practical Internet of Things with JavaScript an online PDF/ePUB?
Yes, you can access Practical Internet of Things with JavaScript by Arvind Ravulavaru, vijaya kumar suda in PDF and/or ePUB format, as well as other popular books in Informatik & Hardware. We have over one million books available in our catalogue for you to explore.

Information

Year
2017
ISBN
9781788295598
Edition
1
Subtopic
Hardware

IoTFW.js - I

In this chapter and Chapter 3, IoTFW.js - II, we are going to develop a reference architecture for building various IoT solutions. The reference architecture or the IoT framework will be serving as a base for our future IoT solutions that we are going to be working on in this book. We will be calling this reference architecture or framework as IoTFW.js. We will be working on the following topics to bring IoTFW.js to life:
  • Designing an IoTFW.js architecture
  • Developing a Node.js based server-side layer
  • Developing an Angular 4 based web app
  • Developing an Ionic 3 based mobile app
  • Developing an Angular 4 and Electron.js desktop app
  • Setting up and installing the required dependencies on a Raspberry Pi 3
  • Integrating all the pieces
We are going to cover some of the previous topics in this chapter and some in Chapter 3, IoTFW.js - II.

Designing a reference architecture

As we have seen in Chapter 1, The World of IoT, all the examples we are going to work on have a common setup. That would be the hardware, firmware (software running on the hardware), broker, API engine and the user apps.
We will be expanding on the relevant pieces of framework as we come across it.
As and when we need to, we will be expanding on the hardware, or mobile app, or the API engine.
With this reference architecture, we are going to establish a pipeline between the devices present in the real world to the cloud in the virtual world. In other words, IoT is a last mile solution between devices and the internet.

Architecture

A simple reference architecture with Raspberry Pi, Wi-Fi gateway, the cloud engine, and the user interface apps stitched together would look as shown in the following diagram:
At a very high level, we have smart devices on the left-hand side and the user devices on the right-hand side. All of the communication between them happens through the cloud.
Following is a description of each key entity in the previous architecture. We are going to start from the left-hand side and move towards the right.

Smart device

Smart devices are hardware entities that consist of a sensor, or actuator, or both, any micro controller or micro processor, in our case, a Raspberry pi 3.
A sensor is an electronic component that can sense or measure a physical property and relay it back to a microcontroller or a microprocessor. The data relayed back can be periodic or event-driven; event-driven as in when there is change in data only. A temperature sensor such as an LM35 or DHT11 is an example of a sensor.
An actuator is also an electro-mechanical component that can trigger actions in the real world. Generally, the actuators do not act by themselves. A microcontroller, a microprocessor, or an electronic logic sends signals to the actuator. An example of an actuator is a mechanical relay.
The micro-processor we were referring would be a Raspberry Pi 3 for this book.
The Raspberry Pi 3 is a single-board computer, designed and developed by the Raspberry Pi foundation. The Raspberry Pi 3 is the third-generation Raspberry Pi.
In this book, we are going to use a Raspberry Pi 3 model B for all the examples. Some of the specifications of the Raspberry Pi 3 model B are as follows:
Feature
Specification
Generation
3
Release date
February 2016
Architecture
ARMv8-A (64/32-bit)
System on a Chip (SoC)
Broadcom BCM2837
CPU
1.2 GHz 64-bit quad-core ARM Cortex-A53
Memory (SDRAM)
1 GB (shared with GPU)
USB 2.0 ports
4 (via the on-board 5-port USB hub)
On-board network
10/100 Mbit/s Ethernet, 802.11n wireless, Bluetooth 4.1
Low-level peripherals
17× GPIO plus the same specific functions, and HAT ID bus
Power ratings
300 mA (1.5 W) average when idle, 1.34 A (6.7 W) maximum under stress (monitor, keyboard, mouse, and Wi-Fi connected)
Power source
5 V via MicroUSB or GPIO header
For more information on the specifications, please refer to the specifications of Raspberry Pi: https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications.

Gateway

The next piece in our architecture is the Wi-Fi router. A common household Wi-Fi router will act as a gateway for us. As we have seen in Chapter 1, The World of IoT, in the Clustered devices versus standalone devices section, we are following the approach of standalone devices, where each device is self-sufficient and has a radio of its own to communicate with the outside world. All the projects we are going to build consist of a Raspberry Pi 3, which has a microprocessor as well as the radio to interface with the sensors, and actuators with the internet.

MQTTS broker

The next important piece in our reference framework is the secure communication channel between the device and the cloud. We are going to use MQTT as our communication channel. MQTT is described in the following quote from http://mqtt.org/faq:
MQTT stands for MQ Telemetry Transport. It is a publish/subscribe, extremely simple and lightweight messaging protocol, designed for constrained devices and low-bandwidth, high-latency or unreliable networks. The design principles are to minimise network bandwidth and device resource requirements whilst also attempting to ensure reliability and some degree of assurance of delivery.
We are going to use the MQTT over SSL or MQTTS. In our architecture, we are going to use Mosca (http://www.mosca.io/) as our MQTTS broker. Mosca is a Node.js MQTT broker. We will talk more about Mosca when we start working with it.

API engine

An API engine is a web server application, written on Node.js, ...

Table of contents