0% found this document useful (0 votes)
221 views32 pages

Question Bank Solutions (Module-5) - IOT - 15CS81

The document discusses a question bank with solutions for an Internet of Things Technology course. It includes questions and answers about the Arduino UNO board, the Raspberry Pi board, and a wireless temperature monitoring system using Raspberry Pi and ThingSpeak. It also summarizes a smart city IoT architecture with a four layered structure including a street layer with sensors, a city network layer, a data center layer, and a services layer.

Uploaded by

Sai Suhas Mk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
221 views32 pages

Question Bank Solutions (Module-5) - IOT - 15CS81

The document discusses a question bank with solutions for an Internet of Things Technology course. It includes questions and answers about the Arduino UNO board, the Raspberry Pi board, and a wireless temperature monitoring system using Raspberry Pi and ThingSpeak. It also summarizes a smart city IoT architecture with a four layered structure including a street layer with sensors, a city network layer, a data center layer, and a services layer.

Uploaded by

Sai Suhas Mk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 32

Prof.

Manoj Challa

CMR Institute of Technology, Bangalore

Department(s): Computer Science & Engineering

Semester: 08 Section(s): A&C Lectures/week: 04

Subject: Internet of Things Technology Code: 17CS81

Course Instructor(s): Dr.Manoj Challa

Question bank with Solutions


Module – 5
1. Give a brief notes on Arduino UNO.
Arduino is a prototype platform (open-source) based on an easy-to-use hardware and
software. It consists of a circuit board, which can be programed (referred to as a
microcontroller) and a ready-made software called Arduino IDE (Integrated
Development Environment), which is used to write and upload the computer code to the
physical board. Arduino provides a standard form factor that breaks the functions of the
micro-controller into a more accessible package. A microcontroller board, contains on-board
power supply, USB port to communicate with PC, and an Atmel microcontroller chip. It
simplify the process of creating any control system by providing the standard board that
can be programmed and connected to the system without the need to any sophisticated
PCB design and implementation.

• The Arduino software is easy-to-use for beginners, yet flexible enough for advanced
users. It runs on Mac, Windows, and Linux.
• Inexpensive 

• Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX, and
Linux operating systems. Most microcontroller systems are limited to Windows.

• Simple, clear programming environment - The Arduino Software (IDE) is easy-to-use for
beginners

• Open source and extensible software - The Arduino software is published as open source
tools, available for extension by experienced programmers. 

• Open source and extensible hardware - The plans of the Arduino boards are published
under a Creative Commons license, so experienced circuit designers can make their own
version of the module, extending it and improving it.

The key features are −

• Arduino boards are able to read analog or digital input signals from different sensors and
turn it into an output such as activating a motor, turning LED on/off, connect to the cloud
and many other actions.

• You can control your board functions by sending a set of instructions to the
microcontroller on the board via Arduino IDE (referred to as uploading software).

• Unlike most previous programmable circuit boards, Arduino does not need an extra piece
of hardware (called a programmer) in order to load a new code onto the board. You can
simply use a USB cable.

• Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn
to program.

• Finally, Arduino provides a standard form factor that breaks the functions of the micro-
controller into a more accessible package.

• Various kinds of Arduino boards are available depending on different microcontrollers


used. However, all Arduino boards have one thing in common: they are programed
through the Arduino IDE. The differences are based on the number of inputs and outputs
Prof.Manoj Challa

(the number of sensors, LEDs, and buttons you can use on a single board), speed,
operating voltage, form factor etc. Some boards are designed to be embedded and have
no programming interface (hardware), which you would need to buy separately. Some
can run directly from a 3.7V battery, others need at least 5V.
Prof.Manoj Challa

2. With neat diagram explain Raspberry Pi board.


