Professional Documents
Culture Documents
The definition of a “Thing” in the Internet of Things varies a lot. We define a Thing as an
embedded computing device (or embedded system) that transmits and receives information over a
network.
MCUs featuring 32-bit architectures have dropped in price over the last several years, and are becoming
common in embedded systems. The greater capabilities of 32-bit MCUs present new choices for
embedded systems developers.
For 8 and 16-bit MCUs, software has often been written using a foreground/background approach (that
is, a super-loop). But with 32-bit MCUs dropping in price, a real-time operating system (RTOS) is now
the preferred option, allowing for more flexible and extensible software to run on these systems. A
complete RTOS – with a kernel, GUI, file system, USB stack, networking, and more – can fit in a
memory space of less than 1MB. With an RTOS, the software architecture of an embedded system can
be more flexible. Troubleshooting and adding new features becomes dramatically simplified. It is also
simpler to perform firmware upgrades. In summary, it just makes sense to use an RTOS with a 32-bit
processor.
6|Page
Processors for the Things
It’s commonly believed that IoT hardware should always be low-cost, so that we can flood the planet
with IoT devices (an IP address for every light bulb). But in fact, low-cost is not the solution for every
application, especially when IP networking is concerned.
First off, a TCP/IP stack is not a small piece of code. Of course, you can find open source TCP/IP stacks
that fit within 32 KB of code space, but usually this is achieved by taking liberties with the TCP/IP
standards. This can cause problems because you may need a device that can operate on the vast majority
of IP networks.
Second, TCP needs a fair number of network buffers to work efficiently, which require precious RAM.
And, if you need to use Java, then the IoT device will require an RTOS as the foundation to run the Java
virtual machine (JVM). All these elements work against the choice of a low-cost architecture for the IoT
device.
Picking an MCU
Which MCU makes a good starting point when designing an IoT device?
• For an ARM processor in the IoT device, the Cortex-M0 is perfect. For gateways, the ARM
Cortex-M3/M4 or Cortex-A are good choices because of their greater processing capabilities.
• For non-ARM processors, a good option is the Renesas RL78 or RX100 for the IoT device,
and the Renesas RX600 or RZ for the gateway.
Either way, new processors with more flash memory and more RAM appear on the market regularly, and
always at a lower cost.
7|Page
Power Conservation
Until recently, a common strategy to save power in an embedded system was to execute as quickly as
possible, and then go into sleep mode immediately. But there are now processor core architectures that
consume almost no power, although with reduced performance. This is an attractive option for a WSN
edge node design. This tradeoff of power for performance means designing transistors that operate close
to (or below) their threshold voltage.
ARM is currently working on a processor core optimized for operation close to the threshold voltage of
CMOS transistors, and at clock frequencies of the order of tens of kilohertz. ARM’s near-threshold
design is compatible with the Cortex-M0 architecture, which is good news for the software community.
Near-threshold designs are easier to achieve, as ARM can work with multiple foundries without having
to characterize the chip process. This is not the case with sub- threshold design, which would require a
custom manufacturing process, and which brings greater risk.
Programming Languages
The programming languages used in deeply embedded systems include C, C++ and sometimes Java. It
is important to note that Java always runs on top of an operating system. So, your choice is not
between C/C++ or Java; it is whether you will use C/C++ and Java.
Java is attractive for IoT devices because the number of Java developers worldwide brings tremendous
growth potential to the industry. Oracle and ARM estimate there are about 450,000 embedded software
engineers across the globe, and about nine million Java developers.
The resource requirements for a Java engine are not negligible. Oracle’s Java ME Embedded is
designed for small devices, and Oracle estimates the following system requirements:
Thing Design
When cost is not an issue, you can select a single powerful processor to run all the tasks required of
your device. However, a common engineering compromise is to use two processors in the
sensor/actuator device. One low-cost processor (8 or 16 bit) is used for the physical- world interface,
and a second 32-bit processor runs the network interface. This second processor is often placed in a
separate module, one that has already been certified for the protocol and FCC compliance.
When two processors are used, a real-time kernel is not strictly required for the sensor/actuator
processing, but is strongly recommended for the communication module.
9|Page
Gateway Design
A gateway connects two dissimilar networks so that data can flow between them. Usually this is a
connection between a proprietary network and the Internet.
For example, in home automation, different utilities companies may install a wide variety of IoT
devices in your house, each with their own gateway. These can include electricity or gas, water,
phone, Internet, cable/satellite, alarm system, medical devices, and so on. Some of these gateways
may require additional functions, such as local storage, or a user interface.
10 | P a g e
The Internet
Communication is central to the Internet of Things. Networking technologies enable IoT devices to
communicate with other devices as well as with applications and services that are running in the cloud.
The internet relies on standardized protocols to ensure that communication between heterogeneous devices
can occur securely and reliably. Standard protocols specify the rules and formats that devices use for
establishing and managing networks, as well as for transmission of data across those networks.
We often describe networks as being built up from a stack of technologies, with technologies at the
bottom of the stack, such as Bluetooth LE, relating to physically connecting devices, while technologies
further up the stack, such as IPv6, relating to logical device addressing and routing of network traffic.
Technologies at the top of the stack are used by the applications that are running on top of those layers,
for example, message queuing technologies.
In this article, I describe some widely adopted technologies and standards for IoT networking. I also
explain when you might want to choose one network protocol over another. I then discuss key
considerations and challenges that are related to networking within IoT, including range, bandwidth,
power usage, intermittent connectivity, interoperability, and security.
11 | P a g e
Networking standards and technologies
The Open Systems Interconnection (OSI) model is an ISO-standard abstract model that describes a stack
of seven protocol layers. From the top down, these layers are: application, presentation, session,
transport, network, data link and physical. TCP/IP, or the Internet Protocol suite, underpins the internet,
and it provides a simplified concrete implementation of these layers in the OSI model.
The TCP/IP model includes only four layers, merging some of the OSI model layers (see Figure 1):
• Transport Layer
The transport layer (Layer 4 in OSI) is focused on end-to-end communication and provides
features including reliability, congestion avoidance, and guaranteeing that packets will be
delivered in the same order that they were sent. UDP (User Datagram protocol) is often
adopted for IoT transport for performance reasons.
• Application Layer
The application layer (Layers 5, 6, and 7 in OSI) covers application-level messaging. HTTP/S is
an example of an application layer protocol that is widely adopted across the internet.
12 | P a g e
Although the TCP/IP and OSI models provide you with useful abstractions for discussing networking
protocols, and the specific technologies that implement each protocol, in practice, some protocols don't
fit neatly into these layered models. For example, the Transport Layer Security (TLS) protocol that
implements encryption to ensure privacy and data integrity of network traffic can be considered to
operate across OSI layers 4, 5, and 6.
Some of the networking protocols that are widely adopted within IoT and where they fit within the TCP/IP
layers are shown in Figure 2.
13 | P a g e
Many emerging and competing networking technologies are being adopted within the IoT space. Multiple
technologies are offered by different vendors or are aimed at different vertical markets like home
automation, healthcare, or industrial IoT, often provide alternative implementations of the same standard
protocols. For example, IEEE 802.15.4 describes the operation of low-rate wireless personal area networks
(LR-WPANs) and is implemented by several competing technologies including ZigBee, Z-Wave,
EnOcean, SNAP, and 6LoWPAN.
Technologies used for internet connectivity, like Ethernet, for example, can often be applied within the
IoT; however, new technologies are being developed specifically to meet the challenges of IoT. As you
look further down the stack toward physical transmission technologies, you face more challenges that
are specific to IoT devices and IoT contexts.
The structure of a network is known as its topology. The most common network topologies that are adopted
within IoT are star and mesh topologies. In a star topology, each IoT device is directly connected to a
central hub (gateway) that communicates the data from the connected devices upstream. In mesh
topologies, devices connect to other devices within range, and nodes within the network can act as simple
sensor nodes, as sensor nodes that also route traffic, or as gateway nodes. Mesh networks are more complex
than networks with star topologies, but have the advantage of being more resilient to failure because they
don't rely on a single central gateway.
• LPWAN
(Low Power Wide Area Network) is a category of technologies that are designed for low- power,
long-range wireless communication, and so they are ideal for use within large-scale deployments
of low-power IoT devices like wireless sensors. LPWAN technologies include LoRa (LongRange
physical layer protocol), Haystack, SigFox, LTE-M, and NB-IoT(Narrow- Band IoT).
• Cellular
The LPWAN NB-IoT and LTE-M standards are aimed at providing low-power, low-cost IoT
communication options using existing cellular networks. NB-IoT is the newest of these standards
and is focused on long-range communication between large numbers of primarily indoor devices.
LTE-M and NB-IoT were developed specifically for IoT, however existing cellular technologies
are also frequently adopted for long-range wireless communication.
These include 2G (GSM), which is mostly used in legacy devices, and which is currently
being phased out, as well as CDMA, 3G, and 4G.
14 | P a g e
BLE is best suited to devices that transmit low volumes of data in bursts, as the devices are
designed to sleep to save power when they are not transmitting data. Personal IoT devices
like wearable health and fitness trackers often use BLE.
• ZigBee
ZigBee also operates on 2.4GHz wireless communication spectrum, but it has a longer range than
BLE of up to 100 meters. It also has a slightly lower data rate (250 kbps maximum compared to
270 kbps for BLE) than BLE. ZigBee is a mesh network protocol, and unlike BLE, not all devices
can sleep between bursts, depending on their position in the mesh and whether they need to act as
routers or controllers within the mesh. ZigBee was designed for building and home automation
applications, like controlling lights. Another closely related technology to ZigBee is Z-Wave,
which is also based on IEEE 802.15.4 MAC. Z-Wave was also designed for home automation, and
it was a proprietary technology that was recently released as a public domain specification.
• NFC
The near field communication (NFC) protocol is used for very small range communication (up to 4
cm), such as holding an NFC card or tag next to a reader. NFC is often used for payment systems,
but it is also useful for check-in systems and smart labels in asset tracking in Industrial IoT
applications.
• RFID
RFID stands for Radio Frequency Identification. RFID tags store identifiers and data and are attached
to devices for reading by an RFID reader. The typical range of RFID is less than
a meter. RFID tags can be active, passive, or assisted passive. Passive tags are ideal for devices
without batteries, as the ID is passively read by the reader. Active tags periodically broadcast their
ID, while assisted passive tags become active when RFID reader is present. Dash7 is a
communication protocol that uses active RFID that is designed to be used within Industrial IoT
applications for secure long-range communication. Similar to NFC, a typical use case for RFID is
tracking inventory items within retail and industrial IoT applications.
• Wifi
Wifi is standard wireless networking based on IEEE 802.11a/b/g/n specifications. 802.11n offers the
highest data throughput, but at the cost of high-power consumption, so IoT devices might only use
802.11b or g for power conservation reasons. Although wifi is adopted within many prototype and
current generation IoT devices, as longer-range and lower-power solutions become more widely
available, it is likely that wifi will be superseded by these lower- power alternatives.
• Ethernet
Widely deployed for wired connectivity within local area networks, Ethernet implements the IEEE
802.3 standard. Not all IoT devices need to be wireless devices that are designed to be stationery.
For example, sensor units that are installed within a building automation system can use wired
networking technologies like Ethernet. Power line communication (PLC) is an alternative hard-
wired solution that uses existing electrical wiring instead of dedicated network cables.
15 | P a g e
Internet layer IoT network technologies
Internet layer technologies (OSI Layer 3) are concerned with identifying and routing packets of data.
Technologies that are commonly adopted for IoT that are related to this layer include IPv6, 6LoWPAN, and
RPL.
• IPv6
At the Internet Layer, devices are identified by IP addresses. IPv6 is typically used for IoT applications over
legacy IPv4 addressing. IPv4 is limited to 32-bit addresses, which only provide around 4.3 billion addresses
in total, which is less than the current number of IoT devices that are connected, while IPv6 uses 128 bits, and
so provides 2128 addresses (around
3.4 × 1038 or 340 billion billion billion billion) addresses. In practice, not all IoT devices need
public addresses. Of the tens of billions of devices that are expected to connect to the IoT over the
next few years, many will be deployed in private networks that will use private address ranges and
only communicate out to other devices or services on external networks by using gateways.
• 6LoWPAN
The IPv6 Low Power Wireless Personal Area Network (6LoWPAN) standard allows IPv6 to be used
over 802.15.4 wireless networks. 6LoWPAN is often used for wireless sensor networks, and the Thread
protocol for home automation devices also runs over 6LoWPAN.
• RPL
The Internet Layer also covers routing. IPv6 Routing Protocol for Low-Power and Lossy Networks
(RPL) is designed for routing IPv6 traffic over low-power networks like those networks implemented
over 6LoWPAN. RPL (pronounced "ripple") is designed for routing packets within constrained
networks such as wireless sensor networks, where not all devices are reachable at all times and where
there are high or unpredictable amounts of packet loss. RPL can compute the optimal path by
building up a graph of the nodes in the network based on dynamic metrics and constraints like
minimizing energy consumption or latency.
HTTP and HTTPS are ubiquitous across internet applications, which is true also within IoT, with RESTful
HTTP and HTTPS interfaces widely deployed. CoAP (Constrained Application Protocol) is like a
lightweight HTTP that is often used in combination with 6LoWPAN over UDP. Messaging protocols like
MQTT, AMQP, and XMPP are also frequently used within IoT applications:
• MQTT
Message Queue Telemetry Transport (MQTT) is a publish/subscribe-based messaging protocol
that was designed for use in low bandwidth situations, particularly for sensors and mobile devices
on unreliable networks.
• AMQP
Advanced Message Queuing Protocol (AMQP) is an open standard messaging protocol that is used for
message-oriented middleware. Most notably, AMQP is implemented by RabbitMQ.
• XMPP
The Extensible Messaging and Presence Protocol (XMPP) was originally designed for real- time
human-to-human communication including instant messaging. This protocol has been adapted for
16 | P a g e
machine-to-machine (M2M) communication to implement lightweight middleware and for routing
XML data. XMPP is primarily used with smart appliances.
Your choice of technologies at this layer will depend on the specific application requirements of
your IoT project. For example, for a budget home automation system that involves several sensors,
MQTT would be a good choice as it is great for implementing messaging on devices without much
storage or processing power because the protocol is simple and lightweight to implement.
When you consider which networking technologies to adopt within your IoT application, be mindful of the
following constraints:
• Range
• Bandwidth
• Power usage
• Intermittent connectivity
• Interoperability
• Security
Range
Networks can be described in terms of the distances over which data is typically transmitted by the IoT
devices attached to the network:
Bandwidth
Bandwidth, or the amount of data that can be transmitted in a specific period of time, limits the rate at
which data can be collected from IoT devices and transmitted upstream. Consider these factors:
Also, consider whether all of the raw data needs to be transmitted. One solution might be to capture less
data by sampling less frequently, capturing fewer variables, or performing some filtering on the device to
drop insignificant data. If you aggregate the data before you transmit it, you help to reduce the volume of
data to be transmitted, but then this process has implications on flexibility and granularity in the upstream
analysis. Aggregation and bursting is not always suitable for time-sensitive or latency-sensitive data either.
All of these techniques also increase the data processing and storage requirements for the IoT device.
Power usage
Transmitting data from a device consumes power, and transmitting data over long ranges requires more
power than over a short range. You must consider the devices that operate on a battery to conserve power to
prolong the life of the battery and reduce operating costs. To prolong the battery life, you can put the device
into sleep mode whenever it is idle. It is a good idea to model the energy consumption of the device under
different loads and different network conditions to ensure that the device's power supply and storage
capacity matches with the power that is required to transmit the necessary data by using the networking
technologies that you adopted.
Intermittent connectivity
IoT devices aren't always connected. In some cases, devices will connect periodically by design in order
to save power or bandwidth. However, sometimes an unreliable network might cause
devices to drop off due to connectivity issues. Sometimes quality of service issues, such as dealing with
interference or channel contention on a wireless network using a shared spectrum.
Interoperability
With so many different devices connecting to the IoT, interoperability can be a challenge. Adopting
18 | P a g e
standard protocols has been the traditional approach for maintaining interoperability on the internet.
However, for the IoT, standardization processes sometimes struggle to keep up with the rapid pace of
change and technologies are released based on upcoming versions of standards that are still subject to
change. In these cases, consider the ecosystem around the technologies; that is, ask these questions: Are
they widely adopted? Are they open versus proprietary? How many implementations are available?
Security
Security is always a priority, so be sure to select networking technologies that implement end-to- end
security, including authentication, encryption, and open port protection. For example, IEEE
802.15.4 includes a security model that provides security features that include access control,
message integrity, message confidentiality, and replay protection, which are implemented by
technologies based on this standard such as ZigBee.
• Authentication
Adopt secure protocols to support authentication at the device level, for gateways, users, and
applications and services. For example, consider adopting the X.509 standard for device
authentication.
• Encryption
If you are using wifi, you can use Wireless Protected Access 2 (WPA2) for wireless network
encryption or you might adopt a Private Pre-Shared Key (PPSK) approach. To ensure privacy
and data integrity for communication between applications, be sure to adopt TLS
or Datagram Transport-Layer Security (DTLS), which is based on TLS, but adapted for
unreliable connections that run over UDP. TLS encrypts application data and ensures its
integrity.
• Port protection
Port protection ensures that only the ports that are required for communication with the gateway or
upstream applications or services remain open to external connections. All other ports should be
disabled or protected by firewalls. For example, device ports might be
exposed when exploiting Universal Plug and Play (UPnP) vulnerabilities, so UPnP should be
disabled on the router.
Conclusion
Selecting the IoT networking technologies to adopt involves compromise, across the board. Your choice of
networking technologies will have an impact on the design of your IoT devices, and there are dependencies
among most of the considerations that I discussed in this article. For example, network range, data rate, and
power consumption are all directly related. If you increase the network range or rate and volume of data that
is transmitted, your IoT devices will almost certainly require additional power to transmit the data under
those conditions
19 | P a g e
Physical Layer Data Protocols
IoT mainly consists of Sensors and Actuators, People, Communication protocols, Cloud and Analytics. So,
in this section, we’ll discuss different Communication protocols used in IoT.
We will now start our discussion by answering three basic questions: What is the protocol? What do you
mean by communication? And what are the protocols associated with the communication?
• Protocol: A set of rules and regulations.
• Communication: Exchange of information from one system to another system with a medium.
• Communication Protocol: A set of rules and regulations that allow two electronic devices to connect
to exchange the data with one another.
Introduction:
1. Inter System Protocol: The inter system protocol using to communicate the two different devices. Like
communication between computer to microcontroller kit. The communication is done through a inter bus
system.
• UART Protocol
• USART Protocol
• USB Protocol
2. Intra System Protocol: The Intra system protocol is used to communicate the two devices within the
circuit board. While using this intra system protocols, without going to intra system protocols we will
expand the peripherals of the microcontroller. The circuit complexity and power consumption will be
increases by using intra system protocol. Using intra system protocols circuit complexity and power
consumption, cost is decrease and it is very secure to accessing the data.
• I2C Protocol
• SPI Protocol
• CAN Protocol
UART Protocol:
UART stands for universal asynchronous transmitter and receiver. UART Protocols is a serial
communication with two wired protocol. The data cable signal lines are labelled as Rx and Tx. Serial
communication is commonly used for transmitting and receiving the signal. It is transfer and receives the
data serially bit by bit without class pulses. The UART take bytes of data and send the individual bits in
sequential manner. UART is a half-duplex protocol. Half duplex means transferring and receiving the data
but not at a same time. Most of the controllers have hardware UART on board. It uses a single data line for
transmitting and receiving the data. It has one start bit, 8-bit data and one stop bit mean the 8-bit data
transfer one’s signal is high to low.
Ex: Emails, SMS, Walkie-talkie.
USART stands for universal synchronous and asynchronous transmitter and receiver. It is a serial
communication of two wire protocol. The data cable signal lines are labelled as Rx and TX. This protocol is
used to transmitting and receiving the data byte by byte along with the clock pulses. It is a full-duplex
protocol means transmitting and receiving data simultaneously to different board rates. Different devices
communicate with microcontroller to this protocol.
Ex: -Telecommunications.
USB Protocol:
USB stands for universal serial bus. Again, it is a serial communication of two wire protocol. The data cable
signal lines are labelled D+ and D-. This protocol is used to communicate with the system peripherals. USB
protocol is used to send and receive the data serially to the host and peripheral devices. USB communication
requires a driver software which is based on the functionality of the system. USB device can transfer data on
the bus without any request on the host computer. Now a day’s most of the devices are using this technique
for communicating with USB protocol. Like computer to communicate with ARM controller using USB.
USB transfer the data different modes. first one is slow speed mode 10kbps to 100 kbps; second one is full
speed mode 500kbps to 10mbps, high speed mode 25mbps to 400 mbps USB maximum cable length of 4
meters.
22 | P a g e
Differences Between the Inter System Protocols:
I2C Protocol:
I2C stands for inter integrated circuit. I2C requires only two wires connecting all peripherals to
microcontroller.I2C requires two wires SDA (serial data line) and SCL (serial clock line) to carry
information between devices. It is a master to slave communication protocol. Each slave has a unique
address. Master device sends the address of the target slave device and read/write flag. The address is
matching any slave device that device is ON, remaining slave devices are disable mode. Once the address is
match communication proceed between master and that slave device and transmitting and receiving the data.
The transmitter sends 8-bit data, the receiver replies 1-bit of acknowledgement. When the communication is
completed master issues the stop condition. The I2C bus was developed by Philips Semiconductors. Its
original purpose is providing an easy way to connect CPU to peripherals chips. Peripheral devices in
embedded systems are often connected to the microcontroller as memory mapped devices. I2C requires only
two wires for connecting all the peripherals to the microcontroller. These active wires, called SDA and SCL,
are both bidirectional. SDA line is a serial data line and SCA line is a serial clock line.
23 | P a g e
I2C Pull-up Resistors:
Why given the pull-up resisters in I2C SCL and SDA line?
SPI Protocol:
SPI stands for serial peripheral interface. It is one of the serial communication protocols developed by
Motorola. Sometimes SPI protocol is also called a 4-wire protocol. It requires four wires MOSI, MISO, SS,
and SCLK.SPI protocol used to communicate the master and slave devices. The master first configures the
clock using a frequency. The master then selects the particular slave device for communication by pulling
the chip select button. That particular device is selected and starts the communication between master and
that particular slave. The master selects only one slave at a time. It is full duplex communication protocol.
Not limited to 8-bit words in the case of bit transferring.
CAN Protocol:
CAN stands for controller area network. It is a serial communication protocol. It requires two wires CAN
High (H+) and CAN low (H-). It was developed by the Robert bosh company in 1985 for in vehicle
networks. It is based on a message-oriented transmission protocol.
24 | P a g e
Differences Between the Inter System Protocols:
The Internal system protocol is used to communicate between two devices within the circuit board. This
category of protocols is majorly used for the peripherals present inside micro-controllers and devices
similar to it.
• The Serial Peripheral Interface bus (SPI) is a synchronous serial communication specifically used for
short distance communication, primarily in embedded systems. Sometimes SPI protocol is also called a 4-
wire protocol. It requires four wires MOSI, MISO, SS, and SCLK. SPI protocol used to communicate the
master and slave devices.
• Applications for this type of communications are Secure Digital cards and liquid crystal displays.
25 | P a g e
The master selects only one slave at a time. It is a full-duplex communication protocol.
There are two wire lines: Serial Data (SDA) and Serial Clock (SCL).
Advantages and Disadvantages of I2C:
Advantages:
• Occasional communication of devices is easy to implement
• I2C requires only two wires connecting all peripherals to a microcontroller
• Addressing scheme allows multiple devices
• Interconnection without additional wires
Disadvantages:
• Hardware and especially software implementation are more complicated than the SPI Half-duplex.
• Not scalable for a large number of devices.
Differences Between the Internal System Protocols:
The external system protocol is used to communicate between two different devices, like communication
happening between a computer to microcontroller kit.
27 | P a g e
For e.g. when plugging in your pen drive into the computer.
or, connecting Arduino with a computer.
The protocols which are there for this communication are:
• Ethernet
• UART Protocol
• USART Protocol
Ethernet:
Ethernet is a type of connection between computers forming Local Area Networks (LAN). It also serves
as one of the main methods for connecting a computer or network to an Internet hub. Ethernet cables that
connect to a central hub or router in order to network several computers together.
A system for connecting a number of computer systems to form a local area network, with protocols to
control the passing of information and to avoid simultaneous transmission by two or more systems.
Application of Ethernet:
• Cloud Computing
• Site to Site Access
• Video Applications
• Distributed Storage Area Networks
• CCTV
• Copper cable
• Fibre optic cable
Before we going to learn the Difference between UART and USART, we would discuss it one by one
term used by UART and USART. As we all know, the full name of UART and USART is Universal
Asynchronous
28 | P a g e
Receiver Transmitter & Universal Synchronous-Asynchronous Receiver Transmitter respectively
which includes main two words called Synchronous and Asynchronous. So, these two words is the
main philosophy used in serial communication.
UART:
A Universal Asynchronous Receiver/Transmitter. It is a microcontroller peripheral that converts
incoming and outgoing bytes of data into a serial bit stream. A start bit initiates the serial bit stream and a
stop bit (or two) completes the data word. A UART also has the option of adding a parity bit to the stream
to assist in detecting if a bit error occurs during transmission. The provided figure shows a standard
example of what an engineer would expect to see from data transmitted through a UART.
UART adds start and stops bits to the data packet being transferred. These bits define the beginning and
end of the data packet to the receiving UART knows when to start reading the bits. When the receiving
UART detects a start bit, it starts to read the incoming bits at a specific frequency known as the baud
rate. Baud rate is a measure of the speed of data transfer, expressed in bits per second (bps).
Application of UART:
• Transmitting and receiving UARTs must be set for the same bit speed, character length, parity, and
stop bits for proper operation.
• Very low-cost home computers or embedded systems dispense with a UART and use the CPU to
sample the state of an input port or directly manipulate an output port for data transmission.
• Typical serial ports used with personal computers connected to modems use eight data bits.
USART
A Universal Synchronous/Asynchronous Receiver/Transmitter is
a microcontroller peripheral that converts incoming and outgoing
bytes of data into a serial bit stream.
Hmm. The definition of a USART is identical to that of a UART,
but with “synchronous” added to the term.
30 | P a g e
• Flash drives can sustain only a limited number of write and erase cycles before the drive fails.
• A drawback to the small size is that they are easily misplaced, left behind, or otherwise lost.
31 | P a g e
What is an IoT Platform?
Whether you’re new to IoT or a seasoned veteran, you’ve probably heard the term “IoT Platform” before.
After all, there were over 300 IoT platforms as of last year and this number continues to quickly grow (I’ve
heard there are now over 700). The IoT platform market is growing at a compound annual growth rate
(CAGR) of 33% and is expected to reach a $1.6 billion market size in 2021.
IoT platforms are a critical component of the IoT ecosystem, but I’ve found that for many people,
it’s not clear what an IoT platform is exactly or the differences between them.
In this post I’ll provide a simple, non- technical explanation of IoT platforms. What they are, when
businesses should use them, and the important considerations when choosing between the multitude of
options.
1. A complete IoT system needs hardware, such as sensors or devices. These sensors and
devices collect data from the environment (e.g. a moisture sensor) or perform actions in the
environment (e.g. watering crops).
2. A complete IoT system needs connectivity. The hardware needs a way to transmit all that data
to the cloud (e.g. sending moisture data) or needs a way to receive commands from the cloud
(e.g. water the crops now). For some IoT systems, there can be an intermediate step between
hardware and connecting to the cloud, such as a gateway or router.
3. A complete IoT system needs software. This software is hosted in the cloud (what’s the
cloud?) and is responsible for analysing the data it’s collecting from the sensors and making
decisions (e.g. knowing from moisture data that it just rained and then telling the irrigation
system not to turn on today).
4. Finally, a complete IoT system needs a user interface. To make all of this useful, there needs
to be a way for users to interact with the IoT system (e.g. a web app with a dashboard that shows
moisture trends and allows users to manually turn irrigation systems on or off).
IoT platforms are the support software that connects everything in an IoT system. An IoT
platform facilitates communication, data flow, device management, and the functionality of
applications.
IoT platforms exist in part 3 and, often, part 4 of what’s described above. With all the varying kinds of
hardware and the different connectivity options, there needs to be a way of making everything work
together and that’s what IoT platforms do.
• Connect hardware
• Handle different communication protocols
• Provide security and authentication for devices and users
• Collect, visualize, and analyse data
• Integrate with other web services
32 | P a g e
When Should Your Business Use an IoT Platform?
• Because IoT is a system of systems, rare is the organization that has expertise across all the
relevant domains. IoT platforms exist to help businesses overcome technical challenges without
the need to figure it all out in-house.
For example, your business might be really good at building hardware and decide that you want to make
your hardware “smart”. Instead of the expensive and time-intensive process of hiring software
developers to build everything in-house, you can instead use an IoT platform to get up and running
quickly and more cost-effectively.
However, there is a trade-off. IoT platforms that save you time may cost more in the long run depending on
how they’re priced. This is because they charge use-based and/or subscription fees that can add up over
time. But you still get the benefit of significantly lower up-front costs (no CapEx).
IoT platforms that are inexpensive up front will likely cost you time. This comes back to the same point in
bold above, the less you spend the more work you’ll have to do on your own, which takes time.
IoT Platform:
IoT (Internet of Things) is nothing but the ecosystem of physical object that can be connect to the internet
and we can access as well as control it remotely anytime anywhere.
Internet of Things platform is the support software which connect the hardware, access point and data
network to the end user application. IoT platform handle or manage the task and data visualization that
allow the user automate the environment.
IoT platform ensures the seamless integration with the different hardware by using a range of popular
communication protocols and also apply the different types of topology using SDK.
IoT platform also referred as a middleware which is act as mediator between hardware and the
application layer.
Hub Level: Hub level is the software which facilitates the connection with the cloud Hub Level is nothing
but the bridge between IP connected cloud and IP non connected cloud.
Cloud Level: The cloud is that part where the data is sent from devices and it should be formatted for
output. It is also used for remotely manage the devices and remove software updates.
33 | P a g e
image credit: Smart-Industry
IoT Security:
security is one the most important factor while selecting the IoT platform. For data security we have to
authenticate all connected devices and the application with end-to-end security mechanism. It ensures that
the organization and end users are protected from unauthorized access.
Enterprises look for the platform that features end-to-end data encryption so that data is protected. IoT
platform should deliver regular security updates and demonstrate a commitment to ensuring that consumers
fully understand their IoT security architecture.
Real-time Analytics:
when an internet of things platform features real time analytics it contextualizes as well as visualizes data
as it flows through the system. This enables organization to effectively monitors their devices, understand
the performance, usage pattern and also availability and proactively identify privacy issues and insecure
conditions. In other words, real-time analytics give the consumer the power to manage devices and ensures
both security and performance as efficiently as possible.
Horizontal Management:
Enterprises and municipalities often work with several agencies that may all be working in isolation and
only focusing on their own needs. This can create a fragmented and inefficient model for operation and
development with each vertical creating their own custom solution. A horizontal management IoT platform
allows organization to cover connectivity data collection, analytics, business application development and
service management.
34 | P a g e
Whatever We Can Do with IoT Platform:
An IoT platform plays important role for smart devices. Users can use their product with remote control and
real time monitoring function, configurable alerts or notification, pluggable cloud services and integration
with consumer’s smartphones or other devices.
IoT platform is cost optimization for companies in the industrial sector through remote monitoring of
devices and vehicles, collecting the sensor data for real time, ensuring safety and end-to end delivery
tracking.
By using IoT platform used to develop IoT infrastructure for delivering all types of the services for
customers. Among them Car service, smart building smart metering and others.
IoT platform is most essential technology for improving the customer experience in different field
like retail, healthcare , hospitality and travelling. It ensures the stress-free interaction between
customer and the company.
35 | P a g e
IoT using PaaS Cloud
36 | P a g e
What is Ubidots?
Ubidots (ubidots.com) is an IoT Application Development Platform that automates the process of IoT
application creation for enterprises and individuals to deploy any IoT solution to scale, and do so quickly.
Ubidots platform is a user-focused point-and-click IoT App builder with data analytics and cloud
function tools, dashboard visualizations, device management tools, BI events and alarm engine, and end-
user authentication/access to give end-users and operators the data they need and nothing more. With the
Ubidots platform, users collect, enhance, and deliver sensor, actuator, and beacon data that matters for
businesses and users to make data-driven decisions that improve efficiency and effectiveness.
Friendly APIs =
and Time-Series
Device
Managem Communication Architecture
ent
Protocols
End-user Application
37 | P a g e
Ubidots Basics: Devices, Variables, Dashboards, and Alerts
Once your devices, variables, and general Application is assembled, give your App some layers with
Ubidots Device Management to learn more about Ubidots internal architecture and how you can use Apps,
Organizations, and Users to efficiently connect your data with those who should be using it.
Table of Contents
1. Devices
2. Variables
3. Dashboard and Visualizations
4. Events.
1. Devices
A Ubidots' device is a virtual representation of a data-source or simply, an asset taking sensor data and
transmitting said data through a connection protocol to Ubidots' cloud.
All devices are different, but the standard setup on any device entails:
• A library that should be installed in the device's IDE. (not always required)
• Filling parameters for authentication and connection such as a TOKEN (i.e. the unique ID for
each account or user), device and variable labels (i.e. devices and variables unique identifiers in
Ubidots), Wi-Fi SSID and Password, depending on the device and the requirements.
• Making API request (i.e. a call from a device to the web server). Ubidots’ libraries spare the need to
manually make these requests. However, if you’re working with a device not currently in the list
of supported hardware, you can choose a connectivity protocol such as MQTT or HTTP and make
a request using the API accordingly.
1. Devices are created automatically in Ubidots the first time a dot is received to a user's private
TOKEN or an Organizational TOKEN.
2. Clicking the "+" icon in the top right corner of any single device's screen.
38 | P a g e
2. Variables
Once a device is created and receiving data from your hardware or another 3rd party data-source, the data
will be presented in its raw or calculated form as a variable.
Types of Variables:
– Rolling Window – corresponds to Time/loop based mathematical operations such as sum, Average,
Minimum, maximum, count etc. based on a trigger point attached to it such as in mentioned
minutes/hours/days
Note that default variables are yellow, and Derived & Rolling window Variables are green.
39 | P a g e
3. Dashboards and Visualizations
Dashboards are the human-machine interfaces where data is easily visualized. Your Ubidots account will let
you create as many dashboards as needed, containing widgets and data-visualizations to comprehend your
data at a glance.
Dashboards (static and dynamic) are user interfaces to organize and present a device's data and the
insights derived from the data. Dashboards contain widgets that display the data as charts, indicators,
controls, tables, graphs, and other size, shapes, and forms.
• Static Dashboards are used to visualize data from predetermined devices and variables. Static
dashboards display the same device and variable data at all times.
• Dynamic Dashboards utilize a primary and replica (master/slave) technology to visualize data from
different devices and variables, using a dropdown menu in the settings bar. By selecting different
devices from the settings bar, a dynamic dashboard will refresh with the underlying device and
variables populating each widget's visualization according to the device selected.
Table of Contents
40 | P a g e
A. Explaining Dynamic Dashboards
When a device is selected from the setting bar, then all variables within each widget will automatically
update to reflect the device’s variables. This is achieved because dynamic dashboard widgets are not
associated with predetermined variables; instead, they are associated with variable labels (i.e.
label=temperature).
This is very helpful enablement as it erases the need to create additional dashboard per device. Image you
have a fleet of 1,000 trucks; with static dashboards you’d have to create 1,000 dashboards. With dynamic
dashboards, you only have to create one dashboard, and then have the App's Users select the device for
which they want to see the data:
Ubidots allows you to combine static and dynamic widgets at will. Using our Truck Application
example, imagine you have a variable with the aggregated fuel consumption across all thousand trucks.
You want this variable to be displayed in every truck’s dynamic dashboard, regardless of the selected
truck. In this case you would create a static widget pointing to a preset variable.
To better understand the difference between static and dynamic, here’s a table explaining how a widget
behaves when created within a static or dynamic dashboard:
41 | P a g e
4. Events
In Ubidots, Events are messages triggered and delivered through Email, SMS, Telegrams, Slack, Voice Call
or webhook messages based on a customized design rule created in the application.
3 Event types:
You can also determine the format of alerts by choosing between emails, SMS, Telegrams or Webhook.
42 | P a g e
Deep dive to Devices in Ubidots
Learn to provision, create, and edit Devices in Ubidots IoT Application Development Platform.
Table of Contents:
1. What is a Device?
2. Device Setup and Activation
3. Creating Devices
4. Editing Devices
5. Deleting Devices
6. Reset a Device's Data
1. What is a Device?
A Device in Ubidots is a virtual representation of a data- source or simply, an asset taking in sensor data and
transmitting said data through a connection protocol to Ubidots' cloud. For billing purposes, a Device in
Ubidots is counted as a collection of 20 variables. Moving from that limit forward, a device then is counted
based on the number of variables as multiple of 20:
– 1 to 20 variables: 1 device.
– 21 to 40 variables: 2 devices.
– 41 to 60 variables: 3 devices, And so on...
All Devices are different, but the standard setup for any device entails the same characteristics when
connecting to Ubidots:
3. Creating Devices
1. Devices are created automatically in Ubidots the first time a dot is received to a user's private
TOKEN or using an Organizational TOKEN.
2. Clicking the "+" icon in the top right corner of the Device's section of your account.
3. Creating a Device Type which then creates a new device with pre-determined device
properties, appearance, and variables and automate the on-boarding of thousands of
devices.
43 | P a g e
4. Editing Devices
Devices can easily be edited directly from the User Interface. Simply click to
open the device you need to edit and then using the Device detail pane
located on the left-hand side of your Ubidots display correct any information
as needed.
6. Delete Devices
Go to and hover the device you want to delete. You will see two icons in the
bottom right: one for assigning this device to an organization, the second, a
"trashcan" icon for deleting a device. If you wish to delete the device, select
the trashcan and confirm.
44 | P a g e
7. Reset a Device's Data
From any Device you can easily clear all gathered data without having to recreate the device. To clear all
data from a Device, simply open the device you need to reset and click the "reload" icon located in the
main control bar to remove any recorded data and reset the device's data.
45 | P a g e
Hands-on: Connect a NodeMCU ESP8266 to Ubidots over MQTT
Learn to connect the NodeMCU ESP8266 to Ubidots
Application Development Platform over MQTT
Requirements
Step-By-Step
1. To be able to work with the NodeMCU ESP8266 platform in the Arduino IDE, you will need to install
the ESP8266 platform using the preconfigured Arduino Board Manager.
2. With the ESP8266 platform installed, select the ESP8266 device you are working with. In the case, we
are working with a “NodeMCU 1.0(ESP12E module)”. To select your board from the Arduino IDE, select
Tools > Board “NodeMCU 1.0(ESP12E module)”.
46 | P a g e
2. Sending (PUBLISH) Data to Ubidots
With the following sample code you will be able to post the readings taken from ANALOG pin A0 of
the NodeMCU ESP8266.
1. To publish your first value in Ubidots, open the Arduino IDE and paste the sample code below. Once
you have pasted the code, you will need to assign your uniqueUbidots TOKEN, SSID (WiFi
Name) and Password of the available network.
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
/****************************************
* Define Constants
****************************************/
TOK
#define TOKEN "..... " // Your Ubidots EN
#define WIFINAME ".... " //Your SSID
#define WIFIPASS "..... " // Your Wifi Pass
Ubidots client(TOKEN);
/****************************************
* Auxiliar Functions
****************************************/
/****************************************
* Main Functions
****************************************/
void setup() {
/ put your setup code here, to run once: //client.ubidotsSetBroker("business.api.ubidots.com"); //
Sets the broker properly for the
business account
client.setDebug(true); // Pass a true or false bool value to activate debug messages
Serial.begin(115200);
client.wifiConnection(WIFINAME, WIFIPASS);
client.begin(callback);
}
void loop() {
/ put your main code here, to run repeatedly: if(!
client.connected()){
client.reconnect();
}
47 | P a g e
2. Verify your code within the Arduino IDE. To do this, in the top left corner of our Arduino IDE you will
see the "Check Mark" icon; press it to verify your code.
3. Upload the code into your “NodeMCU 1.0(ESP12E module)”. To do this, choose the "right-arrow"
icon beside the "check mark" icon.
4. To verify the connectivity of the device and the data sent, open the serial monitorby selecting
the "magnifying glass" icon in the top right corner of the Arduino IDE to see the connectivity logs.
NOTE: If no response is seen, try unplugging the NodeMCU and then plugging it again. Make sure the
baud rate of the Serial monitor is set to the same one specified in your code 115200.
5. Confirm your data in Ubidots. Now you should see the posted data in your Ubidots account, located
the device called "my-new-device".
NOTE: To change the name ID of the device being updated in Ubidots, replace the string assigned in
code with the following line:
client.ubidotsPublish("my-new-device");
With the following sample code you will be able to subscribe a value from Ubidots to start controlling
any asset you desire.
1. To begin receiving values from Ubidots, open the Arduino IDE and paste the sample code below. Once
you have pasted the code, be sure to assign the following parameters:
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
/****************************************
* Define Constants
****************************************/
TOK
#define TOKEN "..... " // Your Ubidots EN
#define WIFINAME "..... " //Your SSID
#define WIFIPASS "..... " // Your Wifi Pass
#define DEVICE_LABEL "..." // Put here your Ubidots device label #define
VARIABLE_LABEL "..." // Put here your Ubidots variable label
Ubidots client(TOKEN);
/****************************************
* Auxiliar Functions
****************************************/
48 | P a g e
for (int i=0;i<length;i++) {
Serial.print((char)payload[i]);
}
Serial.println();
}
/****************************************
* Main Functions
****************************************/
void setup() {
/ put your setup code here, to run once: client.ubidotsSetBroker("business.api.ubidots.com"); //
Sets the broker properly for the
business account
client.setDebug(false); // Pass a true or false bool value to activate debug messages
Serial.begin(115200);
client.wifiConnection(WIFINAME, WIFIPASS);
client.begin(callback);
client.ubidotsSubscribe(DEVICE_LABEL, VARIABLE_LABEL); //Insert the dataSource and Variable's
Labels
}
void loop() {
/ put your main code here, to run repeatedly: if(!
client.connected()){
client.reconnect();
client.ubidotsSubscribe(DEVICE_LABEL, VARIABLE_LABEL); //Insert the dataSource and
Variable's Labels
}
client.loop();
}
2. Verify & Upload the code into the board following the same steps provided in the PUBLISH step above.
3. To verify the connectivity of the device and the data which is being received, open the serial monitor by
selecting the "magnifying glass" icon in the top right corner of the Arduino IDE to see the connectivity logs.
NOTE: If no response is seen, try unplugging the NodeMCU ESP8266 and then plugging it again. Make
sure the baud rate of the Serial monitor is set to the same one specified in your code 115200.
4. In the serial monitor, you will be able to see the last value received in Ubidots of the variable specified
in the firmware.
4. Summary
With this simple tutorial you are able to PUBLISH & SUBSCRIBE data to/from Ubidots with the ease
of the Arduino IDE and a NodeMCU ESP8266. If your wish to find more examples to handle context or
timestamp values in your request
49 | P a g e
Hands-on: Connect a NodeMCU ESP8266 to Ubidots
over HTTP
By following this guide, you will be able to POST data to Ubidots using the NodeMCU ESP8266
module in just a couple of minutes!
Requirements
1. To be able to work with the NodeMCU ESP8266 platform in the Arduino IDE, you will need to
install the ESP8266 platform using the preconfigured Arduino Board Manager.
2. With the ESP8266 platform installed, select the ESP8266 device you are working with. In the case, we
are working with a “NodeMCU 1.0(ESP12E module)”. To select your board from the Arduino IDE,
select Tools > Board “NodeMCU 1.0(ESP12E module)”.
Note: The library will create a new Ubidots device named "ESP8266" receiving the mac address of the
ESP8266 as the unique device label. If you desire assign a different device name and label, please
implement the follow lines of code into your setup of your code (no changes are needed in the loop).
client.setDataSourceName("New_name");
client.setDataSourceLabel("New_label");
50 | P a g e
2. Sending (POST) Data to Ubidots
With the following sample code you will be able to post readings taken from the ANALOG pin of
the NodeMCU ESP8266.
1. To post your first value in Ubidots, open the Arduino IDE and paste the sample code below. Once
you have pasted the code, you will need to assign your unique Ubidots TOKEN, SSID (WiFi
Name) and Password of the available network.
#include "UbidotsMicroESP8266.h"
Ubidots client(TOKEN);
void setup(){
Serial.begin(115200);
client.wifiConnection(WIFISSID, PASSWORD);
//client.setDebug(true); // Uncomment this line to set DEBUG on
}
void loop(){
float value1 = analogRead(A0);
client.add("temperature", value1);
client.sendAll(true);
delay(5000);
}
2. Verify your code within the Arduino IDE. To do this, in the top left corner of our Arduino IDE you will
see the "Check Mark" icon; press it to verify your code.
3. Upload the code into your “NodeMCU 1.0(ESP12E module)”. To do this, choose the "right-arrow"
icon beside the "check mark" icon.
4. To verify the connectivity of the device and the data sent, open the serial monitorby selecting
the "magnifying glass" icon in the top right corner of the Arduino IDE to see the connectivity logs.
NOTE: If no response is seen, try unplugging the NodeMCU and then plugging it again. Make sure the
baud rate of the Serial monitor is set to the same one specified in your code 115200.
5. Confirm your data in Ubidots. Now you should see the posted data in your Ubidots account, located
the device called "esp8266".
3. Summary
With this simple tutorial you are able to POST data to Ubidots with
the ease of the Arduino IDE and a NodeMCU ESP8266.
51 | P a g e
Introduction to Raspberry pi
Raspberry Pi 3 Model B
(Latest release of Raspberry Pi)
52 | P a g e
Connecting with Raspberry pi:
53 | P a g e
Simulate data in Ubidots using Python in Raspberry Pi
Send a simple Python requests from Raspberry Pi's terminal to test and interact with Ubidots' REST
API.
If you have a Raspberry Pi, Onion Omega, Beaglebone or other Linux-based device, or if you just want
to create a script in your PC to interact with Ubidots, here's a brief example to get you there.
Requests is a popular Python library that simplifies making HTTP requests from any python script which
can be run in your computer's terminal or any embedded Linux device.
With your computer configured with Python correctly, run the pip package in your computer or
device's terminal to install the correct library.
With Python properly installed, we will now need to create a Python script. Run the below command in
your computer terminal to create a script.
$ nano
First, let's look at how Ubidots API expects an HTTP request to process data:
• Method: HTTP allows for several methods (GET, POST, PUT, DELETE, etc). To create a value in
Ubidots we use a POST request.
• URL: The URL of the resource you want to access
(things.ubidots.com/api/v1.6/your-device-label/?token=your-token)
• HTTP Headers: Ubidots' API uses JSON as the data type, so the header would be
"Content-Type:application/json"
• Body: A JSON string containing the label of the variable(s) and their values. For example:
{"temperature":23, "humidity":98}
Copy and paste the below code in your terminal; assigning your Ubidots TOKEN where indicated in
the code.
import time
import requests
import math
import random
TOKEN
TOKEN = "..." # Put your here
DEVICE_LAB
EL = "machine" # Put your device label here
VARIABLE_LA
BEL_1 = "temperature" # Put your first variable label here
VARIABLE_LA
BEL_2 = "humidity" # Put your second variable label here
VARIABLE_LA = "position" # Put your second variable label here
BEL_3
54 | P a g e
def build_payload(variable_1, variable_2, variable_3):
# Creates two random values for sending data
value_1 = random.randint(-10, 50)
value_2 = random.randint(0, 85)
payload
def post_request(payload):
# Creates the headers for the HTTP requests url
= "http://things.ubidots.com"
url = "{}/api/v1.6/devices/{}".format(url, DEVICE_LABEL)
headers = {"X-Auth-Token": TOKEN, "Content-Type": "application/json"}
# Processes results if
status >= 400:
print("[ERROR] Could not send data after 5 attempts, please check \ your
token credentials and internet connection")
return False
def main():
payload = build_payload(
VARIABLE_LABEL_1, VARIABLE_LABEL_2, VARIABLE_LABEL_3)
if __name__ == '__main__':
while (True):
main()
time.sleep(1)
Once the code has been compiled with your Ubidots TOKEN, press CONTROL + O and ENTER to save
the file - assigning a file name as you save (be sure to remember the ".py" in your file name). Once the
script is saved, exit the Python editor by pressing CONTROL + X and return to the computer's terminal.
Execute your script
From your computer terminal, run the script, (including the saved script from Python editor) with
the following command.
55 | P a g e
$ python [saved_script_name].py
Run the code in your computer or device(Raspberry pi) terminal to begin simulating data and visualize
your work by logging into your Ubidots account.
import requests
import random
import time
if __name__ == "__main__":
while True:
print(get_var(DEVICE, VARIABLE))
time.sleep(DELAY)
56 | P a g e
Ubidots for Education Events: Creating an Event (SMS, Email, and Telegram)
Learn to create complex events via email, SMS, or Telegram based on your sensor data.
An event (or alert) is any action triggered when data fulfills or exceeds a design rule. For example, an
email or SMS message can be sent anytime a sensor stops sending data or a temperature exceeds a
maximum threshold. In this article we will describe the setup and logic of Ubidots' Events Engine.
Creating an Event
To begin, we will tell Ubidots to send an alert via email when the variable called "Power" exceeds a
predetermined 1,500 boundary.
To create an Event:
57 | P a g e
Next, choose the format of your alert. In this case, we will use emails.
Alerts can be very helpful and with Ubidots you can customize who, when, why, and what will be said
in any alert. You might be interested in sending this alert to your maintenance department, machinist, or
a manufacturer for quality assurance.
Lastly, name this alert for simple identifying the next time it is needed.
Select "Finish" and you have now created an alert for the Power variable when it exceeds 1,500.
We also created an alert when Machine's 1 energy consumption is below 5000 and inserted the last value
of the variable within the message.
SMS: SMS stands for Short Messaging Service and is a text-only messages with a limit of 160 characters
per message.
58 | P a g e
Telegram: is an open source messaging app that allows you to send files in almost any format.
The figure below describes how the Events Engine triggers alerts inside Ubidots core:
Please note that after an alert is triggered, the subsequent values will not trigger the alert again, even if
they comply with the trigger conditions, unless the value goes outside the trigger condition and returns
again:
59 | P a g e
Just being connected only gets us so far. Intelligence is required to build truly useful IoT devices.
When you think about the Internet of Things (IoT), when do you picture it arriving? In five years?
Ten?
It’s a trick question, because the IoT is already here. Don’t believe me? Answer this: How many IP
addresses do you have at home right now?
It wasn’t that long ago that every house had only a single IP address — one for a PC modem. These days,
nearly every new smartphone, tablet and speaker has an IP address. If you’ve got a thermostat, security
cameras or connected lightbulbs, they’ve got them, too. Add all these things up, and you’ll find you’ve got
10, 20, or maybe even 30 IP addresses at home. I’ve got 43.
Just being connected only gets us so far. Intelligence is required to build truly useful IoT devices.
What do IP addresses have to do with the state of the IoT? They’re an indication that our lives and our
homes are already full of connected devices. We’re surrounded by them. And many of these devices aren’t
just connected — — they’re also intelligent. This means that homes and cities aren’t suddenly going to
become smart at some point in the future. There won’t be a “eureka!” moment or a flipped switch. Instead,
we’re building an intelligent IoT one purchase at a time. And that’s already changing the way we live our
lives.
Take televisions. You’re going to have a hard time buying one that’s not connected today. A good set will
be able to download its own software updates and stream your favourite shows from your favourite
streaming services.
And TVs are just one piece of the trend; connectivity is being added to an amazing array of devices, from
simple to complex, all over the world. In China, for example, companies like Haier, Hisense and Medea
launch hundreds of appliances every year, and more than half are connected. We’re talking rice cookers,
vacuums, dishwashers, and even air conditioners. The number of connected devices worldwide is expected
to be in the billions in the next few years.
That connectivity brings plenty of convenience to our devices, but just being connected only gets us so far.
Intelligence is required to build truly useful IoT devices. The TV of the future will work with other devices
and sensors in your house to recognize when you’re sitting in front of it, and will automatically flip on your
favourite show. You’ll also be able to use it to control your lights, thermostat, and probably everything else.
And those benefits aren’t limited to the home. Imagine intelligent freeway lighting that only illuminates
roads when it senses a car approaching, or connected cars that interact with parking meters to tell you
where the closest available parking spot is.
We need to break down the barriers that keep smart devices as islands, unable to communicate with
one another.
The IoT also needs to evolve to be truly functional. The next step is a seamless network of devices that live
at the edge and have intelligent processing. Take that security camera in your house. Right now, you get a
barrage of useless notifications, because it can’t tell the difference between a car on the street and a
stranger at your door. Thinking ahead: A smart security camera would not only be able to differentiate
between friends and strangers, but also pets and stray animals. And it would only notify you when someone
you don’t know is knocking at the door.
Intelligent processing has its challenges, though, like storage, security and seamless interactions. We need
to break down the barriers that keep smart devices as islands, unable to communicate with one another.
Your TV should be able to talk to your refrigerator if it wants to.
And, of course, you still need to meet consumer expectations: Simplicity, durability and extended battery
life. You don’t want a fitness tracker that requires you to constantly check your phone, but neither do you
want a bulky smartwatch that runs out of batteries in a couple of hours.
There’s no one technology that will address all these issues. It’s going to take multiple kinds of connectivity,
from Wi-Fi to Bluetooth to LTE. We need complex information processing capabilities that work on the
edge and in the cloud. It’s much more than just adding a bunch of sensors to the environment. It requires
new thinking and the creation of platforms and systems that can take all of these challenges and deliver them
in a format that works.
The evolution will be incremental. But add up the many small changes, and we’ll soon be living in a
new kind of smart, connected world. The future of the IoT will be here faster than you think.
61 | P a g e
The Cloud
62 | P a g e
Six Advantages and Benefits of Cloud Computing
Go global in minutes
Easily deploy your application in multiple regions around the world with just a few clicks. This
means you can provide lower latency and a better experience for your customers simply and at
minimal cost.
63 | P a g e
Types of cloud services: IaaS, PaaS, SaaS
Most cloud computing services fall into three broad categories:
infrastructure as a service (IaaS), platform as a service (PaaS) and
software as a service (Saas). These are sometimes called the cloud
computing stack because they build on top of one another. Knowing
what they are and how they are different makes it easier to accomplish
your business goals.
Infrastructure-as-a-service (IaaS)
The most basic category of cloud computing services. With IaaS, you
rent IT infrastructure—servers and virtual machines (VMs), storage,
networks, operating systems—from a cloud provider on a pay-as-you-go
basis.
Platform as a service (PaaS)
Platform-as-a-service (PaaS) refers to cloud computing services that
supply an on-demand environment for developing, testing, delivering
and managing software applications. PaaS is designed to make it easier
for developers to quickly create web or mobile apps, without worrying
about setting up or managing the underlying infrastructure of servers,
storage, network and databases needed for development.
Software as a service (SaaS)
Software-as-a-service (SaaS) is a method for delivering software
applications over the Internet, on demand and typically on a
subscription basis. With SaaS, cloud providers host and manage the
software application and underlying infrastructure and handle any
maintenance, like software upgrades and security patching. Users
connect to the application over the Internet, usually with a web
browser on their phone, tablet or PC.
64 | P a g e
Introduction to AWS
Amazon Web Services (AWS) is a cloud service from Amazon, which provides services in the form of
building blocks, these building blocks can be used to create and deploy any type of application in the cloud.
These services or building blocks are designed to work with each other, and result in applications which are
sophisticated and highly scalable.
AWS offers the largest global footprint in the market. No other cloud provider offers as many regions with
multiple Availability Zones, with 66 Availability Zones (AZs) within 21 geographic regions around the
world, and announced plans for 12 more AZs and four more Regions in Bahrain, Cape Town, Jakarta, and
Milan.
65 | P a g e
Each type of service here is categorized under a domain, the few domains which are widely used are:
• Compute
• Storage
• Database
• Migration
• Network and Content Delivery
• Management Tools
• Security & Identity Compliance
• Messaging
The Compute domain includes services related to compute workloads; it includes the following services:
The Storage domain includes services related data storage; it includes the following services:
The Database domain is used for database related workloads, it includes the following services:
• Amazon Aurora
• Amazon RDS
• Amazon DynamoDB
• Amazon RedShift
The Migration domain is used for transferring data to or from the AWS Infrastructure, it includes the
following services:
The Networking and Content Delivery domain is used for isolating your network infrastructure, and
content delivery is used for faster delivery of content. It includes the following services:
• Amazon Route 53
• AWS CloudFront
The Management Tools domain consists of services which are used to manage other services in AWS, it
includes the following services:
• AWS CloudWatch
• AWS CloudFomation
• AWS CloudTrail
The Security & Identity, Compliance domain consist of services which are used to manage to authenticate
and provide security to your AWS resources. It consists of the following services:
66 | P a g e
• AWS IAM
• AWS KMS
• AWS Shield
The Messaging domain consists of services which are used for queuing, notifying or emailing messages. It
consists of the following domains:
• Amazon SQS
• Amazon SNS
• Amazon SES
• Amazon Pinpoint
AWS IoT provides secure, bi-directional communication between Internet-connected devices such as
sensors, actuators, embedded micro-controllers, or smart appliances and the AWS Cloud. This enables you
to collect telemetry data from multiple devices, and store and analyse the data. You can also create
applications that enable your users to control these devices from their phones or tablets.
Connectivity
Connectivity provides a secure, authenticated connection between your devices and AWS IoT Core.
Connectivity is metered in 1-minute increments and is based on the total time your devices are connected
to AWS IoT Core.
Region:
For example, in the US East (N. Virginia) region you pay $0.042 per device per year (1 connection *
$0.08/1,000,000 minutes of connection * 525,600 minutes/year) for 24/7 connectivity. In order to maintain
68 | P a g e
connectivity, devices may send keep-alive (“Ping”) messages at frequencies ranging from 20 minutes to
every 30s, and you do not incur any additional cost for these messages.
Messaging
Messages transport device data to and from AWS IoT Core. Messaging is metered by the number of
messages transmitted between your devices and AWS IoT Core.
Region:
Messaging pricing
You may send and receive messages up to 128 kilobyte (KB) in size. Messages are metered in 5
KB increments. For example, an 8 KB message is metered as two messages.
Device Shadow & Registry
The Device Shadow stores the desired state or actual state of a device, and the Registry is used to name
and manage devices. Use of Device Shadow and Registry is metered by the number of operations that
access or modify Device Shadow or Registry data.
Region:
Device Shadow and Registry operations are metered in 1 KB increments of the Device Shadow or
Registry record size. For example, an update to a 1.5 KB Device Shadow record is metered as two
operations.
Rules Engine
Rules Engine allows you to transform device data using arithmetic operations or external functions such as
AWS Lambda, and then route the data to an AWS service such as Amazon S3, Amazon DynamoDB, or
Amazon Kinesis. Rules Engine use is metered for each time a rule is triggered, and for the number of
actions executed within a rule, with a minimum of one action per rule.
Region:
Rules triggered: $0.15 (per million rules triggered / per million actions executed)
Actions executed: $0.15 (per million rules triggered / per million actions executed)
69 | P a g e
Rules and actions are metered in 5 KB increments of the message size. For example, a rule that processes a
5 KB message and executes no action is metered as one rule and one action, and a rule that processes an 8
KB message and executes two actions is metered as two rules and four actions.
For example, the Free Tier would allow you to run a 50-device workload, where each device:
The AWS Free Tier is available to you for 12 months starting with the date on which you create your AWS
account. When your free usage expires or if your application use exceeds the free usage tiers, you simply
pay the above rates. The free usage tier applies across all AWS Regions except GovCloud (US). Your usage
is calculated each month across all regions and is automatically applied to your bill. Note that free usage
does not accumulate from one billing period to the next.
70 | P a g e
Introduction to Google Cloud Platform
Google Cloud Platform (GCP) is a collection of Google’s computing resources, made available via services
to the general public as a public cloud offering.
The GCP resources consist of physical hardware infrastructure — computers, hard disk drives, solid state
drives, and networking — contained within Google’s globally distributed data centers, where any of the
components are custom designed using patterns similar to those available in the Open Compute Project.
This hardware is made available to customers in the form of virtualized resources, such as virtual
machines (VMs), as an alternative to customers building and maintaining their own physical
infrastructure.
As a public cloud offering, software and hardware products are provided as integrated services that provide
access to the underlying resources. GCP offers over 50 services including Infrastructure as a Service (IaaS),
Platform as a Service (PaaS), and Software as a Service (SaaS) offerings in the categories of Compute,
Storage & Databases, Networking, Big Data, Machine Learning, Identity & Security, and Management &
Developer tools.
These services can be used independently or in combination for developers and IT professionals to construct
their own, custom cloud-based infrastructure.
GCP is hosted on the same underlying infrastructure that Google uses internally for end-user products
including Google Search and YouTube.
71 | P a g e
A zone is a deployment area for resources within a region. Zones are isolated from each other to prevent
outages from spreading between them, so each zone is considered a single failure domain within a region.
Zonal resources operate within a single zone; if a zone becomes unavailable all of its resources are
unavailable until service is restored. Regional resources are deployed with redundancy across zones within a
region. Multi-regional services (Google App Engine, Google Datastore, Google Cloud Storage, Google
BigQuery) are managed by Google to be redundant and distributed within and across regions.
All GCP service instances are configured such that maintenance events are transparent to applications and
workloads via live migration. Live migration moves running virtual machine instances out of the way of
maintenance that is being performed.
GCP services are available in 18 zones in 6 regions: Oregon, Iowa, South Carolina, Belgium, Taiwan,
and Tokyo¹.
In 2016, Google announced plans to make 22 zones and 8 new regions available in 2017: Sydney, Sao
Paulo, Frankfurt, Mumbai, Singapore, London, Finland, and Northern Virginia.
Within each region, traffic tends to have round-trip network latencies of under 5ms on the 95th percentile.
Cloud IoT Core is a fully managed service that allows you to easily and securely connect, manage, and
ingest data from millions of globally dispersed devices. Cloud IoT Core, in combination with other services
on Cloud IoT platform, provides a complete solution for collecting, processing, analyzing, and visualizing
IoT data in real time to support improved operational efficiency.
72 | P a g e
Make informed decisions at global scale
Hands-on: Publishing Data from Raspberry pi to AWS IoT core using Python based Simulation via
MQTT protocol.
Hands-on: Subscribing Data from AWS IoT core topic to Raspberry pi via MQTT protocol using Python
based code.
Here is a link of the GitHub based tutorial created by our instructor which we have followed:
https://github.com/rudz4u/AWS-IoT-Basic-Codes
We have also completed all the Virtual labs Available on Qwiklabs for Google IoT based integrations:
https://www.qwiklabs.com/quests/49
HANDS-ON LAB
Internet of Things: Qwik Start
This lab shows you how to use Google Cloud Platform Console to create a Cloud IoT Core device
registry and register a device. It also shows you how to run a sample to connect a device and publish
device telemetry events.
HANDS-ON LAB
HANDS-ON LAB
74 | P a g e
HANDS-ON LAB
HANDS-ON LAB
HANDS-ON LAB
HANDS-ON LAB
HANDS-ON LAB
HANDS-ON LAB
After this training session we have now got exposure of Internet of Things in advance level with
utilization of Cloud based services to take our application at scales.
We have additionally explored about Computer vision technology using Google
vision API via qwiklabs link : https://www.qwiklabs.com/focuses/1841?parent=catalog
We would now able to do our own IoT project works with a complete loop system from device end to
user end.
76 | P a g e
77 | P a g e