0% found this document useful (0 votes)
23 views

Dec50132 Internet Based Controller Iot-Chapter 2

Chapter 2:Dec50132 Internet Based Controller (IoT) POLITEKNIK SEBERANG PERAI (PSP)

Uploaded by

JustShareIt
Copyright
© © All Rights Reserved
0% found this document useful (0 votes)
23 views

Dec50132 Internet Based Controller Iot-Chapter 2

Chapter 2:Dec50132 Internet Based Controller (IoT) POLITEKNIK SEBERANG PERAI (PSP)

Uploaded by

JustShareIt
Copyright
© © All Rights Reserved
You are on page 1/ 53

INTERNET BASED CONTROLLER

Chapter 2
Course Outline

1 Introduction to Internet of Things (IoT)

2 Hardware and Software

3 Internet Communication and Connection

4 IoT Communication Protocol

5 Project Development
IoT
Hardware and Software
Introduction to Internet of Things
Course Content Outline

Microcontroller (MCU) as the


core of IoT embedded
system platform
embedded system development
software and tools
sensors as a thing

the function of actuators

sensor and actuator


application in real
application
2.1 Understand Microcontroller (MCU) as the
core of IoT embedded system platform

► Microcontrollers can be thought of as tiny computers that can be added to any physical
object or space to give it a ‘brain’. They contain one or more computer processors,
along with memory and programmable input/output peripherals – all in a single
integrated circuit.
► MCUs are different from the microprocessors that are found in personal computers
because they are specifically designed for embedded applications where computing is
not the sole purpose of the application.
► While MCUs have less capability than a standard computer processor, their low cost
makes them a more practical option for adding computing capabilities to an object,
space, or process that doesn’t have them.
► Think of something like a warehouse, bridge, or industrial machine that typically
doesn’t contain a computer. In cases like these adding an Internet-connected
microcontroller provides enough computing power to enhance these things without
adding the higher cost and complexity of standard computer processors.
Key Features of Microcontrollers
 In order to be able to determine which microcontroller will work the
best with your application, you’ll need to know some of the key
features of microcontrollers and what they do.
 Below are some of the specs that you’ll encounter and need to make
sense of when looking at a data sheet for a MCU:
► Bits: Microcontrollers are typically sold by the number of bits they offer.
This impacts the speed with which they are able to perform non-trivial
computations.
► RAM: RAM is fast-access memory that does not retain data in an absence
of power. All MCUs come with certain amounts of RAM, which allows
your microcontroller to quickly perform various actions. The more you
have, the better, but the added RAM increases the cost of the MCU.
► Flash: Flash is computer memory that retains data in the absence of
power. At least some of this is essential, and it’s very useful for features
like offline storage.
Key Features of Microcontrollers
► GPIO: GPIO stands for general-purpose input/output pins. These are the
pins that you will use for connecting your sensors and actuators to the
MCU and the internet. The number of pins can range from one to the
hundreds depending on the microcontroller.
► Connectivity: This is how the board (and application) connects to the
internet via wifi, ethernet or some other means. This is an important
aspect of connected sensor applications, so we’ll go over this topic later in
the book.
► Power consumption: Power consumption is critically important for
connected sensor applications, particularly so when your device has to rely
on something like battery or solar power. This spec will tell you how power
hungry the MCU is by default and whether or not it supports power-
conscious programming techniques.
► Development tools & community: It’s important that there is a mature set
of tools, documentation, and community support to help build programs
that will run on the MCU you select for your application.
Choosing A Microcontroller For Your IoT
System
► There are many different development boards and microcontrollers
available from a variety of companies: TI, Samsung, Arduino, Raspberry
Pi and more. Choosing which one is right for you depends on a number of
factors that vary depending on the nature of your application.
► Compatibility: Does the MCU support the sensors and actuators you want
to use? Depending on your sensors and actuators, you might need many or
just a few ports. You’ll want to make sure that you have enough
input/output ports available.
► Architecture: Is the architecture sophisticated enough to handle the
complexity of your program? Most applications use either ARM, MIPS, or
X86. Choosing one depends on the functional requirements of your
application and how much computing power your system needs.
► Memory: Does the MCU come with enough memory – RAM and Flash – for
your program? It is highly recommended that you choose an MCU with a
comfortable amount of extra memory for future updates. This will save
you time, money, and some major headaches in the long run!
Choosing A Microcontroller For Your
IoT System
► Availability: Can you easily get the MCU that you want and in the quantity that you need?
This is important to consider at the beginning of the process, especially if you plan on
scaling up your system later on.
► Power: How much power will the MCU need? Will it need to be wired or can you use
batteries? Energy efficiency is extremely important to consider for Industrial IoT
applications because you’ll want to minimize the need for sending maintenance crews to
inspect edge infrastructure.
► Cost: How much does each unit cost? Does the price make sense based on the value it will
deliver? Again, you’ll want to think about scaling the project up later on. Make sure that
your IoT budget support including more of the MCUs you choose.
► Development Kit: Is a development kit available? Development kits are an excellent way to
get started with the MCU you choose because they are designed to give customers an
out-of-box experience. This will make the development of your IoT application much easier!
► Development Support: Is good documentation for your MCU available? What is the
community surrounding this board like? These factors are crucial in order to make informed
decisions on how to use your MCU properly. A good online community can help guide you
when you are stuck or encounter a problem with your implementation.