Raspberry Pi is a small single board computer. By connecting peripherals like Keyboard,
mouse, display to the Raspberry Pi, it will act as a mini personal computer. Raspberry Pi
is popularly used for real time Image/Video Processing, IoT based applications and
Robotics applications. Raspberry Pi is more than computer as it provides access to the
on-chip hardware i.e. GPIOs(A general-purpose input/output) for developing an
application. By accessing GPIO, we can connect devices like LED, motors, sensors, etc
and can control them too. It has ARM based Broadcom Processor SoC(System-on-Chip)
along with on-chip GPU (Graphics Processing Unit). The CPU speed of Raspberry Pi
varies from 700 MHz to 1.2 GHz. Also, it has on-board SDRAM that ranges from 256
MB to 1 GB. Raspberry Pi also provides on-chip SPI(serial peripheral interface) and
UART (Universal Asynchronous Receiver/Transmitter )modules.

The Raspberry Pi has a number of ports which you will use to control the Raspberry Pi,
and it can use to control other devices. Your Raspberry Pi will have the following ports:
Prof.Manoj Challa

• USB – USB ports are used to connect a wide variety of components, most commonly a
mouse and keyboard.

• HDMI – The HDMI port outputs video and audio to your monitor.

• Audio – The audio jack allows you to connect standard headphones and speakers.

• Micro USB – The Micro USB port is only for power, do not connect anything else to this
port. Always connect the power after you have already connected everything else.

• GPIO – The GPIO ports allow the Raspberry Pi to control and take input from any
electronic component.

• SD card slot – The Raspberry Pi uses SD cards the same way a full-size computer uses a
hard drive. The SD card provides the Raspberry Pi with internal memory, and stores the
hard drive.

• The serial interface on Raspberry Pi has receive(rx) and transmit(Tx) pins for
communication with serial peripherals.

• Serial Peripheral Interface(SPI) is a synchronous serial data protocol used for


communicating with one or more peripheral devices.

• The I2C interface pins on Raspberry Pi allow you to connect hardware modules. I2C
interface allows synchronous data transfer with just two pins-SDA(data line) and
SCL(clock line).

3. With neat diagram, explain wireless temperature monitoring system using


Raspberry Pi.
Internet of Things (IoT) has provided a promising opportunity to build powerful industrial
systems and applications by leveraging the growing ubiquity of RFID, wireless, mobile and
sensor devices. A wide range of industrial IoT applications have been developed and
deployed in recent years. In an effort to understand the development of IoT in industries, this
paper reviews the current research of IoT, key enabling technologies, major IoT applications
in industries and identifies research trends and challenges. A main contribution of this
review paper is that it summarizes the current state-of-the-art of IoT in industries
systematically.The advancement of Automation technology, life is getting simpler and easier
in all aspects. In today’s world Automatic systems are being preferred over manual system.
With the rapid increase in the number of users of internet over the past decade has made
Internet a part and parcel of life, and IoT is the latest and emerging internet technology.
Internet of things is a growing network of everyday object-from industrial machine to
consumer goods that can share information and complete tasks while you are busy with other
activities. This paper proposes that the industrial monitoring by using Gas sensor,
Temperature sensor,Mems, Piezoelectric Sensor values to read the value and monitoring
usingThingspeak system via Raspberry pi.
ThingSpeak is an application platform for the Internet of Things. ThingSpeak allows
you to build an application around data collected by sensors. At the heart of ThingSpeak is a
ThingSpeak Channel. A channel is where you send your data to be stored. Each channel
includes 8 fields for any type of data, 3 location fields, and 1 status field. Once you have a
ThingSpeak Channel you can publish data to the channel, have ThingSpeak process the data,
and then have your application retrieve the data.
Existing System
Manually Monitoring the Industrial application
By using the GSM technology, it will take more time to get the exact situation
CCTV camera monitoring is possible but cant able to sense the gas, temperature,and position
of the valves.
Proposed System
The Internet of Things is regarded as the third wave of information technology after Internet
and mobile communication network, which is characterized by more thorough sense and
measure, more comprehensive interoperability and intelligence.
IOT Consumes the time and monitoring the exact situation.

Hardware
Raspberry pi
Temperature Sensor
Prof.Manoj Challa

