100% found this document useful (2 votes)
499 views25 pages

How Is Arduino Uno Different From Other Available Microcontrollers?

The document discusses Arduino Uno and its programming. It begins by explaining how Arduino Uno differs from other microcontrollers in being open source, flexible, and easier to use. It then describes the components of the Arduino Uno board, including the microcontroller, pins, and power supply. Finally, it outlines the process of installing the Arduino IDE and the fundamentals of Arduino programming, including the setup and loop functions.

Uploaded by

Raghotham Rao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
499 views25 pages

How Is Arduino Uno Different From Other Available Microcontrollers?

The document discusses Arduino Uno and its programming. It begins by explaining how Arduino Uno differs from other microcontrollers in being open source, flexible, and easier to use. It then describes the components of the Arduino Uno board, including the microcontroller, pins, and power supply. Finally, it outlines the process of installing the Arduino IDE and the fundamentals of Arduino programming, including the setup and loop functions.

Uploaded by

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

INTERNET OF THINGS TECHNOLOGY 15CS81

MODULE 5

1. How is Arduino Uno different from other available microcontrollers?


Arduino is an open source product that is accessible and flexible for usage. It is flexible
because it has a variety of digital and analog pins, SPI and PWM outputs.
 It is easier to use as it could be connected to a computer via USB and
communication occurs via serial protocol.
 Arduino has a large community that actively contributes and resolves issues with
respect to various projects.
 It also follows a simple and clean programming language like C-Programming.
 Arduino Uno is considered better than the other available microcontrollers for the
following reasons:
 Its biggest advantage is that we connect the board to the computer via a USB cable
which does a dual purpose of supplying power and acting as a Serial port to
interface the Arduino and the computer.
 It can also be powered by a 9V-12V AC to DC adapter.
 One can directly load the programs into the device without the need of a hardware
programmer to burn the program.
 This is done because of the presence of the 0.5KB of boot loader, that allows the
program to be dumped into the circuit.
 The UNO has 20 separate input-output channels called pins, and all of those
channels could be used to read digital on-off type inputs. Six of those inputs can be
used to read analog inputs, like if you were turning a knob.
 Thus Arduino Uno for the above said reasons is different and better than the other
existing microcontrollers.

2. Describe Arduino Uno learning board with diagram