► https://blog.temboo.com/how-to-choose-a-microcontroller-for-iot/
Top Hardware Platforms for Internet of
Things (IoT)
IoT Hardware Development Platform

► This essentially refers to platforms that are used for the development of the “things” in the
internet of things. It could refer to communication modules, Microcontrollers, and SoC modules
with features that make them desirable for use in the development of IoT devices. The list
below is in no particular order and by no means exhaustive as there are more development
platforms than one could probably name, but it contains some of the most comprehensive, and
maker-friendly platforms.

► 1. Particle.io
► Particle.io is one of the most comprehensive end to end IoT platforms. It is an all-in-one io
platform that offers IoT hardware development platform, connectivity, device cloud and apps.
Particle makes a long line of IoT hardware development products for both rapid prototypes and
DFM level production. Building an IoT product starts with connecting the devices to the
internet and all the Particle’s microcontroller boards are enabled to communicate over
either of Wi-Fi, cellular (2G/3G/LTE), or mesh. With some of their boards featuring multiple
communication options onboard. Their microcontrollers are controlled by a special OS which
enables developer to integrate the devices easily with particle’s device cloud and apps. As a
peck, their devices and communication modules come with CE and FCC certifications which
reduce the cost of certificate, on when the product is ready to be scaled. Their boards are open
source ensuring there is a lot of support for product development.
IoT Hardware Development Platform

► 2. Espressif ESP8266 Boards


► When it comes to building IoT devices, the range of products from Espressif and AI thinker is
the next best thing to particle. Since the release of the ESP8266-01 WiFi chip some years back,
ESP8266 based chips and boards have grown from being the darlings of makers and hobbyist to
being one of the most preferred chipset for WiFi based IoT devices. The Modules are usually
low-cost, low-power, and easy to use. These among other factors, endear them to the heart of
hardware designers. The ESP chips come with a lot of flexibility and can be used either as WiFi
modules, connected to other microcontrollers or used in standalone modes without additional
microcontrollers.
► They Possess small form factors and make it easy to implement IoT enabling functions like OTA
firmware updates. The availability of Development boards like NodeMCU and several other ESP
based third party boards enables developers to get a feel of the board before using them in
Designs. Just like the particle boards, ESP8266 boards, come with FCC and CE certification to
reduce the general cost of certifying the device after manufacturing. The ESP provides one of
the most robust, dedicated WiFi interface in the industry, featuring several protocols that
support the IoT like the ESP Touch protocol that enables the device to safely and seamlessly
access the internet via WiFi networks.
► ESP8266 boards are easy to learn and can be used with any microcontrollers to build ESP8266
based IoT projects.
IoT Hardware Development Platform

► 3. Intel IoT Development Boards


