IoT Physical Devices and End Points
IoT Physical Devices and End Points
• 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 up on the physical
entities/environment around them remotely.
IoT device Examples :
Actuation : IoT device can have various types of actuators attached that allow taking actions
upon the physical entities in the vicinity of the device. For example, a relay switch connected
to an IoT device can turn an appliance on/off based on the commands sent to the device.
Communication:
It runs various flavors of Linux and can perform almost all tasks that a normal
desktop computer can do.
It is also allows interfacing sensors and actuators through the general purpose I/o
(GPIO) pins.
Processor & RAM : Raspberry Pi is based on ARM processor. The latest version of
Raspberry pi comes with 700 MHz Low power ARM1176JZ-F processor and 512 MB
SDRAM.
USB Ports :Raspberry Pi comes with two USB 2.0 Ports. The USB ports on Raspberry Pi
can provide a current up to 100mA.For connecting devices that draw current more than
100mA, an external USB powered hub is required.
Ethernet Ports: Raspberry Pi comes with a standard RJ45 Ethernet port. You can connect
an Ethernet cable or a USB Wifi adapter to provide internet connectivity.
HDMI output : The HDMI port on Raspberry Pi provides both video and audio output.
You can connect the raspberry Pi to a monitor using HDMI cable.For monitors that have a
DVI port but no HDMI port, you can use an HDMI to DVI adapter/cable.
Audio output :Raspberry Pi has a 3.5mm audio output jack . This audio jack is used for
providing audio output to old televisions along with the RCA jack for video.
GPIO pins: Raspberry Pi comes with a number of general purpose input/output pins.
There are four types of pins on Raspberry Pi- true GPIO pins,12C Interface pins, SPI
interface pins and serial Rx and Tx pins.
Display Serial Interface(DSI) : The DSI interface can be used to connect an LCD panel to
Raspberry Pi.
Camera Serial Interface: The CSI interface can be used to connect a camera
module to Raspberry Pi.
SD card slot: Raspberry Pi does not have a built in operating system and
storage . You can Plug-in an SD card loaded with a Linux image to the SD
card slot.
Raspbian Raspbian Linux is a Debian wheezy port optimized for Raspberry Pi. This
is the Recommended Linux for Raspberry pi.
The serial interface on Raspberry Pi has receive (Rx) and transmit (Tx) pins for
communication with serial peripherals.
SPI :
• MOSI(Master out Slave In ) :Slave line for sending data to the master.
$cd/sys/class/gpio.gpio18
# Turn LED on
Import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
While True :
time.sleep( 1 )
time.sleep(1)
Interfacing an LED and Switch with Raspberry PI
Python Program for controlling an LED with a switch
Python program to sending an email on switch press :
Import smtplib
from time import sleep
Import RPI . GPIO as GPIO
from sys import exit
From_email = ‘ <my-email>’
receipients_list=[‘<receipint-email>’]
cc_list = [ ]
subject = ‘ Hello ‘
message = ‘ Switch pressed on Raspberry pi’
username = ‘ <Gmail-username>’
password = ‘ <password>’
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.IN)
• Connect one side of LDR to 3.3V and other side to a 1uF capacitor and
also to a GPIO pin ( pin 18 in this example).
GPIO.setmode ( GPIO.BCM)
Ldr_threshold = 1000
LDR_PIN = 18
LIGHT_PIN = 25
Def readLDR ( PIN ) :
reading = 0
GPIO.setup ( LIGHT_PIN, GPIO.OUT)
GPIO.output(PIN,False)
time.sleep ( 0. 1 )
GPIO.setup ( PIN, GPIO . IN )
while( GPIO.input ( PIN ) = = False) :
reading=reading+1
return reading
def switchingOnLight ( PIN) :
GPIO.setup ( PIN, GPIO.OUT)
GPIO.output ( PIN, True)
def switchoffLight( PIN ) :
GPIO.setup ( PIN , GPIO.OUT )
GPIO.output( PIN, False )
while True :
ldr_reading = readLDR ( LDR_ PIN )
if ldr_reading< ldr_threshold :
switchOnlight ( LIGHT_PIN)
else :
switchoffLight ( LIGHT_PIN )
time.sleep( 1 )