A microcontroller board based on the ATmega328P has 14 digital input/output pins (of
which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB
connection, a power jack, an ICSP header and a reset button.
Connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery
to get started. Figure 5.1 illustrates Arduino Uno learning board.
The Arduino Uno board is made up of the following components,
 Microcontroller: The ATmega328p is the Arduino brain. Everything on the
Arduino board is meant to support this microcontroller.
 Digital Pins: Arduino has 14 digital pins labeled from 0 to 13. They act as inputs or
outputs
 PWM pins: These digital pins marked with a ~ (pins 11, 10, 9, 6, 5 and 3). PWM
stands for “Pulse Width Modulation” which allows to make digital pins output
fake varying amounts of voltage.
 Tx and Rx pins: Digital Pins 0 and 1. The T stands for “Transmit” and R stands for
“Receive”

Module5 Page 1
INTERNET OF THINGS TECHNOLOGY 15CS81
 LED attached to digital pin 13: This is useful for easy debugging of arduino
sketches.
 Analog Pins: The analog pins are labelled A0 to A5. They are used to read analog
sensors.

Figure 5.1: Arduino Uno learning board


 Power Pins: The Arduino has 3.3v or 5v supply. These are useful since most
components require 3.3v or 5v power.
 Reset Button: When the button is pressed, the program currently running in the
arduino will start from beginning.
 Power ON LED: Will indicate if the power is supplied to arduino
 USB Jack: Connecting a male USB A to make USB B cable show one can upload
programs from computer to Arduino board.
 Power Jack: The power jack is where we connect the component to power up the
Arduino.
The things Arduino can do
1. Motion Sensor: It allows for detection of motion.
2. Light Sensor: It allows for measuring the quantity of light in the outside world.
3. Humidity and temperature Sensor: This is used to sense the humidity and
temperature.
4. Ultrasonic Sensor: This sensor allows determining distance to an object through
sonar.

3. Explain the installation procedure of Arduino IDE.


The Arduino Integrated Development Environment (IDE) is a cross-platform application
(for Windows, macOS, Linux) that is written in functions from C and C++. It is used to
write and upload programs to Arduino compatible boards, but also, with the help of 3rd

Module5 Page 2
INTERNET OF THINGS TECHNOLOGY 15CS81
party cores, other vendor development boards.
How to get started?
 Download and Install the open source Arduino IDE
 Connect the board to PC
 Launch the Arduino IDE
 Select your board and serial port
 Write and compile the code
 Upload the program into the Microcontroller
Step 1
First you must have your Arduino board (you can choose your favourite 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.

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

Module5 Page 3
INTERNET OF THINGS TECHNOLOGY 15CS81
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.

Module5 Page 4
INTERNET OF THINGS TECHNOLOGY 15CS81
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.

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.

Module5 Page 5
INTERNET OF THINGS TECHNOLOGY 15CS81
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 sketches.
E − Used to save your sketch.
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.

4. Explain the fundamentals of Arduino Programming.


Step 1: The Basics
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}

 Essentially this is a complete code, it complies and can be uploaded to the Arduino but
there is nothing in this code. It is important to understand this code structure because
every Arduino sketch will contain a void setup() and a void loop() functions even if they are
empty. The sketch will not compile without either one.
 The void setup() is the first function to be executed in the sketch and it is executed only
once. It usually contains statements that set the pin modes on the Arduino to OUTPUT
and INPUT, example:
 pinMode (12, OUTPUT);
 pinMode(11, INPUT);
 Or to start the serial monitor example: serial.begin(9600);
The void loop() is a function that executes indefinitely until you power off the Arduino.
Step 2: PinMode(), DigitalWrite() and Delay()
 We already established that the void setup() is a function that runs only once at the
beginning of the sketch. Within this function there is a statement called pinMode().
The job of the pinMode statement is to set the Arduino pins to OUTPUT or INPUT.
OUTPUT means that this pin will produce a result like turning on or off an LED.
INPUT is used to prepare the pin to receive information from a connected device like
a sensor.
 pinMode(Pin, Mode): The Pin can be any physical pin on the Arduino, you can use

Module5 Page 6
INTERNET OF THINGS TECHNOLOGY 15CS81
Pin number like 1, 2, 3 etc… or you can use the variable name assigned to this pin,
example LED1, pinLed, etc… The Mode is OUTPUT or INPUT in capital letters.
Example:
 pinMode(11,OUTPUT);
 pinMode(echo, INPUT);
 Curly braces{}: Are used to define the beginning and the end of functions and certain
statements. The braces are not only used with the void setup(), they are used
throughout the sketch including the void loop, if statements, user defined functions,
etc… every opening { should be followed by a closing } otherwise the code will
produce an error when compiling.
 Semicolon ;: Are used to define the end of a statement. Missing a semicolon will also
produce an error while compiling the code. They are also be found separating
elements in a for loop.
 Line comment //: Anything written after the // is not used by the program and they are
optional. However it is usually good practice to add comments so that other people can
understand the code also later on when the code gets bigger and more complicated, it will
help the programmer not to lose track of the code.
 Within the curly braces of the void loop there are two new statements: digitalWrite()
and delay().
 digitalWrite() changes the status of a pin by either writing a 5V or 0V using the
following syntax:
 digitalWrite(13, HIGH); this will write 5V to pin 13 on the Arduino digitalWrite
(LEDpin, LOW); this will write a 0V to the variable LEDpin
 essentially if you have an LED on PIN 13 on the Arduino, using digitalWrite(13,
HIGH); will turn on the LED and using digitalWrite(13,LOW); will turn off the LED.
 delay() is straight forward, it is used to delay the execution of the next statement by the
amount of milliseconds within the (). Example:
 delay(1000) means delay the execution of the next statement by 1000 milliseconds or 1
second.

Step 3: Variables
 A variable is the bread and butter of all programming. It is used to store information to
be used later in the code. In this case we are declaring that a variable called pushButton of
the type int(integer) is assigned to digital pin number 2 on the Arduino.
 Variables that are declared before the void setup() are called global variables because
they can be used by any function within the code.
 Since we declared pushButton before the void setup(), this variable can be used in the
void setup() and the void loop(). On the other hand variables that are declared within a
function can only be used by that function and they are called local variables.
 Variables have different types used to store different types of data.
 Once a global variable is declared, it can be called upon by any function using the name
selected by the programmer (case sensitive).

Module5 Page 7
INTERNET OF THINGS TECHNOLOGY 15CS81
Step 4: AnalogRead() and AnalogWrite()
 analogWrite(): using this statement we can write a new value into a pin,
 Serial.println(): this will print the value of voltage on the serial monitor.
Step 5: If Statement
 Every time we are using an if statement, we are looking to meet a certain condition,
example if "a" is bigger than "b". And if the result is true then we can execute whatever
is in between the curly brackets. If the result is not true then do nothing.
 Now if you are using an if/else statement, and the result is not true, then whatever is
under "else" will execute.
 The best way to set a condition is to use comparison and logical operators.
 Comparison operators: They are used to compare variables and constants against each
other to verify if a certain condition is met.
Step 6: For Statement
The for loop is used to repeat the statement(s) enclosed within the curly brackets a
number of times defined by the increment and the condition.
Syntax:
for (initialization; condition; increment)
{ statement(s);
}
Step 7: While Loop
 The While loop will keep on working until the statement within the brackets is no
longer true.
Syntax:
while(condit
ion){
statement1
statement2
etc..
}

5. With a neat diagram, explain Raspberry Pi board.


The Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer
monitor or TV, and uses a standard keyboard and mouse. It is a capable little device that
enables people of all ages to explore computing, and to learn how to program in languages
like Scratch and Python.
Figure 5.2 illustrates Raspberry Pi board.
(1) Raspi-Configuration: The Raspberry Pi configuration tool in Raspbian, allowing you
to easily enable features such as the camera, and to change your specific settings such as
keyboard layout.
(2) Config.txt: The Raspberry pi configurationfile.
(3) Wireless Networking:
 Configuring your Pi to connect to a wireless network using the Raspberry Pi 3's or Pi

Module5 Page 8
INTERNET OF THINGS TECHNOLOGY 15CS81
Zero W's inbuilt wireless.
 Connectivity, or a USB wirelessdongle.

Figure 5.2: Raspberry Pi board.


(4) Wireless access point:
 Although Raspbian is the official Raspberry Pi OS, there are other alternative operating
systems also available to run Raspberry Pi projects.
(5) Using a proxy:
Setting up your Pi to access the internet via a proxy server
 Hdmiconfig: Guide to setting up your HDMI device, including custom settings
 Audio config: Switch your audio output between HDMI and the 3.5mm jack
 Camera config: Installing and setting up the Raspberry Pi camera board
 External Storage config: Mounting and setting up external storage on a Raspberry Pi.
Localisation
o Setting up your Pi to work in your local language/time zone Default pin configuration
o Changing the default pin states. Device Treesconfig
o Device Trees, overlays, and parameters Kernel command line
o How to set options in the kernel command line UART configuration
o How to set up the on-board UARTS.
Firmware warning icons
Description of warning icons displayed if the firmware detects issues
LED warning flash codes
Description of the meaning of LED warning flashes that are shown if a Pi fails to boot
or has to shut down
Securing your Raspberry Pi
Some basic advice for making your Raspberry Pi moresecure
Screensaver
How to configure screen blanking/screen saver
The boot folder
What it's for and what's in it

Module5 Page 9
INTERNET OF THINGS TECHNOLOGY 15CS81
6. Explain Raspberry pi OS.
 Raspberry comes with all the software we require for basic computing. But if we want to
extend the functionalities to some extent, we can install an OS on the device.
 It performs as a bridge between the user and Raspberry hardware. OS is the most
crucial program that enables the hardware to communicate with the software for
generating meaningful interactions.
 Although Raspbian is the official Raspberry Pi OS, there are other alternative operating
systems also available to run Raspberry Pi projects.
 Different types of Raspberry pi OS are:
1. Raspbian
This is the official OS, and it can be used on all models of Raspberry. This free operating
system is known as the modified version of the popular OS Debian. It can serve all the
general purposes for the Raspberry users. One can indulge in any project development
or prototype building and can expect any kind of support from this OS.
2. OSMC
This is the best Raspberry Pi OS if for working or managing media content. It is an open
source software that renders a beautiful interface and easy to use features. This software
is based on Kodi OS, which is capable of providing support for virtually any media
content.
3. RISC OS
There are many single-board computers that are using ARM processors. RISC OS is the
best Raspberry OS as it is intended to serve ARM processors .Enhances the performance
and efficiency of the system as well.
4. Windows IoT Core
This is a powerful Raspberry Pi OS. Specially designed for writing sophisticated programs
and making prototypes.

7. Write a program for arduino to simulate traffic light for pedestrian


First, we will need to declare our variables, these are used to store data we can reference
throughout out our code.
For example, the GREEN variable represents the pin that the green LED is connected to.
While the DELAY_GREEN variable is the amount of time in milliseconds, we will delay
the program from moving forward.

// variables
int GREEN = 2;
int YELLOW = 3;
int RED = 4;
int DELAY_GREEN = 5000;
int DELAY_YELLOW = 2000;
int DELAY_RED = 5000;

Module5 Page 10
INTERNET OF THINGS TECHNOLOGY 15CS81
Now we need to setup the pins so they act as an output and not as an input.
The pinMode function accepts two parameters the pin number and the mode. (output or
input)

// basic functions
void setup()
{ pinMode(GREEN, OUTPUT);
pinMode(YELLOW, OUTPUT);
pinMode(RED, OUTPUT); }

The loop function creates a loop that the program will run through, so every time we call a
function, it will turn a light on and then we can set a delay, so it doesn’t change until that
time is up.

void loop()
{ green_light();
delay(DELAY_GREEN);
yellow_light();
delay(DELAY_YELLOW);
red_light();
delay(DELAY_RED); }

Now for each LED, we will need to create a function. As you can see
the green_light() function will turn the green LED on while turning the yellow and red
LEDs off.

void green_light()
{ digitalWrite(GREEN, HIGH);
digitalWrite(YELLOW, LOW);
digitalWrite(RED, LOW); }

void yellow_light()
{ digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, HIGH);
digitalWrite(RED, LOW); }

