1. 3/23/2023 1
Develop and Design an IoT Solution for
Real-World Problems
Lecture 3
INTERNET OF THINGS (IOT)(CSE334)
Head of Cyber Security and Data Analytics Engineering Program
Faculty of Electronic Engineering
Menoufia University
Menoufia University
Faculty of Electronic Engineering
Cyber Security and Data Analytics Engineering Program
Internet of Things (IoT)(CSE334)
2. Agenda
Processes in Controlled Systems
Summary
Steps to Create an IoT System
Engineering Design Process
3/23/2023 2
Microcontroller-Based Project Development Cycle
Microcontroller-based Control System
INTERNET OF THINGS (IOT)(CSE334)
4. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 4
◦ The engineering design process is a proven
method.
◦ The five steps are cyclical which means that
they can be repeated as many times as
needed to make improvements in the design
process.
◦ Inspire/Empathize
◦ Define/Ideate
◦ Prototype
◦ Test/Refine
◦ Present/Communicate.
Engineering Design Process
6. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 6
Project Overview
◦ Identify a problem that can be solved by an IoT device.
◦ Example used: building a device that senses the amount of light
and determines sunrise and sunset.
The Circuit Layout
◦ Electronic components have specific power, polarity, and
connection requirements.
◦ The circuit layout identifies/describes these requirements.
◦ Sunrise/sunset example requires a voltage divider - produces an
output voltage that is a fraction of its input voltage by
distributing the input voltage among the components of the
divider.
StepstoCreateanIoTSystem
7. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 7
REST API in an IoT System
◦ REST APIs use HTTP methods to exchange data between systems or applications
◦ RESTful systems use Uniform Resource Identifiers (URIs) to represent their services to
external systems.
◦ Sample URIs:
◦ GET /people/michael to receive Michael's user profile dataset
◦ POST /people/michael to update Michael’s profile with new data.
◦ The IFTTT web service allows for special resource URIs to be created and mapped to
specific IFTTT actions.
◦ Example IFTTT URI - https://maker.ifttt.com/trigger/SunRise/with/key/
◦ The sunrise/sunset example uses both IFTTT and Google Calendar services
StepstoCreateanIoTSystem(Cont.)
8. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 8
Flowcharts, Electronic Schematics, and Sequence Diagrams
◦ Documenting project is very important for building the devices, testing,
troubleshooting, and creating a business model.
◦ Flowcharts use standardized symbols to represent the processes
and workflows.
◦ Electronic schematics is a graphical representation of a circuit
diagram using internationally standardized components.
◦ Sequence diagrams represent interactions between entities along a
timeline.
StepstoCreateanIoTSystem(Cont.)
9. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 9
The Code
• The sunrise/sunset example is written in Python using a Raspberry Pi
• The Arduino is connected to the Raspberry Pi.
• The programming is done on the Raspberry Pi to send the level of
voltage drop from the Arduino to the RaPi.
• Firmata, a generic protocol for communicating with microcontrollers,
is used to communicate between the Arduino firmware and the RaPi.
• The Python code used for the sunrise/sunset example is explained
line by line.
StepstoCreateanIoTSystem(Cont.)
10. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 10
Prototyping and testing System
◦ Create electronic schematic, flowchart, and sequence diagram
for prototype
◦ Packet Tracer 7 used to create and test the
prototype.
◦ Update documentation once prototype works
successfully.
◦ Documenting is important not only for future
reference but also for situations where
marketing material or patent applications are
to be created.
StepstoCreateanIoTSystem(Cont.)
12. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 12
ControlledSysteminIoT
Overview of a Controlled System
• Feedback loops are used to provide real-time information to its controller based on current behavior.
• In a closed loop, feedback is continuously being received by the controller from its sensors.
• The controller continuously analyzes and processes information, and use actuators to modify conditions.
Sensors
• A sensor is a device that can be used to measure a physical property by detecting some type of information
from the physical world.
• A sensor may be connected to a controller either directly or remotely.
13. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 13
Actuators
• An actuator is a basic motor that can be used to control a system.
• Can be hydraulic, electric or pneumatic.
• can be responsible for transforming an electrical signal into physical output.
Controllers
• Responsible for collecting data from sensors and providing network connectivity.
• Controllers may have the ability to make immediate decisions.
• May also send data to remote and more powerful computer for analysis.
IoT Process Flow
• A simple IoT system include sensors connecting, through a wireless
or wired connection, to actuators or controllers.
• Some devices can have more than one function.
ControlledSysteminIoT(Cont.)
14. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 14
ProcessesinControlledSystems
Processes
• A process is a series of steps or actions taken to
achieve a desired result by the consumer of the
process.
Feedback
• Feedback is when the output of a process affects the input.
• Feedback is often referred to as a feedback loop.
Control Systems
• Includes a controller that uses inputs and outputs to manage and regulate the behavior of the
system in an attempt to achieve a desired state.
• The controlled portion of the system is often called the plant.
• Choosing the adjustments to apply to a plant to achieve a desired output is called control
theory.
• Control theory is applied to many systems, including driving a car.
15. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 15
ProcessesinControlledSystems(Cont.)
Open-Loop Control Systems
• Open-loop control systems do not use feedback.
• The plant performs a predetermined action without any verification of the desired results.
• Open-loop control systems are often used for simple processes.
Closed-Loop Control Systems
• A closed-loop control system uses feedback to determine whether the collected output is the desired output.
• The result is then fed back into a controller to adjust the plant for the next iteration of output, and the
process repeats.
17. Cloud Based Application ‘IoT’ using Microcontroller
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 17
18. 3/23/2023 INTERNET OF THINGS (IOT)(CSE334) 18
Microcontroller-BasedProjectDevelopmentCycle
19. Microcontroller-Based Project Development Cycle
Microcontroller-based project development cycle has two stages:
Program Development Cycle (PDC)
Hardware Development Cycle (HDC)
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 19
33. It is required to write a program to convert hexadecimal
numbers “A” to “F” into decimals. Show the algorithm using a
PDL and also draw the equivalent flow chart. Assume that the
hexadecimal number to be converted is called HEX_NUM, and
the output decimal number is called DEC_NUM.
EXAMPLE 1
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 33
34. Solution 1
The required PDL is:
BEGIN
IFHEX_NUM = “A” THEN
DEC_NUM=10
ELSE IFHEX_NUM = “B” THEN
DEC_NUM=11
ELSE IFHEX_NUM = “C” THEN
DEC_NUM = 12
ELSE IFHEX_NUM = “D” THEN
DEC_NUM = 13
ELSE IFHEX_NUM= “E” THEN
DEC_NUM=14
ELSE IFHEX_NUM =“F” THEN
DEC_NUM=15
ENDIF
END
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 34
36. It is required to write a program to calculate the sum of
integer numbers between 1 and 100. Show the required
algorithm using a PDL and also draw the equivalent flow
chart. Assume that the sum will be stored in variable
called SUM.
EXAMPLE 2
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 36
38. An LED is connected to a microcontroller output port.
Additionally a button is connected to one of the input
ports. It is required to turn ON the LED when the button
is pressed, and otherwise to turn OFF the LED. Show the
required algorithm using a PDL and also draw the
equivalent flow chart.
EXAMPLE 3
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 38
39. BEGIN
DO FOREVER
IF Button is pressed THEN
Turn ON LED
ELSE
Turn OFF LED
ENDIF
ENDDO
END
Solution 3
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 39
40. An analog temperature sensor is connected to one of the
analog-to-digital (ADC) input ports of a microcontroller.
Additionally, an LCD display is connected to the output
ports. It is required to read the temperature every second
and then display on the LCD. Show the required algorithm
using a PDL and also draw the equivalent flow chart.
Assume that the display routine is a subprogram called
DISPLAY.
EXAMPLE 4
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 40
41. BEGIN
DO FOREVER
Read Temperature from ADC port
CALL DISPLAY
Wait 1 second
ENDDO
END
BEGIN/DISPLAY
Display temperature on LCD
END/DISPLAY
Solution 4
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 41
43. Engineering Design Process
In This presentation, we covered:
Summary
Steps to Create an IoT System
Processes in Controlled Systems
Microcontroller-based Control System
Microcontroller-Based Project Development Cycle
INTERNET OF THINGS (IOT)(CSE334)
3/23/2023 43
IFTTT derives its name from the programming conditional statement “if this, then that.” What the company provides is a software platform that connects apps, devices and services from different developers in order to trigger one or more automations involving those apps, devices and services.