► Intel is by no doubt one of the major leaders of the semiconductor kingdom
and it was no surprise when they released a couple of boards with IoT
enabling features a while back. While they have discontinued support for
some of the old boards, some of these boards are still being used for rapid
prototyping by makers and product development by designers. One of the
major features of the board, unsurprisingly is the huge processing
capabilities. One of the most popular of the Intel boards is the Intel Edison
compute module.
► According to Intel’s website, the compute module was designed for experts,
makers, entrepreneurs, and for use in industrial IoT applications. The
module provides ease-of-development for prototypes development and use in a
range of commercial ventures when performance matters. The module uses a
22 nm Intel SoC that includes a dual core, dual threaded Intel Atom CPU at
500MHz and a 32-bit Intel® Quark microcontroller which runs at 100 MHz. The
module and most of the other boards like the Intel Curie and the Intel Galileo
has however been discontinued. The currently most popular IoT hardware
development platform from Intel is the Up Squared groove IoT
Development Kitwhich is a platform designed specifically to suit the rugged
demands of industrial IoT applications.
IoT Hardware Development Platform

► 4. Adafruit Range of Development boards


► Adafruit is one of the biggest online electronics component store.
Adafruit joined the IoT race a while back with special line of
product like the Adafruit feather boards that possessed unique
features to enable the development of scalable IoT prototypes.
Asides the development boards, just like particle, Adafruit
provides cloud services for devices with simple client libraries
for all major IoT hardware development platforms, Powerful API,
beautiful Dashboards and an all-round secure IoT platform. It
could be easily said that the major difference between Adafruit
and Particle is the way their products are designed. Adafruit.io
is designed with a unique focus on the maker community. It’s
a solution perfect for prototype development. Particle on the
other hand, has a more commercial, product grade undertone.
IoT Hardware Development Platform
► 5. Arduino IoT Product Line
► It’s impossible for the Arduino to be an unfamiliar name to anyone within the
IoT space. Long before the IoT became mainstream, several of the Arduino
boards were already being used to develop prototypes for connected
devices. With the ease of programming and the plug and play nature of
Arduino based system, it quickly became loved by many in the hardware
space. The early Arduino boards, were mostly general purpose
microcontrollers which were connected to the internet using GSM and WiFi
modules, but as the IoT began to Open up, boards with special features that
support the IoT were developed. Boards like the Arduino 101(developed with
Intel), the MKR1000, Arduino WiFi Rev 2 and the MKR Vidor 4000 which is the
first Arduino board based on an FPGA Chip.
► Like Adafruit and particle, Arduino also has a cloud service dedicated to
be used by certain Arduino boards including; the MKR1000, Arduino Yun/Yun
Shield and the Arduino 101/WiFi Shield 101. The Arduino device cloud
(cloud.arduino.cc) offers a simple tool for makers to connect their device
to the internet and takes a very short setup process to get things working.
► Even a normal Arduino Uno can be used with Espressif ESP8266 modules to
build IoT Projects.
IoT Hardware Development Platform
► 6. The Raspberry Pi
► While the Raspberry Pi is naturally a general purpose device, it will be
injustice to ignore the contribution of the raspberry to the development of
some of IoT products and projects currently in vogue. They are generally too
robust and sophisticated to be used in the development of simple connected
sensors or actuators, but they find application serving as data aggregators,
hubs and device gateways in IoT projects. The latest of the raspberry pi
boards; the Raspberry pi 3 model B+ features a 1.4GHz Broadcom BCM2837B0,
Cortex-A53 (ARMv8) 64-bit SoC, 2.4GHz and 5GHz IEEE 802.11.b/g/n/ac
wireless LAN, Bluetooth 4.2, BLE, and a Gigabit Ethernet port over USB 2.0
(maximum throughput 300 Mbps). Asides several other features including 4 USB
ports, Audio output, to mention a few, the board comes with a 1GB LPDDR2
SDRAM which makes it quite fast for IoT based tasks.
► To appeal to the Industrial IoT crowd and generally people who would love to
use the Raspberry pi in their products, the raspberry pi compute module was
launched. The Raspberry pi compute module three (CM 3) is currently the
latest and it contains the guts of a Raspberry Pi 3 (the BCM2837 processor and
1GB RAM) as well as a 4GB eMMC Flash device (which is the equivalent of the
SD card in the Pi) running at a 1.2GHz processor speed all integrated on a
small 67.6mm x 31mm board which fits into a standard DDR2 SODIMM
connector (the same type of connector as used for laptop memory).