void red_light()
{ digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);
digitalWrite(RED, HIGH); }
);

Module5 Page 11
INTERNET OF THINGS TECHNOLOGY 15CS81
 Once you are done writing the code, you will need to upload it to the Arduino
using the USB cable that should have come with your kit. The lights should start to
blink in the pattern that we have defined using the function calls and the delays.
 You should always test your code before uploading it to the Arduino, you can do
this by clicking the verify button (Tick). This will let you know if there are any
errors in your code and allows you to make changes so that it is correct.

8. Write a program for raspberry pi to interact with user.


XRDP is a remote-desktop application that you can use with your Raspberry Pi and the
remote desktop functionality of operating systems like Windows.

SSH, or Secure Shell, is a method for connecting to a device's "terminal." SSH is a


protocol, and the terminal is the command prompt equivalent of a linux machine. This is
known as interacting with the machine "headless," meaning without a GUI. There are
many basic commands to learn for this, but I will just put a few below:

# make a directory:

mkdir newdirname

# change directory:

cd whatdir

# list items in dir

ls

#create or open a file:

nano filename

# Root dir symbol, you can use this to cd to the root dir quickly with something like:

cd ~~

 You can either interact with the terminal remotely with the Raspberry Pi using something
like XRDP (remote desktop), which still gives you the GUI, or you can also use SSH. A
popular program for SSH is called Putty. You use this to connect remotely to the
Raspberry Pi.
 To do it, you will just need the IP address for your Raspberry Pi, usually this is just the
