Book Image

Learning IoT with Particle Photon and Electron

By : Rashid Khan, Kajari Ghoshdastidar, Ajith Vasudevan
Book Image

Learning IoT with Particle Photon and Electron

By: Rashid Khan, Kajari Ghoshdastidar, Ajith Vasudevan

Overview of this book

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.
Table of Contents (11 chapters)

Hardware and software in the IoT ecosystem


Advancement in technology and affordability has made acquisition and usage of IoT devices very simple. However, in order to decide which IoT package (boards, accessories, sensors, and software) to choose for a particular application, and actually building projects, it is essential to have knowledge of IoT terminology, hardware, and software. In this section, we will introduce you to the essential terminology used when dealing with the IoT. This will also help you to understand and appreciate the features of the Particle IoT products—Core, Photon, and Electron—explained in detail later in the chapter.

Essential terminology

Let's learn about a few terms that we're going to be hearing all throughout this book, and whenever we work with IoT hardware and software components:

Term

Definition

IoT Development Board

A development board is essentially a programmable circuit board which wraps an IoT device. The IoT device's processor/microcontroller, memory, communications ports, input-output pins, sensors, Wi-Fi module, and so on are exposed by the development board, in a convenient way, to the user. A board manufacturer usually provides an IDE with it to write and deploy code to the physical board. A development board with the IDE enables rapid prototyping of IoT projects.

Microcontroller

A microcontroller is a highly compact single Integrated Circuit (IC) with a processor and limited Random Access Memory (RAM) and Read Only Memory (ROM) embedded in it with programmable peripherals. Microcontrollers are computers on a single chip. Because of its limited memory and architecture constraints, usually only one specific program is deployable and runnable on a microcontroller at one time. Preprogrammed microcontrollers are used in electrical machinery such as washing machines, dish-washers, microwave, and so on.

Microprocessor

A microprocessor is a single integrated chip which in itself is a Central Processing Unit (CPU). The microprocessor has separate RAM and ROM modules, and digital inputs and outputs. The Microprocessor CPU is usually more powerful than that of a microcontroller, and there is provision to add larger amounts of memory externally. This makes microprocessors suitable for general-purpose programming, and are used in desktop computers, laptops, and the like.

Flash Memory

Flash memory is an electronic non-volatile storage device, for example, USB pen-drives, memory cards, and so on. Data in flash memory can be erased and rewritten. Unlike RAM, access speed is lower for flash memories, and also unlike RAM, the data stored in flash memory is not erased when power is switched off. Flash memories are generally used as reusable extra storage.

RTOS

As the name suggests, real-time operating system (RTOS) responds to events in real time. This means, as soon as an event occurs, a response is guaranteed within an acceptable and calculable amount of time. RTOS can be hard, firm, or soft depending on the amount of flexibility allowed in missing a task deadline. RTOS is essential in embedded systems, where real-time responses are necessary.

M2M

Machine-to-Machine (M2M) communication encompasses communication between two or more machines (devices, computers, sensors, and so on) over a network (wireless/wired). Basically, it's a variant of the IoT, where things are machines.

Cloud Technology

Cloud refers to computing resources available for use over a network (usually, the Internet). An end user can use such a resource on demand without having to install anything more than a lightweight client in the local machine. The major resources relevant to IoT include data storage, data analytics, data streaming, and communication with other devices.

mBaaS

Mobile Backend as a Service (mBaaS) is an infrastructure that provides cloud storage, data streaming, push notifications, and other related services for mobile application developers (web, native, IoT app development). The services are exposed via web-based APIs. BaaS is usually provided as a pay-per-use service.

GPIO

General Purpose Input Output (GPIO) are electrical terminals or pins exposed from ICs and IoT devices/boards that can be used to either send a signal to the device from the outside (input mode), or get a signal out from the inside of the device (output mode). Input or Output mode can be configured by the user at runtime.

Module

Unit of electronics, sometimes a single IC and at other times a group of components that may include ICs, providing a logical function to the device/board. For example, a Wi-Fi module provides Wi-Fi functionality to a board. Other examples are Bluetooth, Ethernet, and USB.

Port

An electrical or radio frequency-based interface available on a board through which external components can communicate with the board. For example, HDMI, USB, Ethernet, 3.5mm jack, and UART (https://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter).

Table 1: Terminology

Network protocols

Connected smart devices need to communicate with each other and exchange large volumes of messages between themselves and the cloud. To ensure near real-time response, smart bandwidth usage, and energy savings on the resource-constrained IoT devices, new protocols have been added to the traditional seven-layer network model (OSI model:https://en.wikipedia.org/wiki/OSI_model). The following table shows the major OSI network protocols and the IoT network protocols suitable for various smart, connected devices.

Layer

Examples of traditional network protocols (OSI)

Examples of IoT network protocols

Application,

Presentation,

Session

HTTP, FTP, SMTP, TLS, RPC, JSON, CSS, GIF, XML

CoAP, MQTT, DDS, M2M service layer

Transport

TCP, UDP

UDP, DTLS

Network

ICMP, IPsec, IPv4, IPv6

6LoWPAN, RPL (Zigbee)

Data Link

IEEE 802.2, L2TP, LLDP, MAC, PPP

IEEE 802.15.4, BLE4.0, RFID, NFC, Cellular

Physical

DSL, Ethernet physical layer, RS-232, any physical transmission medium (for example, Cables)

Wires, sensor drivers to read from sensor devices

Table 2: Layerwise Network Protocols - OSI versus IoT