0% found this document useful (0 votes)
16 views5 pages

Iot Unit-4

Uploaded by

rakeshr0026
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
0% found this document useful (0 votes)
16 views5 pages

Iot Unit-4

Uploaded by

rakeshr0026
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/ 5

INTERNET OF THINGS – LECTURE MATERIAL

Writing packages:

Packages are namespaces which contain multiple packages and modules themselves.
They are simply directories, but with a twist.

Each package in Python is a directory which MUST contain a special file called
__init__.py. This file can be empty, and it indicates that the directory it contains is a Python
package, so it can be imported the same way a module can be imported.

If we create a directory called foo, which marks the package name, we can then create a
module inside that package called bar. We also must not forget to add the __init__.py file
inside the foo directory.

To use the module bar, we can import it in two ways:

 script.py

 IPython Shell.

UNIT – IV
IoT Physical Devices and Endpoints

MRITS/ECE/IV-I 66
INTERNET OF THINGS – LECTURE MATERIAL

IoT Device
A "Thing" in Internet of Things (IoT) can be any object that has a unique identifier and which
can send/receive data (including user data) over a network (e.g., smart phone, smart TV,
computer, refrigerator, car, etc.).
• IoT devices are connected to the Internet and send information about themselves or about their
surroundings (e.g. information sensed by the connected sensors) over a network (to other devices
or servers/storage) or allow actuation upon the physical entities/environment around them
remotely.

IoT Device Examples


A home automation device that allows remotely monitoring the status of appliances and
controlling the appliances.
• An industrial machine which sends information a bouts its operation and health monitoring data
to a server.
• A car which sends information about its location to a cloud-based service.
• A wireless-enabled wearable device that measures data about a person such as the number of steps
walked and sends the data to a cloud-based service.
Basic building blocks of an IoT Device
1. Sensing: Sensors can be either on-board the IoT device or attached to thedevice.
2. Actuation: IoT devices can have various types of actuators attached that allow taking actions upon
the physical entities in the vicinity of thedevice.
3. Communication: Communication modules are responsible for sending collected data to other
devices or cloud-based servers/storage and receiving data from other devices and commands from
remote applications.
4. Analysis & Processing: Analysis and processing modules are responsible for making sense of the
collecteddata.

Block diagram of an IoT Device

MRITS/ECE/IV-I 67
INTERNET OF THINGS – LECTURE MATERIAL

Exemplary Device: Raspberry Pi


Raspberry Pi is a low-cost mini-computer with the physical size of a credit card.
Raspberry Pi runs various flavors of Linux and can perform almost all tasks that a normal
desktop computer can do. Raspberry Pi also allows interfacing sensors and actuators through the
general purpose I/O pins. Since Raspberry Pi runs Linux operating system, it supports Python
"out of the box". Raspberry Pi is a low-cost mini-computer with the physical size of a credit
card. Raspberry Pi runs various flavors of Linux and can perform almost all tasks that a normal
desktop computer can do. Raspberry Pi also allows interfacing sensors and actuators through the
general purpose I/O pins. Since Raspberry Pi runs Linux operating system, it supports Python
"out of the box".

Raspberry Pi

MRITS/ECE/IV-I 68
INTERNET OF THINGS – LECTURE MATERIAL

Linux on Raspberry Pi
1. Raspbian: Raspbian Linux is a Debian Wheezy port optimized for RaspberryPi.
2. Arch: Arch is an Arch Linux port for AMDdevices.
3. Pidora: Pidora Linux is a Fedora Linux optimized for RaspberryPi.
4. RaspBMC: RaspBMC is an XBMC media-center distribution for RaspberryPi.
5. OpenELEC: OpenELEC is a fast and user-friendly XBMC media-centerdistribution.
6. RISC OS: RISC OS is a very fast and compact operatingsystem.

Raspberry Pi GPIO

Raspberry Pi Interfaces

MRITS/ECE/IV-I 69
INTERNET OF THINGS – LECTURE MATERIAL

1. Serial: The serial interface on Raspberry Pi has receive (Rx) and transmit (Tx) pins for
communication with serialperipherals.
2. SPI: Serial Peripheral Interface (SPI) is a synchronous serial data protocol used for
communicating with one or more peripheraldevices.
3. I2C: 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
(clockline).

Raspberry Pi Example: Interfacing LED and switch with Raspberry Pi

from time import sleeP import RPi.GPIO asGPIO GPIO.setmode(GPIO.BCM)


#Switch Pin GPIO.setup(25,GPIO.IN) #LEDPin
GPIO.setup(18,GPIO.OUT)
state=false
deftoggleLED(pin):
state = not state GPIO.output(pin,state)
whileTrue:
try:
if (GPIO.input(25) ==True):
toggleLED(pin)
sleep(.01)
exceptKeyboardInterrupt:
exit()
Other Devices
1. pcDuino
2. BeagleBoneBlack
3. Cubieboard

UNIT V
MRITS/ECE/IV-I 70

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy