You are previewing Learning IoT with Particle Photon and Electron.
O'Reilly logo
Learning IoT with Particle Photon and Electron

Book Description

Develop applications on one of the most popular platforms for IoT using Particle Photon and Electron with this fast-paced guide

About This Book

  • Get an introduction to IoT architecture, command-line build tools and applications of IoT devices and sensors

  • Design and develop connected IoT applications using Particle Photon and Electron in a step-by-step manner, gaining an entry point into the field of IoT

  • Get tips on troubleshooting IoT applications

  • Who This Book Is For

    This book is for developers, IoT enthusiasts and hobbyists who want to enhance their knowledge of IoT machine-to-machine architecture using Particle Photon and Electron, and implement cloud-based IoT projects.

    What You Will Learn

  • Setup the Particle Photon and Electron on the cloud using the command-line tools

  • Build and deploy applications on the Photon and Electron using the Web-based IDE

  • Setup a local cloud server to interact with Particle Photon and Electron

  • Connect various components and sensors to Particle Photon and Electron

  • Tinker with the existing firmware and deploy a custom firmware on the Photon and Electron

  • Setup communication between two or more Particle Photon and Electron

  • Debug and troubleshoot Particle Photon and Electron projects

  • Use webhooks to communicate with various third-party server applications

  • In Detail

    IoT is basically the network of physical devices, vehicles, buildings and other items—embedded with electronics, software, sensors, actuators, and network connectivity that enable these objects to collect and exchange data.. The number of connected devices is growing rapidly and will continue to do so over years to come. By 2020, there will be more than 20 billion connected devices and the ability to program such devices will be in high demand. Particle provides prototyping boards for IoT that are easy to program and deploy. Most importantly, the boards provided by Particle can be connected to the Internet very easily as they include Wi-Fi or a GSM module.

    Starting with the basics of programming Particle Photon and Electron, this book will take you through setting up your local servers and running custom firmware, to using the Photon and Electron to program autonomous cars. This book also covers in brief a basic architecture and design of IoT applications. It gives you an overview of the IoT stack. You will also get information on how to debug and troubleshoot Particle Photon and Electron and set up your own debugging framework for any IoT board. Finally, you’ll tinker with the firmware of the Photon and Electron by modifying the existing firmware and deploying them to your boards.

    By the end of this book, you should have a fairly good understanding of the IoT ecosystem and you should be able to build standalone projects using your own local server or the Particle Cloud Server.

    Style and approach

    This project-based guide contains easy-to-follow steps to program Particle Photon and Electron. You will learn to build connected applications with the help of projects of increasing complexity, and with each project, a new concept in IoT is taught.

    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 If you purchased this book elsewhere, you can visit and register to have the code file.

    Table of Contents

    1. Learning IoT with Particle Photon and Electron
      1. Learning IoT with Particle Photon and Electron
      2. Credits
      3. About the Authors
        1. eBooks, discount offers, and more
          1. Why subscribe?
      5. 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 color images of this book
          2. Errata
          3. Piracy
          4. Questions
      6. 1. Introducing IoT with Particle Photon and Electron
        1. Evolution of the IoT
          1. Why the IoT has become a household word now
        2. Hardware and software in the IoT ecosystem
          1. Essential terminology
          2. Network protocols
        3. Market survey of IoT development boards and cloud services
          1. IoT development boards
          2. Cloud services (PaaS, BaaS, M2M)
        4. What is Particle?
          1. The journey of Particle
          2. Why Particle?
          3. What does Particle offer?
        5. Photon, Electron, and Core
          1. Spark Core
          2. Particle Photon
          3. Particle Electron
          4. Comparison
        6. Summary
      7. 2. Fire Up Your Kit
        1. Essentials of FreeRTOS and hardware resources
        2. Flow diagram for the Twitter project
        3. Getting the Photon online
          1. Setting up the Photon or Core
          2. Software and hardware requirements
          3. Software setup
          4. Connecting Particle Photon or Core
          5. The Web IDE
        4. Twitter and e-mail interaction project
          1. Setting up a Twitter developer account
          2. Sending web requests using Particle webhooks
          3. Creating a webhook
          4. Listing and deleting webhooks
          5. Putting it all together
          6. Setting up the Twitter and e-mail webhook
          7. How to sense motion?
          8. Sensing button presses - programming the buttons
          9. Tweets and e-mail
        5. Troubleshooting
        6. Summary
      8. 3. P2P and Local Server
        1. Client-server versus P2P networks
          1. Traditional client-server architecture
          2. Peer-to-peer network architecture
          3. Client-server versus P2P 
          4. Advantages and disadvantages of P2P networking
        2. Setting up a P2P network for Particle devices
          1. Flash the VoodooSpark firmware
          2. Connect the Particle board with VoodooSpark
          3. Controlling your Particle board using the keyboard
        3. Local server setup
          1. Advantages and disadvantages of Particle local server
          2. Installing Particle server on a local machine
          3. Configuring the local server
        4. Alternate protocols for IoT
          1. MQTT
          2. CoAP
        5. Summary
      9. 4. Connecting the Sensors
        1. Overview of the project
        2. Hardware components and setup
          1. RFID reader module RC522-RFID and RFID tags
            1. PIR motion sensor
            2. Data flow diagrams
        3. Communication between the Photons
          1. Sample code
          2. Photon with the RFID reader
          3. Photon with the motion sensor
        4. Data storage on the cloud
        5. Cloud data analysis and SMS notification
        6. Troubleshooting
        7. Summary
      10. 5. Of Cars and Controllers
        1. Building the model car - hardware components
          1. Wheels
          2. L293D motor driver
          3. 65 RPM DC Right Angled motor
          4. Chassis
          5. Power supply and Li-Po battery
          6. Breadboard and jumper wires
        2. Building the model car - prerequisites
        3. Putting it all together and controlling the car
          1. The code
          2. Running the program and controlling the car
        4. Moving the car with gestures
          1. How it works
          2. The code
        5. Programming the car with the Electron
          1. Putting it all together (again)
          2. The code
        6. Troubleshooting
        7. Summary
      11. 6. Hacking the Firmware
        1. What is firmware?
          1. A bit of history
        2. Obtaining and flashing firmware
          1. Obtaining firmware
            1. Obtaining firmware by direct download
            2. Obtaining firmware by building from source
              1. ARM GCC
              2. Make
              3. Git
              4. Getting the firmware source code
              5. Compiling the code
          2. Burning firmware onto the device
            1. Burning firmware using the OTA method
            2. Burning firmware using Particle-CLI
            3. Burning firmware using the DFU-Util method
              1. Installing DFU-Util
              2. Flashing firmware
        3. Custom firmware
        4. Summary