IoT_UNIT-IV_Lecture_Notes
IoT_UNIT-IV_Lecture_Notes
IoT device:
IoT can be any object that has a unique identifier and which can send and receive data (including user data) over a
network(e.g., smart phone, smart TV, refrigetor,etc.). IoT devices are connected to the internet and send information
about themselves or about surroundings or allow actuation upon the physical entities/environment around them
remotely.
Sensing: Sensors can be either on-board the IoT device or attached sensors such as temperature, humidity, etc. The
sensed information can be communicated either to other devices or cloud-based servers/storage.
Actuation: IoT devices can have various types of actuators attached that allow taking actions upon the physical entities
in the vinicity of the device.
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.
Analysis & Processing: Analysis & Processing modules are responsible for making sense of the collected data.
Introduction to raspberry Pi
Raspberry Pi is a low-cost mini-computer with the physical size of credit card. Raspberry Pi runs on various flavors of
linux and can perform almost all tasks that a normal desktop can do.
USB ports: Raspberry Pi comes with 4 USB ports. The USB ports on Raspberry Pi can provide a current upto 100mA.
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.
Video port: Raspberry Pi comes with a video output with an RCA jack.
GPIO pins: Raspberry Pi comes with a 40 GPIO pins. There are four types of pins- True GPIO pins, I2C interface pins, SPI
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(CSI): The CSI interface can be used to connect a camera module to Raspberry Pi.
Linux on Raspberry Pi
Raspbian: Raspbian Linux is a Debian Wheezy port optimized. This is recommended linux for Raspberry Pi.
Raspberry Pi Interfaces
Raspberry Pi has serial, SPI and I2C interfaces for data transfer
Serial: The serial interface o Raspberry Pi has receive(Rx) and Transmit(Tx) pins for communication.
SPI: Serial Peripheral Interface(SPI) is a synchronous serial data protocol used for communicating with one or more
peripheral devices. In an SPI connection, there is one master device and one or more peripheral devices. There are 5
pins on Raspberry Pi for SPI interface:
Master In Slave Out(MISO): Master line for sending data to the peripherals.
Master Out Slave In(MOSI): Slave line for sending data to the master.
I2C: The I2C interface pins on Raspberry Pi you can connect hardware modules.I2C interface allows synchronous data
transfer with just pins- SDA(data line) and SCL(clock line).
In this example, the LED is connected to GPIO pin 18 and switch is connected to pin 25. In the infinite loop the value of
pin 25 is checked and state of LED is toggled if the switch is pressed.
Cont…
Python program for sendin email on switch press
Cont…
Interfacing a Light Sensor(LDR) with raspberry pi
In this example, the readLDR() function returns a count which is proportional to light level. In this function the LDR pin is
set to o/p and low and then to i/p. At this point capacitor starts charging through the resistor (and a counter is started)
until the i/p pin reads high. The counter is stopped when i/p reads high.
Cont…