https://circuitdigest.com/article/top-hardware-
platform s-for-internet-of-things-iot
2.1.1 Identify different type of embedded
controller module specification

► a. Ports : Pin layout and logic level signal (3.3V vs


5V)
► b. MCU Memory, speed, power use, security feature
► c. Connectivity type such as Bluetooth, Wifi,
cellular
► d. Cost and support

► https://www.embedded-computing.com/embedded-computing-design/an-
iot-development-kit-comparison
Comparing ESP8266 and ESP32

► https://www.cnx-software.com/2016/03/25/esp8266-and-esp32-
differences-in-one-single-table/
Compare
PARAMETER Arduino UNO Rasberry Pi B+ ESP8266 ESP32
Processor ATMega328P Broadcom BCM2837B0 Xtensa Dual-Core 32-bit Xtensa Dual-Core 32-bit LX6 with 600 DMIPS
quad-core A53 LX6 with 600 DMIPS
(ARMv8) 64-bit

Operating voltage 5V 5V 3.3V 2.2V to 3.6V

Ports 14 40 17 36

Memory 2kB 1GB <45kB 448kB

Clock Speed 16MHz 1.2GHz 26MHz- 52 MHz Up to 240MHz

Power use Power down sleep No sleep mode three low power Active Mode, Modem Sleep Mode, Light Sleep Mode, Deep
modes: Light Sleep, Sleep Mode, Hibernation Mode
Modem Sleep and
Deep Sleep.
Security feature - SSH SSL IEEE 802.11 standard security features all supported,
securi secur including WFA, WPA/WPA2 and WAPI
ty ity 1024-bit OTP, up to 768-bit for customers
Firew Firew Cryptographic hardware acceleration: AES, SHA-2, RSA,
all all elliptic curve cryptography (ECC), random number
generator (RNG)

Connectivity - Wi-Fi, Bluetooth Wi-Fi Wi-Fi, Bluetooth 4.2 and below


4.2, Bluetooth
Low Energy (BLE)
Cost RM 25 RM 200 RM 30 RM40

Support (IDE) Arduino IDE Any Linux compatible IDE Arduino IDE, LUA Loader Arduino IDE
Additional note

https://www.quora.com/What-is-the-difference-between-SSL-and-SSH-Are-they-both
-just-a-way-to-safely-access-a-remote-computer-through-encryption-Do-they-also-tra
nsfer-data
SOFTWARE PART OF
EMBEDDED SYSTEM BOARD

Embedded software is computer software, written to control machines or devices that are
not typically thought of as computers, commonly known as embedded systems. It is
typically specialized for the particular hardware that it runs on and has time and memory
constraints.[1] This term is sometimes used interchangeably with firmware.
A precise and stable characteristic feature is that no or not all functions of embedded
software are initiated/controlled via a human interface, but through machine-interfaces
instead.
Integrated Development
Environment (IDE)
What Is IDE?
An integrated development environment (IDE) is a software application that provides
comprehensive facilities to computer programmers for software development. An IDE
normally consists of at least a source code editor, build automation tools, and a debugger.
Some IDEs, such as NetBeans and Eclipse, contain the necessary compiler, interpreter,
or both; others, such as SharpDevelop and Lazarus,
Integrated Development Environment (IDE)
Tools

What is IDE in IoT?

An IDE often combines useful tools with compiler chains, so projects


and systems can be coded. IDEs are not limited to microcontrollers
and are used in just about every single software project on the planet.
They can create executable hex code, an application for Windows to
run, or even a program for a server to run as a task.
.
ESP32
NODEMCU 38P IOT ESP32 WIFI & BLUETOOTH DEVELOPMENT BOARD