local IP Address. Something like 192.168.X.X is what it will look like. You can find your
Raspberry Pi's IP address by typing "ifconfig" in the terminal. You will be asked for a
username and password to connect. Default username: pi, default password: raspberry.

Module5 Page 12
INTERNET OF THINGS TECHNOLOGY 15CS81
 First, to use GPIO, you will need to make sure you have the packages necessary on your
Raspberry Pi. Via the Pi terminal, type:
 sudo apt-get install python-rpi.gpio
 Once you have that, you're ready to code with GPIO.
 Now, open up a Python script from the desktop.
 Our first program is going to act like a door with a password. The idea is that, if the LED
light is "on," then the door is locked. In order to get the light to turn off and the "lock" to
unlock, we need to enter a correct password.
importRPi.GPIO as gpioimport time

 First, we just import RPi.GPIO as gpio for some short-hand, then we import time so we
can make the program sleep for a moment.

gpio.setmode(gpio.BCM)

gpio.setup(18, gpio.OUT)

 Here we are setting the mode to BCM, which is the naming convention for the GPIO
pins. You can either address the pins by their actual physical pin number, or their "name"
assigned to them. In order to be as careful as possible, it's best to explicitly check which
you are doing.

whileTrue:

gpio.output(18, gpio.HIGH)

passcode = raw_input("What is pi?: ")

 while True is an infinite loop that will just always run, we are setting the output in to
high, and then asking the user to input the password.

 GPIO pins have "HIGH" or "LOW," which can be thought of as a 1 or a 0 value. On or


off. They can also either be input or output. Input pins will "read" either a high or low
value, and then output pins will actually push out a high or low signal.

if passcode =="Awesome":
gpio.output(18, gpio.LOW)
time.sleep(4)

 We're assuming here the password is "Awesome." If that is what the user enters, then we
set the output pin to low, which will turn off the LED light for 4 seconds.

else:

Module5 Page 13
INTERNET OF THINGS TECHNOLOGY 15CS81
gpio.output(18, gpio.HIGH)

print("Wrong Password!")

 If the password is not "Awesome," then the console will output that the password is
wrong and continue the high signal.

 The entire script is:

importRPi.GPIO as gpioimport time


gpio.setmode(gpio.BCM)
gpio.setup(18, gpio.OUT)
whileTrue:
gpio.output(18, gpio.HIGH)
passcode = raw_input("What is pi?: ")
if passcode =="Awesome":
gpio.output(18, gpio.LOW)
time.sleep(4)
else:
gpio.output(18, gpio.HIGH)
print("Wrong Password!")

9. Discuss an IOT strategy for Smarter Cities.


Managing a city bears some resemblance to managing a corporate enterprise. As the need
for efficiency increases, new tools help increase operational efficiency. For cities, just as
for businesses, digitization transforms the perspective on operations. New ideas emerge,
bringing different approaches to solving management issues. Scalable solutions utilizing
information and communications technology.
 Vertical IoT Needs for Smarter Cities
There are many differing approaches and solutions for city management. All these
solutions typically start at the street level, with sensors that capture data on everything
from parking space availability to water purity. Data analytics is also used extensively—
for example, to reduce crime or improve traffic flows. Citizens can use tools to leverage
their smart mobile devices, such as to report problems and make recommendations for
improving urban life or locate available parking spaces.
 A recent Cisco study, as illustrated in Figure 5.3, expects IoT to have the following