Gas Sensor
Mems Sensor
Piezoelectric Sensor
Software 
OS:Raspbian OS
Python Language
Advantages
Decreased field damaging conditions
Improved safety and security
High quality receiving data
Less power consumption
High speed data rate
Applications 
Industry  Monitoring
Home Automation
Medical Industry

4. Explain in detail smart city IOT architecture.


A smart city IoT infrastructure is a four-layered architecture –
• Data flows from devices at the street layer

• to the city network layer and connect to the

• data center layer, where the data is aggregated, normalized, and virtualized.

• The data center layer provides information to the services layer, which consists of the
applications that provide services to the city.
• Street layer is composed of devices and sensors that collect data and take action
based on instructions. A sensor is a data source that generates data required to
understand the physical world. A magnetic sensor can detect a parking event by
analyzing changes in the surrounding magnetic field when a heavy metal object,
such as a car or a truck, comes close to it (or on top of it). A lighting controller can
dim and brighten a light based on a combination of time-based and ambient
conditions. Video cameras combined with video analytics can detect vehicles,
faces, and traffic conditions for various traffic and security use cases. An air
quality sensor can detect and measure gas and particulate matter concentrations to
give a hyper-localized perspective on pollution in a given area.

• At the city layer, which is above the street layer, network routers and switches.
Must be deployed to match the size of city data that needs to be transported. This
layer aggregates all data collected by sensors and the end-node network into a
single transport network. City layer must be built around resiliency(recover) to
ensure that a packet coming from a sensor or a gateway will always be forwarded
successfully

• Data Centre Layer - Data collected from the sensors is sent to a data center, where it can
be processed and correlated. Based on this processing of data, meaningful information
Prof.Manoj Challa

and trends can be derived, and information can be provided back. An application in a data
center can provide a global view of the city traffic and help authorities decide on the need
for more or less common transport vehicles. The cloud model is the chief means of
delivering storage, virtualization, Adaptability, and the analytics know-how that city
governments require for technological mash-up and synergy of information embodied in
a smart city.

• Services Layer - The true value of ICT connectivity comes from the services that the
measured data can provide to different users operating within a city. The collected data
should be visualized according to the specific needs of each consumer of that data and the
particular user experience requirements and individual use cases. Example, parking data
indicating which spots are and aren’t currently occupied can drive a citizen parking app
with a map of available spots, as well as an enforcement officer ’s understanding of the
state (utilization and payment) of the public parking space, while at the same time
helping the city operator ’s perspective on parking problem areas.

5. Explain about Arduino installing software.


Download Arduino compiler and development environment from -
http://arduino.cc/en/Main/Software (Current version: 1.0.1)
Available for: Windows, MAC, Linux
Before running Arduino, plug in your board using USB cable (external power is not
necessary). When USB device is not recognized, navigate to and select the appopriate
driver from the installation directory.
Step 1 − First you must have your Arduino board (you can choose your favorite board)
and a USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino
Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the
kind you would connect to a USB printer as shown in the following image.

In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in
the following image.

Step 2 − Download Arduino IDE Software.

You can get different versions of Arduino IDE from the Download page on the Arduino Official
website. You must select your software, which is compatible with your operating system
(Windows, IOS, or Linux). After your file download is complete, unzip the file.
Prof.Manoj Challa

Step 3 − Power up your board.


The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power
from either, the USB connection to the computer or an external power supply. If you are
using an Arduino Diecimila, you have to make sure that the board is configured to draw
power from the USB connection. The power source is selected with a jumper, a small
piece of plastic that fits onto two of the three pins between the USB and power jacks.
Check that it is on the two pins closest to the USB port.
Connect the Arduino board to your computer using the USB cable. The green power
LED (labeled PWR) should glow.
Step 4 − Launch Arduino IDE.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the
folder, you can find the application icon with an infinity label (application.exe). Double-
click the icon to start the IDE.

Step 5 − Open your first project.


Once the software starts, you have two options −
 Create a new project.
 Open an existing project example.
To create a new project, select File → New.

To open an existing project example, select File → Example → Basics → Blink.

