IoT Lab File 2024-25
IoT Lab File 2024-25
6 Course Outcome 9
9 Evaluation Scheme 15
12 Programs 18-71
Faculty Details
Course Details
SESSION-2024-25
To be an institute of academic excellence in the field of education, with future plan of becoming a
deemed university, earn name and hence win faith of the society.
Mission of Institute
To impart to its students a high-quality education, develop their skills, broaden their mental horizon
and nurture them into competent and talented professionals to meet the challenges of the new
millennium.
SESSION-2024-25
Institute
School of Computer Science Engineering in Emerging Technologies
SESSION-2024-25
CSBS Department
Vision and Mission of the Department
Vision
Mission
M2: To nurture lifelong learning practices, knowledge, and 21st century skills with focus on
entrepreneurship, research, and innovation.
M3: To produce globally competent and ethical professionals ready to serve the society.
School of Computer Science Engineering in Emerging Technologies
SESSION-2024-25
PEO3: Demonstrate effective business communication with innovation mindset who can
effectively work in a team and exhibit strong ethics and life values to serve the society
School of Computer Science Engineering in Emerging Technologies
SESSION-2024-
25
Program Specific Outcomes
SEM-7th (ODD)
SESSION-2024-25
Program Outcomes
2. Problem analysis: Identify, formulate, research literature, and analyse complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences,
and engineering sciences.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools, including prediction and modeling to complex engineering activities, with
an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
effective reports and design documentation, make effective presentations, and give and receive clear
instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and leader
in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
School of Computer Science Engineering in Emerging Technologies
SESSION-2024-25
SESSION-2024-25
Course Outcomes
SESSION-2024-25
CO1 3 2 2 1 3 1 2 1 1 2 1 3
CO2 3 3 3 2 3 1 1 2 2 2 2 3
CO3 3 3 3 3 3 3 3 2 2 3 2 3
SESSION-2024-25
SESSION-2024-25
CO2 3 3 2
CO3 3 3 3
3 3 2.3
AVG
School of Computer Science Engineering in Emerging Technologies
SESSION-2024-25
SESSION-2024-25
SESSION-2024-25
P.
S.NO. PRACTICAL CONDUCTED Date Signature
No.
1. Setting up the Arduino Development Environment, 31-07-24
connecting analog sensors to an Arduino Boarding and 07-08-24
reading analog sensor data.
2. Digital Input and Output reading using and Arduino board 14-08-24
and Arduino Development Environment. 21-08-24
3. Integrate an Arduino Board to a Raspberry Pi computer and 28-08-24
send sensor data from Arduino to the R Pi. 11-09-24
4. Setup Python on the R Pi and run sample R Pi programs on 18-09-24
the R Pi. Read the data from Arduino using Python 25-09-24
language.
5. Connect a R Pi Camera module to the Raspberry Pi and 09-10-24
using Python programming capture still images and video. 16-10-24
6. Set up TCP/IP socket server on a PC. Send a message from 23-10-24
the R Pi to the PC using socket communication. 30-10-24
7. Set up a MQTT broker on the PC. Send data from R Pi to PC 25-09-24
using MQTT protocol. Receive data from PC to R Pi using 06-11-24
MQTT protocol. .
8. Connect LED lights to an Arduino. Connect the Arduino to 13-11-24
the R Pi. Send Message from PC to R Pi via MQTT protocol. 20-11-24
On receipt of the message, toggle the LED lights on the
Arduino.
9. Set up an account in a cloud service (such as Google / AWS 20-11-24
or Azure). Set up a simple Http server using a language of
your choice. Push the image captured from the R Pi camera
to this web service. On receiving the image, store the
image in a database or file.
10. Develop a mobile application to view the images captured 27-11-24
by the R Pi camera.
SESSION-2024-25
Program No-1
SEM-7th (ODD)
AIM :- Digital Input and Output reading using and Arduino board and Arduino Development
Environment.
Reading Digital Input:
Step 1: Connect a Digital Input Device (Push Button):
Connect Push Button:
Connect a push button to one of the digital pins on the Arduino board. Connect one leg of the
button to the digital pin and the other leg to ground. You may also use a resistor (e.g., 10k ohms)
as a pull-up or pull- down resistor depending on your button's configuration.
Adjust Code:
Open the Arduino IDE.
Write a simple sketch to read the state of the
button. const int buttonPin = 2; int buttonState
= 0; void setup() {
pinMode(buttonPin, INPUT);
Serial.begin(9600);
} void
loop() {
buttonState =
digitalRead(buttonPin);
Serial.println(buttonState);
delay(1000);
}
AIM :- Integrate an Arduino Board to a Raspberry Pi computer and send sensor data from
Arduino to the R Pi.
Hardware Setup:
Connect Arduino to Raspberry Pi:
Connect the Arduino to the Raspberry Pi using a USB cable. This allows the Raspberry Pi to
communicate with the Arduino over the USB serial connection.
Power Supply:
Power the Arduino using an external power source or the Raspberry Pi's USB ports.
Connect Sensors:
Connect your analog or digital sensors to the Arduino. Follow the wiring instructions for each
sensor.
Software Setup:
Arduino Side:
Upload Sensor Reading Sketch:
Write an Arduino sketch to read sensor data and send it over the
serial port const int sensorPin = A0; void setup() {
Serial.begin(9600);
} void
loop() {
int sensorValue =
analogRead(sensorPin);
Serial.println(sensorValue);
delay(1000);
}
Write Python Script:
Write a Python script to read data from the Arduino over the serial port.
import serial
import time
ser = serial.Serial('/dev/ttyUSB0',
9600) try: while True:
if ser.in_waiting > 0:
sensor_data = ser.readline().decode('utf-8').strip()
print("Sensor Data:", sensor_data)
time.sleep(1)
except KeyboardInterrupt:
ser.close()
Data Processing:
Modify the Python script to process the sensor data according to your application's requirements.
SESSION-2024-25
Program No-4
SEM-7th (ODD)
AIM :- Setup Python on the R Pi and run sample R Pi programs on the R Pi. Read the data from
Arduino using Python language.
To read data from Arduino using Python on a Raspberry Pi
1. Install Python on Raspberry Pi:
Most Raspberry Pi distributions come with Python preinstalled. However.
3. Install PySerial:
PySerial is a Python library for reading and writing data over a serial connection.
AIM:- Connect a R Pi Camera module to the Raspberry Pi and using Python programming
capture still images and video. Capture Still Images:
from picamera import
PiCamera import time
camera = PiCamera()
image_name =
"captured_image.jpg"
camera.capture(image_name)
time.sleep(1) camera.close()
print(f"Image captured and saved as {image_name}")
Capture Video:
from picamera import
PiCamera import time
camera = PiCamera()
camera.resolution = (640,
480) camera.framerate = 30
video_duration = 10 # Set the duration of the video in
seconds video_name = "captured_video.h264"
camera.start_recording(video_name)
camera.wait_recording(video_duration)
camera.stop_recording() camera.close()
print(f"Video captured and saved as {video_name}")
Output:-
SESSION-2024-25
Program No-6
SEM-7th (ODD)
AIM :- Set up TCP/IP socket server on a PC. Send a message from the R Pi to the PC using
socket communication.
Set Up TCP/IP Socket Server on PC:
import socket
HOST = '0.0.0.0'
PORT = 12345
server_socket = socket.socket(socket.AF_INET,
socket.SOCK_STREAM) server_socket.bind((HOST, PORT))
server_socket.listen(1)
print(f"Server listening on {HOST}:{PORT}")
client_socket, client_address =
server_socket.accept() print(f"Connection
established with {client_address}") data =
client_socket.recv(1024).decode('utf-8')
print(f"Received data: {data}")
client_socket.close() server_socket.close()
{message}") client_socket.close()
Output:-
SESSION-2024-25
Program No-7
SEM-7th (ODD)
AIM:- Set up a MQTT broker on the PC. Send data from R Pi to PC using MQTT protocol.
Receive data from PC to R Pi using MQTT protocol.
Send Data from Raspberry Pi to PC:
import time
import random
import paho.mqtt.client as mqtt
broker_address =
"PC_IP_ADDRESS" port = 1883
topic = "sensor_data" client =
mqtt.Client()
client.connect(broker_address, port,
60) try: while True:
sensor_data = random.randint(1, 100)
client.publish(topic, f"Sensor Data:
{sensor_data}") print(f"Published: Sensor
Data: {sensor_data}") time.sleep(5) except
KeyboardInterrupt: client.disconnect()
Output:-
SESSION-2024-25
Program No-8
SEM-7th (ODD)
AIM:- Connect LED lights to an Arduino. Connect the Arduino to the R Pi. Send Message from
PC to R Pi via MQTT protocol. On receipt of the message, toggle the LED lights on the Arduino.
To achieve the described setup, we need the following components:
Arduino board
LED lights
Raspberry Pi (R Pi)
PC
MQTT broker (such as Mosquitto)
Arduino Setup:
Connect the LED to one of the digital pins on the Arduino.
Connect the Arduino to your PC and upload a simple Arduino sketch to toggle the LED when it
receives a message through the serial port.
Python script to subscribe to the MQTT topic and send the messages to the Arduino via its serial
port: import paho.mqtt.client as mqtt import serial import time
arduino_port = "/dev/ttyACM0"
mqtt_broker =
"YOUR_MQTT_BROKER_IP"
mqtt_topic = "led_control"
ser = serial.Serial(arduino_port, 9600,
timeout=1) def on_connect(client, userdata,
flags, rc):
print("Connected to MQTT broker with result code
"+str(rc)) client.subscribe(mqtt_topic) def
on_message(client, userdata, msg): message =
msg.payload.decode('utf-8') print(f"Received message:
{message}") ser.write(message.encode()) client =
mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.connect(mqtt_broker, 1883,
60) client.loop_start() try: while
True: time.sleep(1) except
KeyboardInterrupt:
ser.close()
client.disconnect()
print("Disconnected from MQTT broker and Arduino.")
With this setup, when we send an MQTT message from your PC to the Raspberry Pi, the Python
script on the Raspberry Pi will forward the message to the Arduino, which will then toggle the
LED based on the received message.
SESSION-2024-25
Program No-9
SEM-7th (ODD)
AIM:- Set up an account in a cloud service (such as Google / AWS or Azure). Set up a simple
Http server using a language of your choice. Push the image captured from the R Pi camera to this
web service. On receiving the image, store the image in a database or file.
AWS Setup:
Create an AWS Account:
Go to the AWS website and create an account.
Create an S3 Bucket:
Go to the AWS S3 Console.
Create a new bucket to store the images.
AIM:- Develop a mobile application to view the images captured by the R Pi camera.
import
'package:flutter/material.dart';
import 'package:http/http.dart' as
http; import 'dart:convert'; void
main() { runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext
context) { return
MaterialApp( title: 'Image
Viewer', theme:
ThemeData( primarySwatch:
Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<ImageInfo> imageList = [];
@override void
initState()
{ super.initState(
);
fetchImageList();
}
Future<void> fetchImageList() async {
final response = await http.get('http://YOUR_FLASK_SERVER_IP:5000/images'); if (response.statusCode
== 200) {
List<dynamic> data = jsonDecode(response.body); setState(() {
imageList = data.map((item) => ImageInfo.fromJson(item)).toList();
}); } else {
throw Exception('Failed to load image list');
}
}
@override
Widget build(BuildContext context) { return Scaffold( appBar:
AppBar( title: Text('Image Viewer'),
),
body: ListView.builder( itemCount: imageList.length,
itemBuilder: (context, index) { return ListTile(
title: Text(imageList[index].filename), subtitle:
Image.network(imageList[index].url),
);
},
),
);
}
} class ImageInfo { final String filename; final
String url;
ImageInfo({required this.filename, required this.url}); factory
ImageInfo.fromJson(Map<String, dynamic> json) { return ImageInfo( filename:
json['filename'], url: json['url'],
);
}
}
Output:-
SESSION-2024-25
VIVA QUESTIONS
SEM-7th (ODD)
2. Architecture