economic impact over a 10-year period:3
 Smart buildings:

Module5 Page 14
INTERNET OF THINGS TECHNOLOGY 15CS81
Smart buildings have the potential to save $100 billion by lowering operating costs by
reducing energy consumption through the efficient integration of heating, ventilation, and
air-conditioning (HVAC) and other building infrastructure systems. Note that the financial
gain applies to city budgets only when a building is city owned. However, the reduced
emissions benefit the city regardless of who owns the buildings.
 Gas monitoring:
Monitoring gas could save $69 billion by reducing meter-reading costs and increasing the
accuracy of readings for citizens and municipal utility agencies. The financial benefit is
obvious for users and utility companies when the utility is managed by the city. There are
also very important advantages in terms of safety, regardless of who operates the utility.
In cases of sudden consumption increase, a timely alert could lead to emergency response
teams being dispatched sooner, thus increasing the safety of the urban environment.
 Smart parking:
Smart parking could create $41 billion by providing real-time visibility into parking
space availability across a city. Residents can identify and reserve the closest available
space, traffic wardens can identify noncompliant usage, and municipalities can introduce
demand-based pricing.
 Water management:
Smart water management could save $39 billion by connecting household water meters
over an IP network to provide remote usage and status information. The benefit is
obvious, with features such as real-time consumption visibility and leak detection. In
addition, smart meters can be used to coordinate and automate private and public lawn
watering, initiating the watering programs at times when water consumption is lower or
in accordance with water restrictions imposed by civic authorities. At a city scale, IoT
can be
 Road pricing:
Cities could create $18 billion in new revenues by implementing automatic payments as
vehicles enter busy city zones while improving overall traffic conditions. Real-time
traffic condition data is very valuable and actionable information that can also be used to
proactively reroute public transportation services or private users.

Figure 5.3: Key Use Cases for Smart Cities

Module5 Page 15
INTERNET OF THINGS TECHNOLOGY 15CS81
 To maximize the return on investment (ROI) on their energy and environmental
investments
 Smart cities can employ strategies that combine water management, smart grid, waste
management and gas monitoring, which in turn leads to higher economic impact and
improves the potential for future investments.
 Global vs. Siloed Strategies:
• The main obstacle in implementing smart solutions in today’s traditional infrastructure is
the complexity of how cities are operated, financed, regulated, and planned.
• Even cities using IoT technology break up city assets and service management into silos
that are typically unable to communicate or rely on each other.
• 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?
• 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 present the long-term analysis to city planners?

10. With a neat diagram, explain wireless temperature monitoring system using
Raspberry Pi.
 Raspberry Pi which having inbuilt wi-fi, which makes Raspberry Pi to suitable for IoT
applications, so that by using IoT technology this monitoring system works by uploading the
temperature value to the Things peak cloud by this project you can able to learn to how to
handle cloud-based application using API keys.
 In this monitoring system, we used Thingspeak cloud, the cloud which is suitable to view
the sensor logs in the form of graph plots. Here we created one field to monitor the
temperature value, that can be reconfigurable to monitor a number of sensor values in various
fields.
 This basic will teach you to how to work with a cloud by using LM35 as a temperature
sensor, to detect the temperature and to upload those values into the cloud.
DS18B20 Temperature Sensor
 The DS18B20 is a 1-wire programmable Temperature sensor from maxim integrated. It is
widely used to measure temperature in hard environments like in chemical solutions, mines
or soil etc.The constriction of the sensor is rugged and also can be purchased with a water

Module5 Page 16
INTERNET OF THINGS TECHNOLOGY 15CS81
proof option making the mounting process easy. It can measure a wide range of temperature
from -55°C to +125° with a decent accuracy of ±5°C.
 Each sensor has a unique address and requires only one pin of the MCU to transfer data so
it a very good choice for measuring temperature at multiple points without compromising
much of your digital pins on the microcontroller. Figure 5.4illustrates DS18B20 Temperature
Sensor Pin out and DS18B20 Temperature Sensor.

Figure 5.4: DS18B20 Temperature Sensor Pin out DS18B20 Temperature Sensor
 HARDWARE REQUIRED
• Raspberry Pi
• SD card
• Power supply
• VGA to HDMI converter (Optional)
• MCP3008 (ADC IC)
• A temperature sensor(LM35)
 SOFTWARE REQUIRED
• Raspbian Stretch OS
• SD card Formatter
• Win32DiskImager (or) Etcher
 PYTHON LIBRARIES USED
• RPi. GPIO as GPIO (To access the GPIO Pins of Raspberry Pi)
• Time library (For Time delay)
• Urllib2 to handle URL using Python programming.
DS18B20 Temperature Sensor
 Applications:
 Measuring temperature at hard environments
 Liquid temperature measurement
 Applications where temperature has to be measured at multiple points
 Pin Configuration:
No Pin Name Description

1 Ground Connect to the ground of the circuit

2 Vcc Powers the Sensor, can be 3.3V or 5V

3 Data This pin gives output the temperature value which can be read using 1-wire method.

Module5 Page 17
INTERNET OF THINGS TECHNOLOGY 15CS81
11. Write a short note on Smart Traffic Control.
 Traffic is one of the most well-understood pain points for any city. It is the leading cause
of accidental death globally, causes immense frustration, and heavily contributes to
pollution around the globe.
 A smart city traffic solution would combine crowd counts, transit information, vehicle
counts, and so on and send events regarding incidents on the road so that other controllers
on the street could take action.
 Figure 5.5 illustrates a Smart Traffic Architecture which helps to understand better.

Figure5.5: Smart City Traffic Architecture


 In the architecture, a video analytics sensor computes traffic event based on a video
feed and only pushes events (the car count, or metadata, not the individual images)
through the network.
 These events go through the architectural layers and reach the applications that can
drive traffic services.
 These services include traffic light coordination and also license plate identification for
toll roads. Some sensors can also recognize abnormal patterns, such as vehicles moving
in the wrong direction or a reserved lane.
 In that case, the video feed itself may be uploaded to traffic enforcement agencies.
 Other types of sensors that are part of traffic control solutions include Bluetooth vehicle
counters, real-time speed and vehicle counters, and lighting control systems.
 These sensors provide a real-time perspective while also offering data collection
services for historical data trending and correlation purposes.
 Communication techniques are as varied as sensor form factors.
 For example, counters installed in light fixtures or traffic lights may use a wired or
wireless technology and any number of communication protocols.

Smart Traffic Applications


 Traffic applications can be enabled to take immediate action with other sensors to
manage traffic and to reduce pain points. Historical data can be used to develop more
efficient urban planning to reduce the amount of traffic a city experiences.

Module5 Page 18
INTERNET OF THINGS TECHNOLOGY 15CS81
 A common traffic pain point is stop-and-go, where traffic flow suddenly comes to a
halt and then flows again. This wavelike traffic pattern is a natural result of the
unpredictability of the traffic speed ahead and has long been studied by public and
private organizations.
 A well-known remedy for stop-and-go traffic is to regulate the standard flow speed
based on car density. As density increases, car speed is forced down to avoid the wave
effect.
 Information can also be shared with drivers. Countless applications leverage crowd
sourcing or sensor-sourced information to provide real-time travel time estimates,
suggest rerouting options to avoid congestion spots, or simply find the best way between
two points, while taking into account traffic, road work and many more.
 By doing the following we can expect at the city level to regulate traffic flows and at a
citizen level to have a better driving experience.

12. Write a note on Connected Environment.


 As of 2017, 50% of the world’s population has settled on less than 2% of the earth’s
surface area. Such densely populated closed spaces can see spikes in dangerous gas
molecules at any given moment.
 More than 90% of the world’s urban population breathes in air with pollutant levels
that are much higher than the recommended thresholds, and one out of every eight deaths
worldwide is a result of polluted air.
 The Need for a Connected Environment
 Most large cities monitor their air quality. Data is often derived from enormous air
quality monitoring stations that are expensive and have been around for decades.
 These stations are highly accurate in their measurements but also highly limited in
their range, and a city is likely to have many blind spots in coverage.
 Given the price and size of air quality monitoring stations, cities cannot afford to
purchase the number of stations required to give accurate reports on a localized level and
follow the pollution flows as they move through the city over time.
 To fully address the air quality issues in the short term and the long term, a smart city
would need to understand air quality on a hyper-localized, real-time, distributed basis at
any given moment. To get those measurements, smart cities need to invest in the
following: → Open-data platforms that provide current air quality measurements from
existing air quality monitoring stations.
 Sensors that provide similar accuracy to the air quality stations but are available at
much lower prices.
 Actionable insights and triggers to improve air quality through cross-domain actions.
 Visualization of environmental data for consumers and maintenance of historical air
quality data records to track emissions over time.
 The figure 5.6 shows an architecture in which all connected environment elements
overlay on the generalized four-layer smart city IoT architecture.

Module5 Page 19
INTERNET OF THINGS TECHNOLOGY 15CS81
 At the street layer there are a variety of multivendor sensor offerings, using a variety
of communication protocols.
 Connected environment sensors might measure different gases, depending on a city’s
particular air quality issues, and may include weather and noise sensors. These sensors
may be located in a variety of urban fixtures, such as in street lights. They may also be
embedded in the ground or in other structures or smart city infrastructure.

Connected Environment Architecture


 Even mobile sources of information can be included through connected wearables that
