Professional Documents
Culture Documents
COLLEGE OF ENGINEERING
POTTAPALAYAM - 6 3 0 6 1 2
Compiled By
SYLLABUS
LIST OF EXPERIMENTS
3.Write a server application to interface IoT protocols and cloud by using data analytics
4.Interface the Raspberry Pi with cloud to trans-receive data from sensors and actuators
THEORY:
WHAT IS RASPBIAN?
Raspbian is a Debian-based computer operating system for Raspberry Pi. Since 2015 till now it is
officially provided by the Raspberry Pi Foundation as the primary operating system for the family of
Raspberry Pi single-board computers.
Raspbian was created by Mike Thompson and Peter Green as an independent project.
The initial build was completed in June 2012.
He operating system is still under active development.
Raspbian is highly optimized for the Raspberry Pi line's low-performance ARM CPUs
Raspbian uses PIXEL, Pi Improved Xwindows Environment, Lightweight as its main desktop
environment as of the latest update.
It is composed of a modified LXDE desktop environment and the Open-box stacking window manager
with a new theme and few other changes.
The distribution is shipped with a copy of computer algebra program Mathematica and a version of
Minecraft called Minecraft Pi as well as a lightweight version of Chromium as of the latest version .
DOWNLOAD
BASIC FEATURES
OS family Unix-like
Platforms ARM
Userland GNU
GUI
HOW TO WRITE DISK IMAGE?
FINALIZATION
PROGRAMMING LANGUAGES
•C
• C++
• Java
• Scratch
SOFTWARE MANAGEMENT ON PI
ACCESSING PI IN LINUX
• ssh pi@raspberrypi
• ssh pi@192.168.1.3
REFERENCES
Blogs http://digitallocha.blogspot.in,http://kyamputar.blogspot.in
RESULT: Thus, the Raspberry pi installation and its different operating systems have been studied
successfully.
EXPT-2 INTERFACE VARIOUS SENSORS AND COMMUNICATION
MODULES WITH RASPBERRY PI
AIM: To Interface various sensors and communication modules with Raspberry Pi. Here we are
experimenting this using ultra sonic sensor
APPARATUS REQUIRED:
Raspberry pi 3B+
Ultrasonic sensor
Breadboard
Wires
Resistors.
CIRCUIT DIAGAM:
PROGRAM CODE:
PROCEDURE:
Identify the sensors and communication modules: Determine the specific sensors and communication
modules you want to interface with your Raspberry Pi 3B+. This could include sensors like
temperature, humidity, motion, or any other desired modules such as Bluetooth, Wi-Fi, or GSM.
Check compatibility: Ensure that the sensors and communication modules you have chosen are
compatible with the Raspberry Pi 3B+. Verify the technical specifications and ensure that they use
compatible communication protocols such as GPIO, I2C, SPI, UART, or USB.
Connect the hardware: Connect the sensors and communication modules to the Raspberry Pi 3B+. Use
the appropriate cables or connectors based on the communication protocol supported by each module.
Install required software libraries: Install the necessary software libraries or drivers required to
interface with the sensors and communication modules. Most sensor manufacturers provide software
libraries or APIs that can be used to access sensor data. Install these libraries or drivers on your
Raspberry Pi 3B+ by following the manufacturer's instructions.
Write code to interface with the modules: Use a programming language like Python to write code that
interacts with the sensors and communication modules. Refer to the documentation or examples
provided by the sensor manufacturers or the Raspberry Pi community for guidance on how to access
sensor data or control the communication modules.
Test and integrate: Run your code on the Raspberry Pi 3B+ and test the interface with the sensors and
communication modules. Verify that you can successfully read data from the sensors or send/receive
data using the communication modules. Make any necessary adjustments or modifications to your code
as needed.
1.BLUETOOTH
2. HUMIDITY SENSOR
RESULT: Thus, interfacing various sensors with raspberry pi has been executed successfully.
.
AIM: To Write a server application to interface IoT protocols and cloud by using data analytics
APPARAUS REQUIRED:
Raspberry pi 3B+
Cloud Account
A data analytics tool (Tableau,Excel)
CIRCUIT DIAGRAM:
PROGRAM
import sqlite3
import time
import random
# Step 1: Define Requirements - Choose IoT Protocol (Simulate data for example)
class IoTDevice:
def get_data(self):
# Simulate IoT data: Replace this with actual data retrieval logic
class DataStorage:
def __init__(self):
self.conn = sqlite3.connect('iot_data.db')
self.create_table()
def create_table(self):
with self.conn:
def analyze_data(data):
# Perform simple analytics on the data (e.g., calculating average temperature and humidity)
if __name__ == '__main__':
iot_device = IoTDevice()
data_storage = DataStorage()
try:
while True:
timestamp = int(time.time())
temperature, humidity = iot_device.get_data()
# Step 4: Data Analytics - Retrieve data from the database and perform analysis
with data_storage.conn:
data = cursor.fetchall()
if len(data) > 0:
time.sleep(5) # Wait for 5 seconds between data points (simulating real-time data)
except KeyboardInterrupt:
Clearly define the project's objectives, including the IoT data you want to collect and analyze, the
type of analytics you'll perform, and the cloud platform (if any) you'll use.
Decide on the IoT communication protocols you want to support (e.g., MQTT, CoAP, HTTP) based
on your IoT device capabilities and the server application's requirements.
Set up a development environment for the server application. Install Python and any required
libraries or frameworks.
If you don't have physical IoT devices, you can simulate IoT data using Python scripts to generate
random sensor data.
Start by building the core server application responsible for receiving and processing data from IoT
devices.
Implement handlers for the chosen IoT protocols in the server application to receive data from IoT
devices.
Set up a database (e.g., SQLite, MySQL) to store the incoming IoT data. Design the database schema
to accommodate the data fields.
Implement data preprocessing if necessary, such as cleaning data, handling missing values, and
converting data types.
If you require real-time data analytics, implement algorithms to analyze data as it arrives.
Step 10: Data Storage and Cloud Integration
If you plan to use a cloud platform, integrate the server application with the chosen cloud service
(e.g., AWS, Azure).
Implement data analytics algorithms, such as computing averages, aggregations, or applying machine
learning models for predictive analytics.
Develop a user interface or dashboard to visualize real-time data and analytics results.
Implement security measures like encryption, secure communication protocols (e.g., SSL/TLS), and
access controls.
Optimize the server application for scalability to handle a large number of IoT devices and data
streams.
Thoroughly test the application for data correctness, functionality, and performance. Perform unit
tests and integration tests.
Deploy the server application and any associated services to a suitable infrastructure (e.g., cloud, on-
premises server).
Regularly maintain the application, update dependencies, and handle bug fixes or security patches.
Continuously monitor the system's performance and usage. Collect user feedback and make
improvements based on requirements and feedback.
RESULT: Thus, a server application to interface IoT protocols and cloud by using data analytics has been
executed successfully
Expt-4 INTERFACE THE RASPBERRY PI WITH CLOUD TO TRAN-RECEIVE DATA FROM
SENSORS AND ACTUATORS
AIM: To Interface the Raspberry Pi with cloud to trans-receive data from sensors and actuators
APPARATUS REQUIRED:
Raspberry pi 3B+
DHT11 sensor
Breadboard
Wires.
Cloud Account (ThingSpeak)
CIRCUIT DIAGRAM:
PROGRAM
import Adafruit_DHT
import Adafruit_DHT
import os,sys
import paho.mqtt.client as paho
import urlparse
import time
else:
print ('Failed to get reading. Try again!')
PROCEDURE:
Sign up for a ThingSpeak account: Visit the ThingSpeak website (https://thingspeak.com) and create
an account. This will provide you with a platform to store, analyze, and visualize your sensor data.
Set up your channels: In ThingSpeak, create channels to represent the sensors and actuators you
want to interface with. Each channel will have a unique API key that will be used for data
transmission.
Connect the Raspberry Pi to ThingSpeak: Install the ThingSpeak client library on your Raspberry Pi.
This library allows communication between the Raspberry Pi and ThingSpeak. You can use the
ThingSpeak library for Python, which provides easy-to-use functions for sending and receiving data.
Collect and transmit sensor data: Write a Python script on the Raspberry Pi that collects data from
the sensors. Use the ThingSpeak library to transmit this data to the corresponding channels in
ThingSpeak. Configure the script to run periodically or based on specific events to ensure
continuous data transmission
Monitor and control actuators: Set up the necessary control mechanisms in ThingSpeak to activate
or control your actuators based on the received data. This could involve writing custom MATLAB
code or using the ThingSpeak React feature to define rules and actions that trigger based on certain
conditions.
RESULT: Thus, interfacing of Raspberry Pi with cloud to trans-receive data from sensors and actuators has
been executed successfully
Expt-5 DESIGN BUSINESS MODEL AND DEPLOY HOME AUTOMATION USING
RASPBERRY PI
AIM: To Design business model and deploy Home Automation using Raspberry Pi.
APPARATUS REQUIRED:
Raspberry pi 3B+
LED s
Resistors
Breadboard
Wires.
CIRCUIT DIAGRAM:
PROGRAM
import time
app = Flask(__name__)
led1 = 2
led2 = 3
led3 = 4
GPIO.setwarnings(False)
GPIO.setmode (GPIO.BCM)
GPIO.setup(led1, GPIO.OUT)
GPIO.setup(led2, GPIO.OUT)
GPIO.output (led2, 0)
GPIO.output(led3. 0)
print ("Done")
@app.route(""):
def index():
return render_template('index.html')
@app.route('/A')
def ledion():
GPIO.output (led1, 1)
return render_template('index.html')
@app.route('/a')
Define your business model: Determine the specific aspects of your home automation business model.
Identify your target customers, the value proposition you offer, revenue streams, and key activities. Consider
whether you will sell products, offer services, or both. Determine if you will operate on a subscription-based
model, one-time purchases, or a combination.
Plan your home automation system: Define the scope of your home automation system. Identify the
specific devices and functionalities you want to offer, such as smart lighting, security systems, temperature
control, or entertainment systems. Consider compatibility with the Raspberry Pi 3B+ and the availability of
compatible sensors, actuators, and communication modules.
Procure necessary components: Purchase the required hardware components, such as Raspberry Pi 3B+
boards, sensors, actuators, and communication modules based on your planned home automation system.
Ensure compatibility and quality of the components, and consider scalability for future expansion.
Install and configure the Raspberry Pi: Set up the Raspberry Pi 3B+ by installing the operating system
(such as Raspbian) and necessary software libraries or frameworks for home automation. Configure network
settings, security measures, and remote access capabilities.
Connect and program the devices: Interface the sensors and actuators with the Raspberry Pi 3B+. Use
appropriate connection methods, such as GPIO pins, I2C, SPI, or USB, based on the devices' specifications.
Write code in a suitable programming language, such as Python, to interact with the devices, control their
functionalities, and collect data.
Develop a user interface: Design and develop a user-friendly interface to allow homeowners to control
and monitor their home automation system. This could be a web-based dashboard, a mobile application, or a
combination of both. Ensure seamless integration with the Raspberry Pi and the ability to remotely access
and control the system.
Test, deploy, and support: Thoroughly test the home automation system to ensure its functionality,
reliability, and security. Deploy the system at customers' homes and provide necessary support and
maintenance. Continuously gather feedback from customers to improve the system, add new features, and
address any issues that arise
RESULT: Thus, Business model and deployment of Home Automation using Raspberry Pi has been executed
successfully.