Assgnment
Assgnment
Assgnment
- Internet of Things integrates "everything" with the Internet every day. Computer engineers have
been adding sensors and processors to everyday objects since the 1990s. However, progress was
initially slow because the chips were large and bulky. Low-power computer chips called RFID tags
were first used to track expensive equipment. As the size of computing devices gradually shrinks,
these chips also become smaller, faster and smarter over time.
- The cost of integrating computing power into small devices today has decreased significantly. For
example, you can add connectivity with Alexa voice service features to MCUs with less than 1 MB
of built-in RAM, such as for light switches. An entire industry has suddenly emerged centered
around equipping every corner of our homes, businesses, and offices with IoT devices. These smart
devices can automatically transmit and receive data over the Internet. All of these “invisible
computing devices” and related technology are collectively known as the Internet of Things.
1.1.2. List the applications of IoT in various fields (suggestion: smart home, smart city...)
- Smart device
This is a device, like a television, security camera or exercise equipment that has been given
computing capabilities. The device collects data from its surroundings, user input, or usage patterns,
and transmits and receives data over the Internet from its IoT application.
- IoT applications
An IoT application is a collection of services and software that integrates data received from various
IoT devices. This app uses machine learning or artificial intelligence (AI) technology to analyze data
and make informed decisions. These decisions are transmitted back to the IoT device, and the IoT
device then intelligently responds to the input data.
- Smart home
Smart home devices focus primarily on improving the efficiency and safety of the home, as well as
the home network. Devices like smart electrical outlets can monitor electricity usage and smart
thermostats can provide better temperature control. Hydroponic systems can use IoT sensors to
manage the garden, while IoT smoke detectors can detect cigarette smoke. Home security systems
such as door locks, security cameras and water leak detectors can detect and prevent hazards, while
also sending warnings to the homeowner.
Families can use smart devices for the following purposes:
+ Automatically turn off devices when not in use.
+ Management and maintenance of rental properties.
+ Find lost items such as keys or wallets.
+ Automate daily tasks like vacuuming, making coffee, etc.
- A smart city
IoT applications have made urban planning and infrastructure maintenance more efficient.
Governments are using IoT applications to solve infrastructure, health and environmental problems.
IoT applications can be used for the following purposes:
+ Measure air quality and radiation levels.
+ Reduce energy costs thanks to smart lighting systems.
+ Determine when maintenance is needed on critical infrastructure such as roads, bridges and
pipelines.
+ Increase profits through effective parking management.
- Smart construction
Facilities such as university campuses and commercial buildings use IoT applications to promote
more efficient operations. Smart buildings can use IoT devices for:
+ Reduce energy consumption.
+ Reduce maintenance costs.
+ Utilize workspace more effectively.
1.2 Review standard architecture, frameworks, tools, hardware, and APIs available for use in IoT
development.
1.2.1. Some architectures for IoT systems, (suggested 3 layers, 5 layers)
1. 3-Layer Model:
- Application (Application Layer): User interface, data management and user interaction.
- Logic (Logic Layer): Logic processing, law management and business decisions.
- Bottom (Device Layer): Physical devices, sensors, and embedded systems.
2. 5-Layer Model:
- Application (Application Layer): User interface and specific applications.
- Service Management Layer: Manage services and interactions between applications and services.
- Data Management Layer: Store and manage data collected from devices.
- Device Management Layer: Manage subscriptions, update firmware, and monitor the status of
devices.
Device Layer: Devices and sensors collect data and perform functions.
1.2.2. Briefly present at least 2 frameworks or frameworks for IoT.
1. IoTivity (Open Connectivity Foundation - OCF):
- Description: IoTivity is an open source framework developed by the Open Connectivity
Foundation (OCF), an organization focused on building connectivity standards for the Internet of
Things (IoT). It provides an infrastructure for connection and communication between IoT devices,
making them compatible with each other in a standard way.
- Advantage:
+ High Standards and Compatibility: IoTivity complies with OCF standards, ensuring compatibility
between devices from different manufacturers.
+ High Security: Supports strong security mechanisms, including authentication and data
encryption.
2. Node-RED:
- Description: Node-RED is an open source browser-based platform, designed to help developers
build workflows for IoT systems easily. Developed on Node.js, Node-RED uses a "thread" and
"node" model to connect and process data between devices and services.
- Advantage:
+ Easy to Use: Intuitive interface with drag and drop buttons helps developers create workflows
quickly.
+ Rich Node Library: A wide range of nodes and extensions are available for easy integration with a
variety of IoT devices and services.
1.2.3. Presents common hardware to develop a simple IoT system. (hint ESP, Arduino)
1. ESP8266 and ESP32:
- ESP8266:
- Description: Microcontroller with integrated Wi-Fi, popular in simple IoT applications. Provides
GPIO, ADC, SPI, I2C and other embedded features.
- Advantages: Low energy consumption, low price, large community support.
- ESP32:
- Description: Improved version of ESP8266 with many extended features such as Bluetooth Low
Energy (BLE), multi-core mode, and multiple connection ports.
- Advantages: Integrated Wi-Fi and Bluetooth, high performance, multitasking.
2. Arduino Boards:
- Arduino Uno:
- Description: Popular board with ATmega328P MCU, multiple GPIOs, USB ports and easy to use
for beginners.
- Advantages: Simple, supports many libraries and expansion modules.
- Arduino Nano:
- Description: Compact version of Arduino Uno, suitable for projects that require small size.
- Advantages: Compact, easy to integrate into the project.
3. Raspberry Pi:
- Raspberry Pi 4:
- Description: Embedded computer with Broadcom BCM2711 CPU, up to 8GB RAM, supports Wi-
Fi and Bluetooth connectivity.
- Advantages: Powerful, supports Linux operating system, many connection ports.
4. Particle Boards (Photon, Electron):
- Particle Photons:
- Description: Board with built-in Wi-Fi, online IDE and Particle cloud service integration.
- Advantages: Easy to use, fast Wi-Fi connection.
- Particle Electrons:
- Description: Board with Cellular connection, allowing internet access everywhere.
- Advantages: Wireless Internet connection, mobile support.
5. Adafruit Feather Series:
- Adafruit Feather HUZZAH ESP8266:
- Description: Compact board with integrated ESP8266, LiPo port, and many embedded features.
- Advantages: Compact, supports many sensors and modules.
- Adafruit Feather M0 WiFi:
- Description: Uses ATSAMD21G18 microcontroller, has built-in Wi-Fi, and rechargeable battery.
- Advantages: Flexible, supports many types of connections.
1.3 Analyse the impact of common IoT architecture, frameworks, tools, hardware, and APIs in the
software development lifecycle.
- IoT architecture:
- The 3-layer architecture of IoT includes the following layers:
+ Device layer: This layer includes IoT devices, such as sensors, controllers, and communication
devices.
+ Intermediate layer: This layer includes intermediary systems, such as gateway, broker and cloud.
+ Application layer: This layer includes IoT applications, such as mobile applications, web
applications, and enterprise applications.
- 3-layer architecture has a number of advantages such as:
+ Clearly separate the roles of classes: This helps the development process be more independent,
less dependent on each other.
+ Provides scalability: The 3-layer architecture can be easily scaled to meet the needs of large IoT
applications.
+ Enhanced security: 3-layer architecture can help increase security for IoT systems.
- Hardware
Hardware is the hardware of the IoT system. Off-the-shelf hardware helps speed up software
development, focusing on solving problems instead of having to develop new hardware and then
develop software.
- Frameworks
A framework is a set of tools and libraries that help develop software quickly and efficiently.
Frameworks available for IoT can help reduce development time and effort, especially for complex
IoT applications.
- Tools
Tools are tools that support software development. Tools available for IoT can help developers solve
specific tasks during development, such as device management, data collection, data analysis, and
security.
- APIs
APIs are application programming interfaces that allow applications to communicate with each
other. APIs available for IoT can help developers easily connect IoT applications to each other and
to other systems.
- Evaluate the impact of the above factors in the software development life cycle
The above factors have a significant impact on the IoT software development lifecycle. Specifically,
these factors can impact the following stages of the software development life cycle:
+ Requirements analysis phase: IoT architecture, hardware, and APIs can help developers better
understand IoT application requirements.
+ Design phase: IoT architecture, frameworks and tools can help developers design IoT applications
more effectively.
+ Deployment phase: Hardware and APIs can help developers deploy IoT applications more quickly
and easily.
+ Maintenance phase: Hardware, APIs and frameworks can help developers maintain IoT
applications more easily.
II. Outline a plan for an appropriate IoT applicaPon, using common architecture, frameworks, tools,
hardware, and APIs.
2.1 InvesPgate architecture, frameworks, tools, hardware, and API techniques available to develop
IoT applicaPons.
- Three frameworks and platforms to develop an IoT application are: Arduino IoT Cloud,
ThingSpeak, Microsoft Azure IoT Suite.
1. Arduino IoT Cloud:
1.1 Advantages:
+ Easy to Use: Simple interface, easy to use for beginners.
+ Strong Compatibility: Supports many different types of Arduino boards and devices.
+ Easy Connection: Supports connection protocols such as MQTT.
1.2 Disadvantages:
+ Limited Features: For complex IoT projects, some advanced features may be lacking.
+ Limited Customization: Does not allow extensive customization if you want to control specific
hardware.
2. ThingSpeak:
2.1 Advantages:
+ Easy to Deploy: Provides cloud services, helping to deploy applications quickly.
+ Easy Data Integration: Supports integrating and displaying data from many different sources.
+ Community Support: There is a large user community, with many documents and examples.
2.2 Disadvantages:
+ Limited Free Features: Premium features may require usage fees.
+ Scalability: For large and complex applications, ThingSpeak may not be powerful enough.
3. Microsoft Azure IoT Suite:
3.1 Advantages:
+ Service Integration: Provides a range of services for IoT application development and deployment.
+ Strong Security: Pay special attention to the security aspect of IoT applications.
+ Diverse Platform Support: Supports a variety of devices and platforms.
3.2 Disadvantages:
+ Complicated and Heavy: For beginners, it can feel complicated and heavy.
+ Cost: Services can have significant costs, especially when implementing premium features.
2.2 Discuss a specific problem to solve using IoT.
- The specific problem that Tfarm company is facing is the ability to effectively manage and care for
each type of clean agricultural crop in an optimal way. Each type of plant requires different care
conditions in terms of humidity, pH, and amount of fertilizer. Traditional labor is not only expensive
but also does not ensure efficiency and uniformity in the care process.
- The solution to this problem is to deploy IoT solutions to automate crop care processes. This can
be done through the use of sensors that measure soil moisture, measure pH, and monitor fertilizer
needs for each type of plant. These sensors will be installed directly at the crop location to monitor
environmental conditions at each specific point.
- Data from sensors will be collected and transmitted to the IoT system of BKS-IOT company. From
there, the management software will automatically adjust watering equipment and provide fertilizer
based on the specific requirements of each type of plant. This helps optimize resources, reduce labor
costs, and at the same time provide precision care to achieve the highest crop quality.
- Furthermore, IoT technology also allows remote monitoring. Thanks to this system, Tfarm
employees can monitor and control the condition of crops from anywhere, helping them quickly
react and make adjustments if any problems arise.
III. Develop an IoT applicaPon using any combinaPon of hardware, soÖware, data, plaäorms, and
services.
3.1 Employ an appropriate set of tools to develop a plan into an IoT application.
- Hardware:
+ ESP32 (MiccroPython)
+ Sensor: DHT22 (temperature, humidity) air, motion sensor
+ Actuator: led, motor (pump simulation)
+ Motion sensor: alarm detection (night activation)
+ Simulate the system on Wokwi: https://wokwi.com/projects/392790280171867137
- Software:
+ WebApp: written in JS
+ Platform: ThingSpeak (Temperature and humidity monitoring)
+ HiveMQ: MQTT Broker (MQTT server) – free
- Tools
+ Visual Studio Code
- Deployment:
- Code:
from machine import Pin
import dht
import uasyncio
import time
from internet import connect_wifi
import requests
import ntptime
from my_mqtt import *
from umqtt.simple import MQTTClient
d = dht.DHT22(Pin(12))
led1.on()
led2.on()
connect_wifi()
ntptime.settime()
print("Connecting to MQTT server...", end="")
client = MQTTClient(MQTT_CLIENT_ID, MQTT_BROKER, user = MQTT_USER, password =
MQTT_PASSWORD)
client.connect()
print('MQTT connected')
client.set_callback(m_callback)
client.subscribe("Duong/IoT/ASM")
hour = time.localtime()[3]
hour = (hour + 7) % 24
if(hour >= 1 and hour <= 6):
v = motion_sensor.value()
if(v == 1):
led_motion.on()
else:
led_motion.off()
await uasyncio.sleep(1)
async def get_command_from_user():
while True:
client.check_msg()
await uasyncio.sleep(0.5)
loop = uasyncio.get_event_loop()
loop.create_task(update_env_to_thingspeak())
loop.create_task(detect_motion_and_alert())
loop.create_task(get_command_from_user())
loop.run_forever()
res = requests.get(f'http://api.thingspeak.com/update?
api_key=JDLJ6WMVPBTQ1XWE&field1={t}&field2={h}')
del res
await uasyncio.sleep(30)
- Code:
# Receive control commands from the user
async def get_command_from_user():
while True:
client.check_msg()
await uasyncio.sleep(0.5)
- Give comments on the product (should get cross comments from other students in the class)
+ Flexibility: Some of you have suggested that the product is highly flexible, allowing for
customization and expansion to suit the specific needs of each crop. This is highly appreciated
because it helps users optimize the care process for each type of plant in the most effective way.
+ Ease of use: The consensus was that the product's user interface was easy to use and user-friendly.
This reduces the time and effort needed to train employees to use the product, especially for those
without technology experience.
+ Performance: There is positive feedback on the product's performance, especially in optimizing
water and fertilizer use. Some of you have noted that the product has helped them save costs and
increase crop production.
IV. Evaluate your IoT applicaPon and the problems it might encounter when integraPng into the
wider IoT ecosystem.
4.1. Review the IoT applicaPon, detailing the problems it solves
- Process automation: The product has helped automate the crop care process, minimizing
dependence on human labor and optimizing the use of resources such as water and fertilizer.
- Remote management: Remote monitoring capabilities through software have helped managers
effectively monitor and adjust crop care processes from anywhere with an internet connection.
- Optimize care: The product provides accurate information about soil moisture, pH and watering
and fertilizer needs of plants, helping users to adjust care more optimally and accurately. .
V. Reference
https://aws.amazon.com/vi/what-is/iot/