citizens might choose to purchase and carry with them to understand the air quality
around them at any given moment.
 Crowd sourcing may make this information available to the global system.
 Communication technologies depend on the location of the sensors. Wearable’s
typically communicate via a short-range technology (such as Bluetooth) with a nearby
collecting device (such as a phone). That device, in turn, forwards the collected data to
the infrastructure (for example, through cellular data).

Figure 5.6: Connected Environment Architecture


 Sensors that are installed in urban fixtures also use a variety of communication
technologies. Sensors included in street lighting systems may utilize the same
communication infrastructure as the street light control application.
 Independent and standalone sensors typically use wireless technologies.
 In dense urban environments, ZigBee and Wi-Fi are common. However, Wi-Fi is not
very well adapted for networks where reports are sporadic because Wi-Fi requires an
802.11 connection to be maintained, which consumes battery resources.
 In larger environments, LPWA technologies, such as NB-IoT and LoRaWAN, are
used, unless the sensor is able to use a wired technology (for example, when connecting
to the wired lighting infrastructure), but this is much rarer because of the cost.
 In addition to all the air quality sensor and wearable data, the data center layer or
application layer represented on the left side of the figure also receives the open data
from existing weather stations as an additional data input.
 All these data inputs come together to provide a highly accurate sense of the air quality
in the city at any given moment.

Module5 Page 20
INTERNET OF THINGS TECHNOLOGY 15CS81
 This information can be visualized in applications that include heat maps of
particulates, concentrates, and specific information on the dangers of such gaseous
anomalies. Different pollution levels can be communicated, and gases can be tracked as
they move throughout the city, either because of the wind or because of the movement of
gas sources.
 From this pollution and environmental data and the analytics applied to it, the city can
track problem areas and take action in long-term urban planning to reduce the effects of
air quality disturbances. This action can take many forms, from increasing public transit
availability along the more polluted routes to encouraging the displacement of businesses
toward living areas to limit the need to commute daily.
 With this pollution information, citizens can also take short term actions, such as
turning on their air purifiers at a given moment or simply stepping inside if pollutant
concentrations are becoming serious.
 Strategic coordinated joint actions are also possible, such as restricting traffic along
certain routes or on certain days, and encouraging citizens to share vehicles or use the
public transportation system.

13. Write a note on Connected Street Lighting


 Throughout history, regional and municipal governments have used new technologies
to improve the lives of their citizens. The aqueducts of Rome brought outside sources of
water into the city, enhancing both public and private facilities.
 The London Underground, the first underground railway, made it easier and safer for
people to move around the burgeoning city.
 Today, cities are using another new technology to transform the ever-present street
lights that line most city streets, installing LEDs that dramatically reduce energy use and
costs. The impact of LEDs is significant – street lighting can account for up to 50 percent
of a city’s entire energy budget, and by simply replacing old street lightbulb technology
with LEDs.
 Cities can use it to develop “follow-me” strategies that turn on street lighting only in
response to specific pedestrian or vehicular activity, allowing them to reduce their energy
costs.
 They can enable light flashing and sequencing to support traffic and crowd control
during special events. And they can use connected street lighting to improve safety by
increasing lighting in higher-crime areas and by providing first responders with the ability
to increase lighting when they respond to an incident.
 Until recently, cities trying to centralize connectivity for connected street lighting used
proprietary gateways that connected to smaller segments of street lights already connected
via low-bandwidth communications, such as power line carrier (PLC) or a local RF mesh
network.

Module5 Page 21
INTERNET OF THINGS TECHNOLOGY 15CS81
 A cellular modem could also be added for backhaul communications to the central
management software platform. However, this proprietary infrastructure was expensive
and had limited utility.
 With the development of the Internet of Things (IoT), there’s now a much better way.
Point-to-point (P2P) cellular technology eliminates the need for proprietary gateways and
segment controllers.
 A wireless cellular modem on each light pole can be configured to support low or high
data throughput, depending on the application.
 A small antenna mounted on the pole enables direct communication to a central
management software platform, creating a single network and paving the way for the use
of advanced sensors and actuators that enable the deployment of other smart city
applications in the future.
 Once light poles are connected to a central management software platform, regional and
municipal governments can use this new intelligent infrastructure as the foundation for
other smart city initiatives – all made more efficient and cost effective by taking advantage
of these existing assets.
 For example, smart city public safety applications can use video surveillance cameras,
emergency call stations, and environmental monitoring stations (with sensors to detect
earthquakes, air quality, noise, etc.) strategically placed on light poles. Digital signage on
select street light poles can provide real-time information to drivers, pedestrians and
residents related to traffic, emergencies and local events, or be used to generate
advertising revenue for the city.
 Connected street lighting also enables governments to use their street lights for Wi-Fi
access.
 These access points can be used by city personnel to lower their cellular data usage,
reducing city expenses.
 Wi-Fi access points can also be used to provide Internet access to local businesses and
