SlideShare a Scribd company logo
1 of 20
IoT For Data Science and
Analytics
"Anything that can be connected, will be connected"
Sourav Tripathy
Syllabus
2
IOT FOR DATA SCIENCE AND ANALYTICS
Module 5
3
Raspberry Pi
Introduction to Raspberry Pi
About Raspberry Pi board
Hardware layout
Operating Systems on Raspberry Pi
Configuring Raspberry Pi
Configuring Raspberry Pi with Python
Wireless temperature monitoring system using Pi
DS18B20 Temperature Sensor
Connecting Raspberry Pi via SSH
Accessing temperature from DS18B20 sensors
Remote Access to Raspberry Pi
4
Introduction to Raspberry Pi
Raspberry Pi is defined as a minicomputer the size of a credit card that is interoperable with
any input and output hardware device like a monitor, a television, a mouse, or a keyboard –
effectively converting the set-up into a full-fledged PC at a low cost.
•Affordable: Prices start as low as $5 for the Raspberry Pi Pico and increase depending on
model and capabilities.
•Compact: Pocket-sized design (typically around the size of a credit card) makes it portable
and convenient.
•Powerful: Can handle diverse tasks with processors ranging from single-core to quad-core
and RAM from 256MB to 8GB.
•Versatile: Offers various input/output ports, including HDMI, USB, and GPIO pins for
connecting to different devices and sensors.
•Open-source: Supported by a large and active community and runs on open-source
operating systems like Raspberry Pi OS (based on Linux).
https://www.raspberrypi.com/documentation/computers/getting-started.html#setting-up-your-
raspberry-pi
5
Raspberry Pi and Arduino Difference
6
Feature Raspberry Pi Arduino
Type of device Microcomputer Microcontroller
Processing power More powerful Less powerful
Operating system
Runs a full operating system, such as
Raspberry Pi OS or Ubuntu
Doesn't run an operating system
Programming language Python, Java, C++, Scratch C++
Connectivity Wi-Fi, Bluetooth, Ethernet Limited to USB
Cost More expensive Less expensive
Complexity More complex to set up and use Simpler to set up and use
Best for
Complex projects that require multitasking
and internet connectivity
Simple projects that require controlling
hardware
Raspberry Pi and Arduino Difference
7
•Processing power: Raspberry Pi has a more powerful processor, which means it can handle more
complex tasks, such as running multiple programs at the same time or processing large amounts of
data. Arduino has a simpler processor, which is better suited for smaller, more focused tasks.
•Operating system: Raspberry Pi runs a full operating system, which gives you more flexibility and
control over your projects. Arduino doesn't run an operating system, so you have less control over
how it works.
•Programming language: Raspberry Pi can be programmed in a variety of languages, including
Python, Java, and C++. Arduino can only be programmed in C++.
•Connectivity: Raspberry Pi has built-in Wi-Fi, Bluetooth, and Ethernet connectivity, which makes it
easy to connect to the internet and other devices. Arduino typically only has USB connectivity.
•Cost: Raspberry Pi is more expensive than Arduino. However, it is also more powerful and
versatile.
•Complexity: Raspberry Pi is more complex to set up and use than Arduino. This is because it runs
an operating system and has more features. However, there are many resources available to help
you get started with Raspberry Pi.
•Best for: Raspberry Pi is best for complex projects that require multitasking and internet
Raspberry Pi board : Hardware layout
8
Raspberry Pi board : Hardware layout
9
https://www.youtube.com/watch?v=oWxeoU9v3K8
http://meseec.ce.rit.edu/551-projects/spring2017/2-3.pdf
Raspberry Pi board : Hardware layout
10
System on a Chip (SoC):
This is the brain of the Raspberry Pi, integrating the Central Processing Unit
(CPU), Graphics Processing Unit (GPU), and Random Access Memory (RAM)
onto a single chip. Different models boast varying processing power and graphics
capabilities
Storage:
The Raspberry Pi relies on a microSD card for storing its operating system
and files. Choose a high-quality card with sufficient capacity for your needs,
as it plays a crucial role in performance and data safety
Power Supply:
A stable power supply is vital for smooth operation. Most models require a Micro
USB or USB-C power supply that can deliver at least 2.5 amps of current. Choose
a reliable power adapter to avoid any hiccups.
Input/Output (I/O) Ports:
•HDMI: for connecting to a monitor or TV
•USB: for connecting peripherals like keyboards, mice, and external storage
•Ethernet: for wired network connection
•3.5mm jack: for audio output
•MicroSD card slot: for storage expansion
Raspberry Pi board : Hardware layout
11
General-Purpose Input/Output (GPIO) Pins:
These 40 pins on the Raspberry Pi's header offer immense flexibility. You can connect various
sensors, actuators, and other devices to interact with the physical world, enabling exciting projects like
robotics, home automation, and more.
3V3 3.3 volts
Anything connected to these pins will
always get 3.3V of power
5V 5 volts
Anything connected to these pins will
always get 5V of power
GND ground Zero volts, used to complete a circuit
GP2 GPIO pin 2
These pins are for general-purpose use and
can be configured as input or output pins
ID_SC/ID_SD/DNC Special purpose pins
Operating Systems on Raspberry Pi
Raspberry PI needs optimized OS suitable to run on Raspberry Pi hardware.
Raspberry Pi OS (formerly Raspbian)
The official and most popular choice, based on Debian Linux. Beginner-friendly with a
desktop environment and pre-installed software. Available in 32-bit and 64-bit versions.
Ubuntu Core
Another Linux-based option, lightweight and focused on security and minimal resource usage.
Ideal for Internet of Things (IoT) projects and headless servers.
LibreELEC and OSMC
These media center distributions turn your Pi into a dedicated streaming device, supporting
popular services like Netflix, Kodi, and Plex.
12
Raspberry Pi OS
Beginner-friendly: Raspberry Pi OS boasts a familiar desktop interface with pre-installed
software for everyday tasks like browsing the web, watching videos, editing documents, and
coding. You don't need prior Linux experience to get started
•Lightweight and efficient: Optimized for Raspberry Pi's hardware, the OS runs smoothly
even on models with limited resources, making it ideal for resource-intensive projects like
robotics or IoT applications.
•Highly customizable: With access to the vast Debian package repository, you can install
countless software applications to tailor the OS to your specific needs and interests.
•Educational focus: Raspberry Pi OS includes educational software like Scratch and
Python, making it a fantastic platform for learning programming and electronics.
•Community-driven: A vibrant community of Raspberry Pi enthusiasts and developers
provides extensive support and resources, ensuring you're never alone in your Raspberry Pi
journey.
https://en.wikipedia.org/wiki/Raspberry_Pi_OS
13
Configuring Raspberry Pi
Pre-requisites
• Power Supply
• microSD Card
• Keyboard / Mouse
• TV/Monitor Screen
Steps
• Setup SD Card and install OS
• Connect Raspberry Pi
• Powerup
• Finish Installation
https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up
14
Programming Raspberry Pi with Python
15
https://realpython.com/python-raspberry-pi/
• Python comes preinstalled on Raspbian
• The Raspbian operating system comes with several preinstalled Python IDEs that you can use to write
can use to write your programs. One of these IDEs is Mu. It can be found in the main menu:
menu:
Raspberry Pi Icon → Programming → Mu
Steps
1.Open Mu by going to Raspberry Pi Icon → Programming → Mu.
2.Click New in the menu bar to create an empty file.
3.Click Save in the menu bar.
4.Navigate to the /home/pi directory in the directory dropdown.
5.Click the Create New Folder icon in the top-right corner.
6.Name this new directory python-projects and hit Enter.
7.Click Cancel to close.
Wireless temperature monitoring system using Pi
16
DS18B20 Temperature Sensor
17
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
ConnectingRaspberryPi via SSH
• Enable SSH on Raspberry Pi
•Connecting via SSH
• Find out IP Address
• hostname -I
• ssh username@IPAddress
https://raspberrypi-guide.github.io/networking/connecting-via-ssh
18
AccessingtemperaturefromDS18B20sensors
19
import os
import glob
import time
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
def read_temp_raw():
f = open(device_file, 'r')
lines = f.readlines()
f.close()
return lines
def read_temp():
lines = read_temp_raw()
while lines[0].strip()[-3:] != 'YES':
time.sleep(0.2)
lines = read_temp_raw()
equals_pos = lines[1].find('t=')
if equals_pos != -1:
temp_string = lines[1][equals_pos+2:]
temp_c = float(temp_string) / 1000.0
temp_f = temp_c * 9.0 / 5.0 + 32.0
return temp_c, temp_f
while True:
print(read_temp())
time.sleep(1)
Load the following kernel modules (w1-gpio and w1-therm) to interface with
the DS18B20 sensor via one-wire communication protocol.
The function read_temp_raw() gets the temperature readings from
the w1_slave file (that’s the place where those are stored). This function opens
the w1_slave file, reads its contents line by line, and then returns a list containing the
lines.
Reads the actual data
RemoteAccesstoRaspberryPi
20
Enable Remote Access:
•SSH (Secure Shell): This is the most common method for command-line access. It's typically enabled by default in
Raspberry Pi OS.
• To verify, open a terminal and type sudo raspi-config.
• Navigate to "Interfacing Options" > "SSH" and enable it if necessary.
•VNC (Virtual Network Computing): This allows for full graphical desktop access remotely.
• Go to "Menu" > "Preferences" > "Raspberry Pi Configuration" > "Interfaces" and enable VNC.
• Set a password for VNC access.
2. Find Your Raspberry Pi's IP Address:
•Open a terminal and type hostname -I to display its IP address on your local network.
•Note this address for connecting from other devices.
3. Choose Your Remote Access Method:
A. SSH (Command-Line Access):
•From a Linux or macOS computer: Open a terminal and type ssh pi@<IP_address> (replace <IP_address> with your
Pi's actual IP).
•From a Windows computer: Use an SSH client like PuTTY.
B. VNC (Graphical Desktop Access):
•Install a VNC viewer app on your device (e.g., VNC Viewer, RealVNC Viewer).
•Enter your Pi's IP address and VNC password when prompted.
C. Third-Party Remote Access Solutions:
•Chrome Remote Desktop: Simple setup for remote desktop access from anywhere (requires a Google account).
•TeamViewer: Versatile option for both desktop and command-line access, often used for professional support.

More Related Content

Similar to IoT for data science Module 5 - Raspberry Pi.pptx

Up and running with Raspberry Pi
Up and running with Raspberry PiUp and running with Raspberry Pi
Up and running with Raspberry PiShahed Mehbub
 
Raspberry Pi - Unlocking New Ideas for Your Library
Raspberry Pi - Unlocking New Ideas for Your LibraryRaspberry Pi - Unlocking New Ideas for Your Library
Raspberry Pi - Unlocking New Ideas for Your LibraryBrian Pichman
 
Iaetsd the world’s smallest computer for programmers and app developers
Iaetsd the world’s smallest computer for programmers and app developersIaetsd the world’s smallest computer for programmers and app developers
Iaetsd the world’s smallest computer for programmers and app developersIaetsd Iaetsd
 
My presentation raspberry pi
My presentation raspberry piMy presentation raspberry pi
My presentation raspberry piHusainBhaldar21
 
Iaetsd the universal brain for all robots
Iaetsd the universal brain for all robotsIaetsd the universal brain for all robots
Iaetsd the universal brain for all robotsIaetsd Iaetsd
 
MPMC presentation.pptx
MPMC presentation.pptxMPMC presentation.pptx
MPMC presentation.pptxSoundharya54
 
Internet of things aktu lab file
Internet of things  aktu lab fileInternet of things  aktu lab file
Internet of things aktu lab fileNitesh Dubey
 
Raspberry Pi Technology
Raspberry Pi TechnologyRaspberry Pi Technology
Raspberry Pi TechnologyRavi Basil
 
Raspberry pi intro.
Raspberry pi intro.Raspberry pi intro.
Raspberry pi intro.Saiko Saiko
 
Raspberry Pi (Introduction)
Raspberry Pi (Introduction)Raspberry Pi (Introduction)
Raspberry Pi (Introduction)Mandeesh Singh
 
raspberrypi-130930053532-phpapp02.pdf
raspberrypi-130930053532-phpapp02.pdfraspberrypi-130930053532-phpapp02.pdf
raspberrypi-130930053532-phpapp02.pdfVedantSonawane16
 
Raspberry Pi training in Ludhiana
Raspberry Pi training in LudhianaRaspberry Pi training in Ludhiana
Raspberry Pi training in LudhianaE2MATRIX
 
Raspberry Pi Training in Chandigarh
Raspberry Pi Training in ChandigarhRaspberry Pi Training in Chandigarh
Raspberry Pi Training in ChandigarhE2MATRIX
 

Similar to IoT for data science Module 5 - Raspberry Pi.pptx (20)

Rasp berry Pi
Rasp berry PiRasp berry Pi
Rasp berry Pi
 
Up and running with Raspberry Pi
Up and running with Raspberry PiUp and running with Raspberry Pi
Up and running with Raspberry Pi
 
Raspberry Pi - Unlocking New Ideas for Your Library
Raspberry Pi - Unlocking New Ideas for Your LibraryRaspberry Pi - Unlocking New Ideas for Your Library
Raspberry Pi - Unlocking New Ideas for Your Library
 
Iaetsd the world’s smallest computer for programmers and app developers
Iaetsd the world’s smallest computer for programmers and app developersIaetsd the world’s smallest computer for programmers and app developers
Iaetsd the world’s smallest computer for programmers and app developers
 
My presentation raspberry pi
My presentation raspberry piMy presentation raspberry pi
My presentation raspberry pi
 
Iaetsd the universal brain for all robots
Iaetsd the universal brain for all robotsIaetsd the universal brain for all robots
Iaetsd the universal brain for all robots
 
MPMC presentation.pptx
MPMC presentation.pptxMPMC presentation.pptx
MPMC presentation.pptx
 
Internet of things aktu lab file
Internet of things  aktu lab fileInternet of things  aktu lab file
Internet of things aktu lab file
 
Raspberry Pi Technology
Raspberry Pi TechnologyRaspberry Pi Technology
Raspberry Pi Technology
 
Raspberry pi intro.
Raspberry pi intro.Raspberry pi intro.
Raspberry pi intro.
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
 
Raspberry Pi (Introduction)
Raspberry Pi (Introduction)Raspberry Pi (Introduction)
Raspberry Pi (Introduction)
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry pi
 
raspberrypi-130930053532-phpapp02.pdf
raspberrypi-130930053532-phpapp02.pdfraspberrypi-130930053532-phpapp02.pdf
raspberrypi-130930053532-phpapp02.pdf
 
Raspberry pi
Raspberry pi Raspberry pi
Raspberry pi
 
Raspberry Pi training in Ludhiana
Raspberry Pi training in LudhianaRaspberry Pi training in Ludhiana
Raspberry Pi training in Ludhiana
 
Raspberry Pi Technology
Raspberry Pi Technology Raspberry Pi Technology
Raspberry Pi Technology
 
Rasberry pi
 Rasberry pi Rasberry pi
Rasberry pi
 
Raspberry Pi Training in Chandigarh
Raspberry Pi Training in ChandigarhRaspberry Pi Training in Chandigarh
Raspberry Pi Training in Chandigarh
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
 

Recently uploaded

原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfBoston Institute of Analytics
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDRafezzaman
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.natarajan8993
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改yuu sss
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Cantervoginip
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfchwongval
 
IMA MSN - Medical Students Network (2).pptx
IMA MSN - Medical Students Network (2).pptxIMA MSN - Medical Students Network (2).pptx
IMA MSN - Medical Students Network (2).pptxdolaknnilon
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsVICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Canter
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdf
 
IMA MSN - Medical Students Network (2).pptx
IMA MSN - Medical Students Network (2).pptxIMA MSN - Medical Students Network (2).pptx
IMA MSN - Medical Students Network (2).pptx
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business Professionals
 

IoT for data science Module 5 - Raspberry Pi.pptx

  • 1. IoT For Data Science and Analytics "Anything that can be connected, will be connected" Sourav Tripathy
  • 3. IOT FOR DATA SCIENCE AND ANALYTICS Module 5 3
  • 4. Raspberry Pi Introduction to Raspberry Pi About Raspberry Pi board Hardware layout Operating Systems on Raspberry Pi Configuring Raspberry Pi Configuring Raspberry Pi with Python Wireless temperature monitoring system using Pi DS18B20 Temperature Sensor Connecting Raspberry Pi via SSH Accessing temperature from DS18B20 sensors Remote Access to Raspberry Pi 4
  • 5. Introduction to Raspberry Pi Raspberry Pi is defined as a minicomputer the size of a credit card that is interoperable with any input and output hardware device like a monitor, a television, a mouse, or a keyboard – effectively converting the set-up into a full-fledged PC at a low cost. •Affordable: Prices start as low as $5 for the Raspberry Pi Pico and increase depending on model and capabilities. •Compact: Pocket-sized design (typically around the size of a credit card) makes it portable and convenient. •Powerful: Can handle diverse tasks with processors ranging from single-core to quad-core and RAM from 256MB to 8GB. •Versatile: Offers various input/output ports, including HDMI, USB, and GPIO pins for connecting to different devices and sensors. •Open-source: Supported by a large and active community and runs on open-source operating systems like Raspberry Pi OS (based on Linux). https://www.raspberrypi.com/documentation/computers/getting-started.html#setting-up-your- raspberry-pi 5
  • 6. Raspberry Pi and Arduino Difference 6 Feature Raspberry Pi Arduino Type of device Microcomputer Microcontroller Processing power More powerful Less powerful Operating system Runs a full operating system, such as Raspberry Pi OS or Ubuntu Doesn't run an operating system Programming language Python, Java, C++, Scratch C++ Connectivity Wi-Fi, Bluetooth, Ethernet Limited to USB Cost More expensive Less expensive Complexity More complex to set up and use Simpler to set up and use Best for Complex projects that require multitasking and internet connectivity Simple projects that require controlling hardware
  • 7. Raspberry Pi and Arduino Difference 7 •Processing power: Raspberry Pi has a more powerful processor, which means it can handle more complex tasks, such as running multiple programs at the same time or processing large amounts of data. Arduino has a simpler processor, which is better suited for smaller, more focused tasks. •Operating system: Raspberry Pi runs a full operating system, which gives you more flexibility and control over your projects. Arduino doesn't run an operating system, so you have less control over how it works. •Programming language: Raspberry Pi can be programmed in a variety of languages, including Python, Java, and C++. Arduino can only be programmed in C++. •Connectivity: Raspberry Pi has built-in Wi-Fi, Bluetooth, and Ethernet connectivity, which makes it easy to connect to the internet and other devices. Arduino typically only has USB connectivity. •Cost: Raspberry Pi is more expensive than Arduino. However, it is also more powerful and versatile. •Complexity: Raspberry Pi is more complex to set up and use than Arduino. This is because it runs an operating system and has more features. However, there are many resources available to help you get started with Raspberry Pi. •Best for: Raspberry Pi is best for complex projects that require multitasking and internet
  • 8. Raspberry Pi board : Hardware layout 8
  • 9. Raspberry Pi board : Hardware layout 9 https://www.youtube.com/watch?v=oWxeoU9v3K8 http://meseec.ce.rit.edu/551-projects/spring2017/2-3.pdf
  • 10. Raspberry Pi board : Hardware layout 10 System on a Chip (SoC): This is the brain of the Raspberry Pi, integrating the Central Processing Unit (CPU), Graphics Processing Unit (GPU), and Random Access Memory (RAM) onto a single chip. Different models boast varying processing power and graphics capabilities Storage: The Raspberry Pi relies on a microSD card for storing its operating system and files. Choose a high-quality card with sufficient capacity for your needs, as it plays a crucial role in performance and data safety Power Supply: A stable power supply is vital for smooth operation. Most models require a Micro USB or USB-C power supply that can deliver at least 2.5 amps of current. Choose a reliable power adapter to avoid any hiccups. Input/Output (I/O) Ports: •HDMI: for connecting to a monitor or TV •USB: for connecting peripherals like keyboards, mice, and external storage •Ethernet: for wired network connection •3.5mm jack: for audio output •MicroSD card slot: for storage expansion
  • 11. Raspberry Pi board : Hardware layout 11 General-Purpose Input/Output (GPIO) Pins: These 40 pins on the Raspberry Pi's header offer immense flexibility. You can connect various sensors, actuators, and other devices to interact with the physical world, enabling exciting projects like robotics, home automation, and more. 3V3 3.3 volts Anything connected to these pins will always get 3.3V of power 5V 5 volts Anything connected to these pins will always get 5V of power GND ground Zero volts, used to complete a circuit GP2 GPIO pin 2 These pins are for general-purpose use and can be configured as input or output pins ID_SC/ID_SD/DNC Special purpose pins
  • 12. Operating Systems on Raspberry Pi Raspberry PI needs optimized OS suitable to run on Raspberry Pi hardware. Raspberry Pi OS (formerly Raspbian) The official and most popular choice, based on Debian Linux. Beginner-friendly with a desktop environment and pre-installed software. Available in 32-bit and 64-bit versions. Ubuntu Core Another Linux-based option, lightweight and focused on security and minimal resource usage. Ideal for Internet of Things (IoT) projects and headless servers. LibreELEC and OSMC These media center distributions turn your Pi into a dedicated streaming device, supporting popular services like Netflix, Kodi, and Plex. 12
  • 13. Raspberry Pi OS Beginner-friendly: Raspberry Pi OS boasts a familiar desktop interface with pre-installed software for everyday tasks like browsing the web, watching videos, editing documents, and coding. You don't need prior Linux experience to get started •Lightweight and efficient: Optimized for Raspberry Pi's hardware, the OS runs smoothly even on models with limited resources, making it ideal for resource-intensive projects like robotics or IoT applications. •Highly customizable: With access to the vast Debian package repository, you can install countless software applications to tailor the OS to your specific needs and interests. •Educational focus: Raspberry Pi OS includes educational software like Scratch and Python, making it a fantastic platform for learning programming and electronics. •Community-driven: A vibrant community of Raspberry Pi enthusiasts and developers provides extensive support and resources, ensuring you're never alone in your Raspberry Pi journey. https://en.wikipedia.org/wiki/Raspberry_Pi_OS 13
  • 14. Configuring Raspberry Pi Pre-requisites • Power Supply • microSD Card • Keyboard / Mouse • TV/Monitor Screen Steps • Setup SD Card and install OS • Connect Raspberry Pi • Powerup • Finish Installation https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up 14
  • 15. Programming Raspberry Pi with Python 15 https://realpython.com/python-raspberry-pi/ • Python comes preinstalled on Raspbian • The Raspbian operating system comes with several preinstalled Python IDEs that you can use to write can use to write your programs. One of these IDEs is Mu. It can be found in the main menu: menu: Raspberry Pi Icon → Programming → Mu Steps 1.Open Mu by going to Raspberry Pi Icon → Programming → Mu. 2.Click New in the menu bar to create an empty file. 3.Click Save in the menu bar. 4.Navigate to the /home/pi directory in the directory dropdown. 5.Click the Create New Folder icon in the top-right corner. 6.Name this new directory python-projects and hit Enter. 7.Click Cancel to close.
  • 16. Wireless temperature monitoring system using Pi 16
  • 17. DS18B20 Temperature Sensor 17 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
  • 18. ConnectingRaspberryPi via SSH • Enable SSH on Raspberry Pi •Connecting via SSH • Find out IP Address • hostname -I • ssh username@IPAddress https://raspberrypi-guide.github.io/networking/connecting-via-ssh 18
  • 19. AccessingtemperaturefromDS18B20sensors 19 import os import glob import time os.system('modprobe w1-gpio') os.system('modprobe w1-therm') base_dir = '/sys/bus/w1/devices/' device_folder = glob.glob(base_dir + '28*')[0] device_file = device_folder + '/w1_slave' def read_temp_raw(): f = open(device_file, 'r') lines = f.readlines() f.close() return lines def read_temp(): lines = read_temp_raw() while lines[0].strip()[-3:] != 'YES': time.sleep(0.2) lines = read_temp_raw() equals_pos = lines[1].find('t=') if equals_pos != -1: temp_string = lines[1][equals_pos+2:] temp_c = float(temp_string) / 1000.0 temp_f = temp_c * 9.0 / 5.0 + 32.0 return temp_c, temp_f while True: print(read_temp()) time.sleep(1) Load the following kernel modules (w1-gpio and w1-therm) to interface with the DS18B20 sensor via one-wire communication protocol. The function read_temp_raw() gets the temperature readings from the w1_slave file (that’s the place where those are stored). This function opens the w1_slave file, reads its contents line by line, and then returns a list containing the lines. Reads the actual data
  • 20. RemoteAccesstoRaspberryPi 20 Enable Remote Access: •SSH (Secure Shell): This is the most common method for command-line access. It's typically enabled by default in Raspberry Pi OS. • To verify, open a terminal and type sudo raspi-config. • Navigate to "Interfacing Options" > "SSH" and enable it if necessary. •VNC (Virtual Network Computing): This allows for full graphical desktop access remotely. • Go to "Menu" > "Preferences" > "Raspberry Pi Configuration" > "Interfaces" and enable VNC. • Set a password for VNC access. 2. Find Your Raspberry Pi's IP Address: •Open a terminal and type hostname -I to display its IP address on your local network. •Note this address for connecting from other devices. 3. Choose Your Remote Access Method: A. SSH (Command-Line Access): •From a Linux or macOS computer: Open a terminal and type ssh pi@<IP_address> (replace <IP_address> with your Pi's actual IP). •From a Windows computer: Use an SSH client like PuTTY. B. VNC (Graphical Desktop Access): •Install a VNC viewer app on your device (e.g., VNC Viewer, RealVNC Viewer). •Enter your Pi's IP address and VNC password when prompted. C. Third-Party Remote Access Solutions: •Chrome Remote Desktop: Simple setup for remote desktop access from anywhere (requires a Google account). •TeamViewer: Versatile option for both desktop and command-line access, often used for professional support.