O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Practical Internet of Things with JavaScript

Book Description

End to end solutions for IoT enthusiasts and web developers

About 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 For

This 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 Detail

In 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 Approach

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

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. The World of IoT
    1. The world of IoT
      1. What is IoT?
      2. A bit of history
      3. IoT use cases
    2. Technology overview
    3. Product engineering
    4. Summary
  3. IoTFW.js - I
    1. Designing a reference architecture
      1. Architecture
        1. Smart device
        2. Gateway
        3. MQTTS broker
        4. API engine
        5. MongoDB
        6. Web app
        7. Mobile app
        8. Desktop app
      2. Data flow
        1. Smart device to the apps
        2. App to the smart device
    2. Building the reference architecture
      1. Installing Node.js on the server
      2. Installing nodemon
      3. MongoDB
        1. Local installation
        2. Using mLab
      4. MQTTS broker - Mosca
      5. API engine - Node.js and Express
        1. Authorization
        2. MQTT client
        3. API engine testing
      6. Communication between broker and API engine
      7. Raspberry Pi software
        1. Setting up Raspberry Pi
        2. Raspberry Pi MQTTS client
      8. Communication between the broker and the Raspberry Pi
        1. Troubleshooting
      9. Communication between the Raspberry Pi, the broker and the API engine
      10. Web app
        1. Setting up the app
        2. Project structure
        3. App module
        4. Web app services
        5. Web app components
        6. Launching the app
    3. Summary
  4. IoTFW.js - II
    1. Updating the API engine
    2. Integrating web app and API engine
    3. Testing an end-to-end flow using DHT11 and LED
      1. Setting up and updating the Raspberry Pi
      2. Updating the API engine
      3. Updating the web app
    4. Building the desktop app and implementing an end-to-end flow
    5. Building the mobile app and implementing an end-to-end flow
    6. Troubleshooting
    7. Summary
  5. Smart Agriculture
    1. Agriculture and IoT
    2. Designing a smart weather station
    3. Setting up Raspberry Pi 3
      1. Raspberry Pi and MCP3208
      2. Moisture sensor and MCP3208
      3. Raspberry Pi and DHT11
    4. Setting up the API engine
    5. Setting up the web app
    6. Setting up the desktop app
    7. Setting up the mobile app
    8. Summary
  6. Smart Agriculture and Voice AI
    1. Voice AI
      1. Test drive
    2. Building a smart socket
      1. Setting up relay with Raspberry Pi
      2. Managing relay in an API engine
      3. Updating the web app template
      4. Updating the desktop app
      5. Updating the mobile app template
    3. Developing Alexa skill
      1. Creating skill
      2. Training the voice model
      3. ngrok the API engine
      4. Defining the lambda function
      5. Deploying and testing
    4. Summary
  7. Smart Wearable
    1. IoT and healthcare
    2. Smart wearable
      1. Setting up smart wearable
      2. Updating the API engine
      3. Updating the web app
      4. Updating a desktop app
      5. Updating the mobile app template
    3. Summary
  8. Smart Wearable and IFTTT
    1. IFTTT and IoT
    2. Fall detection
    3. Updating Raspberry Pi
    4. Building the IFTTT rules engine
    5. Updating the web app
    6. Updating the desktop app
    7. Updating the mobile app
    8. Summary
  9. Raspberry Pi Image Streaming
    1. MJPEG
    2. Setting up Raspberry Pi
      1. Setting up the camera
      2. Testing the camera
      3. Developing the logic
    3. Updating the API engine
    4. Updating the web app
    5. Updating the desktop app
    6. Updating the mobile app
    7. Motion-based video capture
      1. Updating the Raspberry Pi
      2. Testing the code
    8. Summary
  10. Smart Surveillance
    1. AWS Rekognition
    2. Setting up smart surveillance
      1. Setting up AWS credentials
      2. Seeding the authorized faces
      3. Testing the seed
    3. Deploying to Raspberry Pi
    4. Summary