Here, we are selecting just one of the examples with the name Blink. It turns the LED on
and off with some time delay. You can select any other example from the list.
Step 6 − Select your Arduino board.
To avoid any error while uploading your program to the board, you must select the
correct Arduino board name, which matches with the board connected to your computer.
Go to Tools → Board and select your board.
Prof.Manoj Challa

Here, we have selected Arduino Uno board according to our tutorial, but you must select
the name matching the board that you are using.
Step 7 − Select your serial port.
Select the serial device of the Arduino board. Go to Tools → Serial Port menu. This is
likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial
ports). To find out, you can disconnect your Arduino board and re-open the menu, the
entry that disappears should be of the Arduino board. Reconnect the board and select that
serial port.
Step 8 − Upload the program to your board.
Before explaining how we can upload our program to the board, we must demonstrate
the function of each symbol appearing in the Arduino IDE toolbar.

A − Used to check if there is any compilation error.


B − Used to upload a program to the Arduino board.
C − Shortcut used to create a new sketch.
D − Used to directly open one of the example sketch.
E − Used to save your sketch.
Prof.Manoj Challa

F − Serial monitor used to receive serial data from the board and send the serial data to
the board.
Now, simply click the "Upload" button in the environment. Wait a few seconds; you will
see the RX and TX LEDs on the board, flashing. If the upload is successful, the message
"Done uploading" will appear in the status bar.
Note − If you have an Arduino Mini, NG, or other board, you need to press the reset
button physically on the board, immediately before clicking the upload button on the
Arduino Software.

6. Explain the steps to installing Raspberry Pi.


Steps to setup your RPi Each of the following steps is detailed in the subsequent slides.
Step 1: SD Card Setup
 RPi will NOT start without a properly formatted SD Card (with a bootloader and
suitable OS).
 Two of the most important RPi OS options are Raspbian (based on Debian) and
Pidora (based on Fedora)
 IMPORTANT - The formatted SD Card has to be inserted before powering the
RPi; and the RPi has to be shut down before unplugging the card.
 Ways to setup the SD card: Easy/ Safe way – Buy a preloaded card from a
reputable supplier (Available for sale http://swag.raspberrypi.org/ and
https://thepihut.com/.
 There have been reports of problems with SD cards purchased from ebay or
Amazon so be cautious if buying from there)
 Create your own SD card for Rpi • Using NOOBS • Flashing the SD Card using
Windows, Mac, or Linux.
 NOOBS (New Out Of Box Software) is an easy way to install RPi distributions.
 It is a 1 GB download compared to the 500 MB size of images used for flashing.
 Download NOOBS from the raspberrypi.org downloads page
 Insert a (4 GB+) SD Card into your computer •Format the disk using instructions