ESP32 is a single 2.4 GHz Wi-Fi and Bluetooth


combo chip designed with TSMC ultra-low-power
40 nm technology. It is designed to achieve the
best power performance and RF performance,
showing robustness, versatility, excellent features
and reliability in a wide variety of applications and
different power profiles.

Features :
1) Ultra-Low-Power-Solution
2) Complete Integration Solution
3) Basic Protocols : Wifi & Bluetooth
Install and configure IDE
software for related embedded
module( ESP32)
Please Follow Practical Work 1
2.3 SENSOR AS A THING
SENSOR IN IOT APPLICATION

• The use of sensor is allow to create information from action, a generic term intended to capture the
concept of a sensing system comprising sensors, microcontrollers, modem chips, power sources, and
other related devices.
• Different sensors capture different types of information.
• Accelerometers measure linear acceleration, detecting whether an object is moving and in which
direction, while gyroscopes measure complex motion in multiple dimensions by tracking an object’s
position and rotation.
• By combining multiple sensors, each serving different purposes, it is possible to build complex value
loops that exploit many different types of information
SENSOR ACTIVE VS SENSOR PASSIVE
Active sensor Passive sensor
1. Emit energy of their own and then sense the response of the 1. Receive energy (in whatever form) that is produced external
environment to that energy to the sensing device.
2. Can be used in a wider range of environmental conditions 2. Require less energy
3. Example - Radio Detection and Ranging (RADAR) - Emits an 3. Example – A standard camera is embedded with a passive
electromagnetic signal that bounces off a physical object and is sensor—it receives signals in the form of light and captures
“sensed” by the RADAR system. them on a storage device.
TYPES OF SENSOR - POSITION

• A position sensor measures the position of an object; the position measurement can be either in
absolute terms (absolute position sensor) or in relative terms (displacement sensor).
• Position sensors can be linear, angular, or multi-axis.
• Example - Potentiometer, inclinometer, proximity sensor
TYPES OF SENSOR – FORCE AND PRESSURE SENSOR

• Force sensors detect whether a physical force is applied and whether the magnitude of force is
beyond a threshold.
• Pressure sensors are related to force sensors and measure the force applied by liquids or gases.
Pressure is measured in terms of force per unit area.
• Example - Force gauge, viscometer, tactile sensor (touch sensor), Barometer, bourdon gauge,
piezometer
TYPES OF SENSOR - TEMPERATURE

• Temperature sensors measure the amount of heat or cold that is present in a system.
• They can be broadly of two types: contact and non-contact.
• Contact temperature sensors need to be in physical contact with the object being sensed.
• Non-contact sensors do not need physical contact, as they measure temperature through
convection and radiation.
• Example - Thermometer, calorimeter, temperature gauge
TYPES OF SENSOR - HUMIDITY

• Humidity sensors detect humidity (amount of water vapor) in the air or a mass.
• Humidity levels can be measured in various ways: absolute humidity, relative humidity, mass ratio,
and so on.
• Example - Hygrometer, humistor, soil moisture sensor
TYPES OF SENSOR - BIOSENSOR

• Biosensors detect various biological elements such as organisms, tissues, cells, enzymes, antibodies,
and nucleic acids.
• Example - Blood glucose biosensor, pulse oximetry, electrocardiograph
TYPES OF SENSOR - VELOCITY AND ACCELERATION

• Velocity (speed of motion) sensors may be linear or angular, indicating how fast an object moves
along a straight line or how fast it rotates.
• Acceleration sensors measure changes in velocity.
• Example - Accelerometer, gyroscope
TYPES OF SENSOR - LIGHT

• Light sensors detect the presence of light (visible or invisible).


• Example - Infrared sensor, photodetector, flame detector
DIGITAL SENSOR VS ANALOGUE SENSOR
Digital sensor Analogue sensor