residents, providing the city with a new sources of leasing or adverting revenues.
 In addition, cities can use these Wi-Fi access points to help bridge the digital divide by
providing poorer city residents with free or low-cost Internet access.
 Smart parking meters or pay stations attached or connected to light poles can eliminate
the costs associated with trenching for standalone meters and pay stations.
 Electric vehicle (EV) charging stations can be equipped with payment processing that is
integrated with connected lighting in parking lots and near entertainment venues,
increasing access for EV drivers, encouraging more use of EVs, and generating additional
revenue for regional and municipal governments.
 Alone, connected street lights using P2P cellular technology offer cities the opportunity
to make their city’s lighting more useful, less expensive, and smarter.
 However, connected street lights can also accelerate deployment of Wi-Fi access
points, digital signage, connected parking meters, EV charging stations and other smart
city initiatives that allow cities to deliver their citizens a higher quality of life, while also
improving city finances.

Module5 Page 22
INTERNET OF THINGS TECHNOLOGY 15CS81
 As they move forward in seeking to digitally transform themselves, regional and
municipal governments should first look at how the IoT enables a seemingly simple
technology – the street light – to serve as the foundation for their smart city initiatives.

14. Write a note on Smart Parking


 Smart Parking is a parking solution that can include in-ground Smart Parking sensors,
cameras or counting sensors. These devices are usually embedded into parking spots or
positioned next to them to detect whether parking bays are free or occupied. This happens
through real-time data collection.
 The data is then transmitted to a smart parking mobile application or website, which
communicates the availability to its users. Some companies also offer other in-app
information, such as parking prices and locations. This gives you the possibility to
explore every parking option available to you.
 Smart Parking and its Smart Parking Sensors can be seen as a part of smart cities.
These smart cities are cities that are driven by an IT infrastructure and by using this
infrastructure, cities can enhance the quality of life and improve economic development
for its inhabitants. Becoming a smart city can be a good way to collect historical data in a
relatively easy way. By collecting this data, cities can analyze how processes, like
parking can be optimized.
 As a result of using Smart Parking, people who are looking to find a parking spot will
find it in the most efficient way possible and companies or municipalities can optimize
their parking territories. It also makes cities more livable, safer and less congested.
 Smart parking will have an outstanding impact on all stakeholders involved in the
process. Drivers will be able to book parking spaces beforehand, plan trips and commutes
with the lot occupancy in mind. Reinforcement agencies will be able to detect and
evaluate the gravity of parking rules violations in split seconds.
 Parking facility managers will be able to optimize the use of space and resources
within their parking lots, efficiently strategize and plan future development. Community
leaders will increase the comfort of city residents by implementing IoT parking solutions.
 Here are a few additional benefits IoT offers in the parking sector:
 Sponsored meter time extension. Connected platforms will notify drivers when the
parking meter is about to expire. Such tools will help extend the parking time duration in
one click as soon as the driver paid for an extension. Automated parking meter extension
systems will reduce the number of traffic law violation cases and increase the revenue of
the facility.
 Innovative parking solutions that identify the safety of parking spots. The ‘red’
zones like bus stops, passenger loading-unloading areas, and parking spots for
handicapped people will be identified by the platform and alerted to the driver. This way,
the number of parking violations by negligence will be reduced. If a driver still parked a
vehicle in a no-parking zone, a connected platform will instantly notify a reinforcement
department about the violator, increasing the odds of penalizing the violation
successfully.

Module5 Page 23
INTERNET OF THINGS TECHNOLOGY 15CS81
 Efficient citywide parking space utilization — automated parking planners can
collect occupancy data for all parking venues thanks to a network of connected sensors.
To disperse the number of parked cars equally throughout the city, municipal
communities can adjust meter rates and allowed parking times using the data provided by
IoT platforms in the decision-making process.
 Here are the features a smart platform in the parking industry should leverage
upon:
 Interface showing free and occupied parking spaces — an IoT platform (ideally, a
cloud-based one) should aggregate sensor data and transform it into concise legible
insights regarding the occupancy of parking spaces in the facility.
 Real-time monitoring of parking occupancy situation from any PC or
smartphone. A driver should be able to see how many free slots all parking facilities
around town offer in real time. An interactive occupancy map is a must-have for an
efficient, connected parking management tool.
 API for end-user and management applications. Since the impact of parking
management tools is vital to the well-being of community members, program developers
need to ensure the tool offers third-party integrations and can be implemented into other
management and parking lot monitoring tools.
 User-friendly interface, access permissions for different user groups. Not every
driver is tech-savvy and experienced in navigating complex platforms. To make the
process of finding or checking the availability of a parking lot as effortless as possible,
app developers should stick to a minimalist interface.

15. How to configure OS setup on raspberry pi.

Module5 Page 24
INTERNET OF THINGS TECHNOLOGY 15CS81

Module5 Page 25

You might also like