mentioned in notes for this slide. •If your monitor doesn’t work with NOOBS,
press 1-4 for the following troubleshooting options: Default HDMI Mode ◦
HDMI Safe Mode - Use this if Default (1) doesn't work and you cannot see
anything ◦ Composite PAL Mode - Use this or 4. if you are using the yellow and
black outputs on the opposite side to the HDMI output ◦ Composite NTSC Mode
Instructions for Windows •Using the Win32DiskImager program
1. Download the distribution from raspberrypi.org downloads page. Make sure
the distribution is for Raspberry Pi (it will mostly be a compressed file ending
in .zip or .gz). Extract this image.
2. Insert the SD card into your SD card reader and make note of what drive your
SD Card is assigned.
3. Download the Win32DiskImager utility from
https://sourceforge.net/projects/win32diskimager/ . This can be run from a
USB drive.
4. Extract the executable from the zip file and run the Win32DiskImager utility
(might need to ‘Run as Administrator’; Right-click on the file, and select 'Run
as Admin’).
5. If you see a file error when Win32DiskImager loadsv(in windows 7), ignore
the error.
6. Select the image file you extracted and the drive letter of SD card as shown
here
7. Click ‘Write’ and wait for write to complete. 8. Exit imager and eject SD card.
It can now be plugged into RPi. If you are unable to chose the device in
Win32DiskImager, try using ‘flashnul’ to do a similar installation.
Alternatively, you can use the Fedora ARM Installer to download and install
RPi Fedora Remix images
(http://fedoraproject.org/wiki/Fedora_ARM_Installer)

Step 2 : Raspberry Pi cabling


Push SD card into the SD card slot.
Plug the HDMI cable into the HDMI output of the Raspberry Pi and connect to the
TV/monitor.
Turn on monitor and switch to the HDMI port.
Insert the network cable and connect to the router.
Connect the keyboard and mouse via USB ports.
Plug the power supply into the micro USB.
The device is now ready for the next steps.

Step 3 : Booting your RPi for the first time


These steps are for the Debian distribution of Raspberry pi, Raspbian.
The first time you boot the Raspberry Pi you'll see a configuration tool called "raspi-
config.“
Prof.Manoj Challa

Calling “raspi-config” command from the terminal of your device will open this
configuration screen again, if you need to see it.
Select “expand_rootfs” and press enter (As shown in the images below). This option
expands the installed image to use the maximum available size of your SD card.
Select “configure_keyboard” from the main menu and press enter. From the list of
keyboard options that comes up, select your keyboard setup. If you are unable to find
your keyboard setup. Select the default 105-key option.
Select the keyboard layout as required
The last option to set in the Keyboard configuration is the ALT / CTRL / BACKSPACE
feature to kill X11. It is recommended that you enable this, so that in case your GUI ever
crashes you can safely kill it without rebooting.
Setting user password on your device.
From the main menu, select “change_pass” and press Enter. You will be prompted to
enter new UNIX password.
Set your “locale” which is the general character set used in your native language
(en_US.UTF-8 for USA). Set this as the default locale when prompted.
Set your timezone by selecting the “Change_timezone” option.
Select “Finish” and reboot. Once you are back online, you will see a login prompt like
this.

Step 4 : Load GUI environment to your RPi


Log in from the login prompt with the username “pi” and the password you set earlier.
After logging in, type “startx” to get the GUI environment loaded.
After a loading sequence, you will see a UI which looks similar to the Windows UI. It is
the LXDE Window Manager which is a light weight UI that runs well on Raspberry Pi.
After finishing the whole setup sequence, you now have your device powered up and the
LXDE WM running. You can now use this Pi for your projects, or for general computing
tasks.

Step 5 : Setup a network connection


Your device can be connected to the internet in the following different ways, depending
on the model you have used:
The LAN interface via Ethernet cable to your Internet router (Models B & B +, not the
A, A + and Zero)
If you are using the Ethernet option and your router is configured for DHCP, you should
be able to connect without any further configuration.
The built-in wireless card - Only the Raspberry Pi 3
A USB wireless dongle - available for all models
This option consumes more power than other options. If you are using this option, make
sure you have a power supply that can support it. Wifi can be setup using either the
command line or the graphical interface. Instructions on setting up wifi are available in
detail in this document : https://learn.adafruit.com/downloads/pdf/adafruits-
raspberrypi-lesson-3-network-setup.pdf
After completing this setup , you will have your device powered up and working as a full
fledged Linux box running Debian.

7. Explain about smart and connected cities.


The world is rapidly urbanizing, and this trend is slated to continue. Less than one-third
of the world’s population lived in cities in 1950; by 2050, two-thirds of our planet’s
population will be city dwellers. Africa and Asia, which today account for 90% of the
world’s rural population, are projected to have 56% and 64%, respectively, of their
populations urbanize. Today, the percentage of people in North America, Europe, Latin
America, and the Caribbean who live in cities already exceeds 70%. In terms of raw
numbers, the urban population of the world has grown to nearly 4 billion, from just 746
million in 1950. By 2050, this figure will grow by another 4.5 billion. New ideas emerge,
bringing different approaches to solving management issues. Scalable solutions utilizing
information and communications technology (ICT) can alleviate many issues urban
centers face today by increasing efficiency, which reduces costs and enhances quality of
life. Cities that take this approach are commonly referred to as smart cities.

• A recent Cisco study, expects IoT to have the following economic impact over a 10-year
period –Smart buildings, Gas monitoring, Smart parking, Water management, Road
pricing
Prof.Manoj Challa

• The main obstacle in implementing smart solutions in today’s traditional infrastructure is


the complexity of how cities are operated, financed, regulated, and planned. Cities
attempting to upgrade their infrastructure to match the growing needs of the citizen
population often invest in one problem at a time, and they do it independently.

The independent investment model results in the following problems:

• Isolation of infrastructure and IT resources.

• No sharing of intelligence and information, such as video feeds and data from sensors.

• Waste and duplication in investment and effort

• Difficulty scaling infrastructure management

• This fragmented approach is not scalable, efficient, or economically viable, and it does
not benefit from cross-functional sharing of data and services. For example, in traditional
city infrastructure, parking, lighting, and traffic departments are all administratively
independent and run separately, with their own budgets used to invest in upgrading their
respective infrastructures. This introduces duplication of investments made on the same
infrastructure, with only minor details tailored to specific department oversights. Cities
need to begin with a solution that can extend systems across vendors, technologies, and
data types, and they should approach their infrastructure investment with a horizontal
solution that addresses their issues cohesively. City issues are typically large-scale. They
require collection of large amounts of diverse data sets in real time. This means that data
from traffic sensors, traffic cameras, parking sensors, and more has to be collected and
analyzed in real time so that decision making can be optimized around signal timing,
rerouting, and so on.

All these requirements pose technological challenges, including the following:

• How do you collect the data? What are the various sources of data, including hardware
endpoints and software?

• How do you make sure that any data collection devices, such as sensors, can be
maintained without high costs?

• Where do you analyze the data? What data do you carry back to the cloud, and what data
do you analyze locally?

• What kind of network connectivity is best suited for each type of data to collect?

• What kind of power availability and other infrastructure, such as storage, is required?

• How do you aggregate data from different sources to create a unified view?

• How do you publish the data and make it available for applications to consume?

• How do you make the end analysis available to specialized smart city personnel, such as
traffic operators, parking enforcement officers, street lighting operators, and so on at
their logical decision points?

• How do you present the long-term analysis to city planners?

8. Outline the Fundamentals of Arduino Programming.


The structure of Arduino program is pretty simple. Arduino programs have a minimum of 2
blocks,
Preparation & Execution
Each block has a set of statements enclosed in curly braces:
void setup( )
{
statements-1;
statement-n;
}
The setup function is the first to execute when the program is executed, and this function is called
only once.
Prof.Manoj Challa

The setup function is used to initialize the pin modes and start serial communication. This
function has to be included even if there are no statements to execute.

Structure

Arduino programs can be divided in three main parts: Structure, Values (variables and
constants), and Functions.

Let us start with the Structure. Software structure consist of two main functions −

• Setup( ) function

• Loop( ) function
Data types in C refers to an extensive system used for declaring variables or functions of different
types. The type of a variable determines how much space it occupies in the storage and how the
bit pattern stored is interpreted. The following table provides all the data types that you will use
during Arduino programming.
Prof.Manoj Challa
Prof.Manoj Challa
Prof.Manoj Challa

Variables in C programming language, which Arduino uses, have a property called scope.

A scope is a region of the program and there are three places where variables can be declared.
They are −

Inside a function or a block, which is called local variables.

In the definition of function parameters, which is called formal parameters.

Outside of all functions, which is called global variables.

Local Variables

Variables that are declared inside a function or block are local variables. They can be used only
by the statements that are inside that function or block of code. Local variables are not known to
function outside their own. Following is the example using local variables −

Global Variables

Global variables are defined outside of all the functions, usually at the top of the program. The
global variables will hold their value throughout the life-time of your program.

A global variable can be accessed by any function. That is, a global variable is available for use
throughout your entire program after its declaration.

 An operator is a symbol that tells the compiler to perform specific mathematical or logical
functions. C language is rich in built-in operators and provides the following types of operators −
Prof.Manoj Challa

You might also like