1. detects
two possible status: if it is working at 1. measures continuously the variable and detects
100% or at 0% any proportional value between 100% and 0%.
2. RTD - have higher resolution (positive and 2. Digital sensors have low calculation
range. For
negative temperature). This feature makes analog example, digital temperature sensors such as HYT
sensors suitable for wide temperature range and 271 and SHT series have lower temperature range.
stability.
3. 3.
ANALOGUE SENSOR
DIGITAL SENSOR
Explain sensor power requirement and
connection to MCU I/O.
Write code to read data from digital
sensor
Write code to read data from analogue
sensor
Please Follow Practical Work 2
2. 4 Actuator & Sensor
What is actuator?

 An actuator is a component of a machine that is responsible for moving


and controlling a mechanism or system
 In simple terms, it is a "mover".
 An actuator requires a control signal and a source of energy
 The control signal is relatively low energy and may be electric voltage or
current, pneumatic or hydraulic pressure, or even human power.
 Its main energy source may be an electric current, hydraulic fluid pressure,
or pneumatic pressure.
 When it receives a control signal, an actuator responds by converting the
signal's energy into mechanical motion.
DC Motor

 Electrical DC Motors are continuous actuators that convert electrical


energy into mechanical energy.
 The DC motor achieves this by producing a continuous angular rotation that
can be used to rotate pumps, fans, compressors, wheels, etc.
 The DC Motor is the most commonly used actuator for producing
continuous movement and whose speed of rotation can easily be
controlled, making them ideal for use in applications were speed control,
servo type control, and/or positioning is required.
 A DC motor consists of two parts, a “Stator” which is the stationary part
and a “Rotor” which is the rotating part. The result is that there are
basically three types of DC Motor available.
Relay
 Relays are those devices which can be turned on/off by the application of a
low voltage across the relay terminals.
 Relays are commonly found in automatic control applications as they are
able to control an equipment with the help of electric signals.
 According to the mode of operation, relays can be classified as normally
open and normally closed.
 In the normally open relays, the contacts are connected when the
actuation terminals are energized while in normally closed relays, it is
connected to the power supply when the relay actuation terminals are not
connected.
 There are relays with high current capacity and they are called contactors.
 There is single pole single throw (SPST) relay, double pole single throw
(DPST) relay, single pole double throw (SPDT) and double pole double
throw (DPDT) relays as in the case of mechanical switches.
Relay
Sensor to Actuator Flow

 In typical IoT systems, a sensor may collect information and route to a


control center where a decision is made and a corresponding command is
sent back to an actuator in response to that sensed input.
Example 1 – Temperature Control

 One well-known example of a controller is the temperature control of a


building in winter includes a heater (actuator), sensor (temperature
thermistor), and controller (thermostat).
 The controller switches the heater on when the temperature drops below a
certain level and switches the heater off when the temperature rises above
a certain level.
 A disturbance variable may be changes in the outside air temperature or a
change in indoor temperature due to a door opening.
Example 1
Example 2 – Automobile Speed Control
 Consider an automobile with an automatic cruise control.
 The driver may adjust the velocity set point for the controller.
 The controller adjusts the gas pedal position (actuator) in response to
changes in the speedometer reading (sensor).
 A disturbance variable may be an approaching hill or wind that would cause
a deviation of the speed from the desired set point.
Example 2
Write codes to read signal from sensors to
perform ON and OFF solenoid door lock
with a relay module
Please Follow Practical Work 2
Thank you
IoT
References

► http://www.home-automation-community.com/arduino-low-power-how-to-run-atmega328p
-for-a-year-on-coin-cell-battery/
► https://bbs.espressif.com/viewtopic.php?t=133
► https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/
► https://makeradvisor.com/esp32-vs-esp8266/
► https://randomnerdtutorials.com/arduino-vs-raspberry-pi-vs-beaglebone-vs-pcduino/
► https://www.researchgate.net/publication/309917878_Power_consumption_of_the_Raspbe
rry_Pi_A_comparative_analysis
► https://www.raspberrypi.org/documentation/configuration/security.md
► https://www.raspberrypi.org/magpi/raspberry-pi-3bplus-specs-benchmarks/
► https://frightanic.com/iot/comparison-of-esp8266-nodemcu-development-boards/
► https://jjssoftware.github.io/secure-your-esp8266/
► http://esp32.net/

You might also like