0% found this document useful (0 votes)
70 views29 pages

IOT Record

The document is a record of practical work done in the Internet of Things Lab by a student enrolled in the I M.Sc (Information Technology) program at G. Venkataswamy Naidu College. It contains the student's registration number, subject code, and is certified by the staff in charge and head of the department. The record contains 8 experiments conducted between August 29, 2022 and November 3, 2022 related to programming concepts in Python and Arduino, including working with data types, arithmetic operations, looping statements, interfacing with an LCD, using ultrasonic sensors and buzzers, temperature detection, and controlling LEDs and RGB lights.

Uploaded by

Kaleeswari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views29 pages

IOT Record

The document is a record of practical work done in the Internet of Things Lab by a student enrolled in the I M.Sc (Information Technology) program at G. Venkataswamy Naidu College. It contains the student's registration number, subject code, and is certified by the staff in charge and head of the department. The record contains 8 experiments conducted between August 29, 2022 and November 3, 2022 related to programming concepts in Python and Arduino, including working with data types, arithmetic operations, looping statements, interfacing with an LCD, using ultrasonic sensors and buzzers, temperature detection, and controlling LEDs and RGB lights.

Uploaded by

Kaleeswari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

G.VENKATASWAMY NAIDU COLLEGE (SFC), KOVILPATTI.

(An Autonomous Institution | Affiliated to Manonmaniam Sundaranar University)


(Re-Accredited with 'A' Grade by NAAC| DBT Star College Status)

Record of Internet of Things Lab practical work in


I M.Sc (Information Technology)

Register No :

Subject Code : P22IT104

This is certified to be the Bonafide Record of the work done by


of I M.Sc (Information Technology).

STAFF IN CHARGE HEAD OF THE DEPARTMENT

Submitted for the practical examination held on at


G. VENKATASWAMY NAIDU COLLEGE, KOVILPATTI.

PLACE : EXTERNAL EXAMINERS


DATE : 1.
2.
INDEX

S.NO DATE PROGRAM NAME PG.NO SIGNATURE

Write a program to demonstrate different


1 29.08.2022
number datatypes in python.
Write a program to arithmetic operations in
2 01.09.2022
python.
Write a program for looping statement in
3 06.09.2022
Python.

4 08.09.2022 Interfacing Arduino with LCD.

5 21.09.2022 Ultrasonic Sensor and buzzer with Arduino

6 23.09.2022 Temperature Notification using Arduino

7 17.10.2022 Program using Arduino IDE for blink LED.

Program for RGB LED using Arduino.


8 29.10.2022
Gas sensor detector with Arduino.
9 03.11.2022
Ex. No : 1
Date : 29.08.2022
Write a program to demonstrate different number datatypes in python.
AIM:-
To write a python program for data type print.

ALGORITHM:-
STEP 1:Start the program

STEP 2:Take the first input from user as a ,b,c

STEP 3:Perform a type() function

STEP 4:Print the value of a ,b,c data type

STEP 5:Also print their name

STEP 6:Run

STEP7: End
CODING:

a="hello world"
print(a)
print(type(a))
b=1015
print(b)
print(type(b))
c=12.56
print(c)
print(type(c))
d=complex(10j)
print(d)
print(type(d))
OUTPUT:

D:\Notes>python 1.py
hello world
<class 'str'>
1015
<class 'int'>
12.56
<class 'float'>
10j
<class 'complex'>

D:\Notes>

RESULT:
Thus the program was executed successfully and output was verified.
Ex. No : 2
Date : 01.09.2022
Write a program to arithmetic operations in python.
AIM:-
To write a Arithmetic program in python.
ALGORTHIM:-
STEP 1:Start the program

STEP 2:Take the first input from user as a

STEP 3:Then take the second input as b

STEP 4:Perform a algebraic operation(+,-,/,%,**,//*) for a variable c

STEP 5:Print the value of c++ for all operations

STEP 6:Also print their name

STEP 7:Run

STEP 8:End
CODING:

a=int(input("enter the first no:"))

print("the value of a=",a)

b=int(input("enter the second no.:"))

print("the value of b=",b)

print("====ADDITION====")

c=a+b

print("the value of c=",c)

print("====SUBSTRACTION====")

c=a-b

print("the value of c=",c)

print("====MULTIPLICATION====")

c=a*b

print("the value of c=",c)

print("====DIVISION====")

c=a/b

print("the value of c=",c)

print("====MODULUS====")

c=a%b

print("the value of c=",c)

print("====EXPONENTIAL====")

c=a**b

print("the value of c=",c)

print("====FLOOR_DIVISION====")

c=a//b

print("the value of c=",c)


OUTPUT:

D:\Notes>python 1.py
enter the first no:8
the value of a= 8
enter the second no.:4
the value of b= 4
====ADDITION====
the value of c= 12
====SUBSTRACTION====
the value of c= 4
====MULTIPLICATION====
the value of c= 32
====DIVISION====
the value of c= 2.0
====MODULUS====
the value of c= 0
====EXPONENTIAL====
the value of c= 4096
====FLOOR_DIVISION====
the value of c= 2

D:\Notes>

RESULT:
Thus the program was executed successfully and output was verified.
Ex. No : 3
Date : 06.09.2022

Write a Program for looping statement in Python.


.
AIM:-
To write a looping statement in python program.
ALGORITHM:-
STEP 1:Start the program
STEP 2:Take the first input from user as a

STEP 3:Then take the second input as b

STEP 4:Perform a algebraic operation(+,-,/,%,**,//*) for a variable c

STEP 5:Print the value of c++ for all operations

STEP 6:Also print their name

STEP 7:Run

STEP 8:End
CODING:

WHILE LOOP:

#while loop

a=int(input("enter the number="))

count = 0

while count < a:

print(count, " is less than 5")

count = count + 1

else:

print(count, " is not less than 5")

FOR LOOP:

#FOR LOOP

num = int(input("Enter the number: "))

print("Multiplication Table of", num)

for i in range(1, 11):

print(num,"X",i,"=",num * i)

NESTED LOOP:

#NESTED LOOP

print("Half Pyramid Pattern of Stars (*):")

for i in range(5):

for j in range(i+1):

print("* ", end="")

print()
OUTPUT:
D:\Notes>python 1.py
enter the number=8
0 is less than 5
1 is less than 5
2 is less than 5
3 is less than 5
4 is less than 5
5 is less than 5
6 is less than 5
7 is less than 5
8 is not less than 5
Enter the number: 7
Multiplication Table of 7
7X1=7
7 X 2 = 14
7 X 3 = 21
7 X 4 = 28
7 X 5 = 35
7 X 6 = 42
7 X 7 = 49
7 X 8 = 56
7 X 9 = 63
7 X 10 = 70
Half Pyramid Pattern of Stars (*):
*
**
***
****
*****

RESULT:
Thus the program was executed successfully and output was verified.
Ex. No : 4
Date : 08.09.2022
Interfacing Arduino with LCD.
AIM:

To write a program to get interfacing with LCD Arduino.

COMPONENTS REQUIRED:

1. LCD Board.

2. Jumper wires.

3. Connectivity cable or USB cable.

ALGORITHM:

STEP 1: Start the process.


STEP 2: Start ->Arduino 1.8.8
STEP 3: Then enter the coding in Arduino software.
STEP 4: Complete the coding in Arduino.
STEP 5: In Arduino board connect VCC to the power supply 5V andconnect Arduino Uno
I2C module Analog Pin 4 – SDA Analog pin 5 – SCL 5V – Vcc GND - GND
STEP 7: Connect the arduino board with USB cable to the system.
STEP 8: Select tools Selected.
STEP 9: Upload the coding to arduino board. Then the output will
be displayed in the LCD board.
STEP 10: Stop the process.
CODING:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16
chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
}
void loop()
{
lcd.setCursor(0,0);
lcd.print("Hello, world!");
delay(5000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Hello, E&E!");
delay(5000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Subscribe!");
delay(5000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Thank You!");
delay(5000);
}
OUTPUT:

RESULT:
Thus the output to LCD Program using Arduino has successfully executed.
Ex. No : 5
Date : 21.09.2022

Ultrasonic Senor and buzzer with Arduino.


AIM:

To write a program to Ultrasonic Sensor and buzzer with Aurdino.

COMPONENTS REQUIRED:

1. Ultrasonic sensor.
2. Buzzer
3. Connectivity cable or USB cable.
4. Jumper Wires

ALGORITHM:

STEP 1: Start the process.


STEP 2: Start ->Arduino.
STEP 4: Then enter the coding in Arduino software.
STEP 5: Complete the coding in Arduino.
STEP 6: In Arduino board connect VCC to the power supply 5V and
connect SIG to digital signal DT and connect SND to ground GND
using jumper wires.
STEP 7: Connect the arduino board with USB cable to the system.
STEP 8: Select tools -> Selected.
STEP 9: Upload the coding to arduino board. Then the output will
be displayed in the serial monitor.
STEP 10: Stop the process.
CODING:

const int trigPin = 9;


const int echoPin = 10;
const int buzzer = 11;
const int ledPin = 13;
long duration;
int distance;
int safetyDistance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(buzzer, OUTPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600); // Starts the serial communication
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
safetyDistance = distance;
if (safetyDistance <= 20) // You can change safe distance from here changing value Ex.
20 , 40 , 60 , 80 , 100, all in cm
{
digitalWrite(buzzer, HIGH);
digitalWrite(ledPin, HIGH);
}
else{
digitalWrite(buzzer, LOW);
digitalWrite(ledPin, LOW);
}

// Prints the distance on the Serial Monitor


Serial.print("Distance: ");
Serial.println(distance);
}
OUTPUT:

RESULT:
Thus the output to ultrasonic sensor using Arduino has successfully executed.
Ex. No : 6
Date : 23.09.2022

Temperature notification using Arduino.

AIM:
To write a program to get Temperature notification using Arduino.
COMPONENTS REQUIRED:
1. Temperature and humidity sensor.
2. Jumper wires
3. Connectivity cable or USB cable.
ALGORITHM:
STEP 1: Start the process.
STEP 2: Start ->Arduino 1.8.8
STEP 3: Include the DHT library to the Arduino software.
STEP 4: Then enter the coding in Arduino software.
STEP 5: Complete the coding in Arduino.
STEP 6: In Arduino board connect VCC to the power supply 5V and
connect SIG to digital signal DT and connect SND to ground GND
using jumper wires.
STEP 7: Connect the arduino board with USB cable to the system.
STEP 8: Select tools -> Selected.
STEP 9: Upload the coding to arduino board. Then the output will
be displayed in the serial monitor.
STEP 10: Stop the process.
CODING:

#include <dht.h>
#define dht_apin A0 // Analog Pin sensor is connected to
dht DHT;
void setup(){
Serial.begin(9600);
delay(500);//Delay to let system boot
Serial.println("DHT11 Humidity & temperature Sensor\n\n");
delay(1000);//Wait before accessing Sensor
}//end "setup()"
void loop(){
//Start of Program
DHT.read11(dht_apin);

Serial.print("Current humidity = ");


Serial.print(DHT.humidity);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(DHT.temperature);
Serial.println("C ");

delay(5000);//Wait 5 seconds before accessing sensor again.


//Fastest should be once every two seconds.
}// end loop(
OUTPUT:

RESULT:
Thus the output to get temperature notification using Arduino has successfully executed.
Ex. No : 7
Date : 17.10.2022

Program using Arduino IDE for blink LED.

AIM:
To Write a program using arduino IDE for blink LED.
COMPONENTS REQUIRED:
1. LED Light.
2. Arduino Board.
3. Connectivity cable or USB cable.
ALGORITHM:
STEP 1: Start the process.
STEP 2: Start ->Arduino.
STEP 3: Then enter the coding in Arduino software.
STEP 4: Complete the coding in Arduino.
STEP 6: In Arduino board connect 13 pin in LED light
STEP 7: Connect the arduino board with USB cable to the system.
STEP 8: Select tools-> Selected.
STEP 9: Upload the coding to arduino board. Then the output will
be displayed .
STEP 10: Stop the process.
CODING
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
OUTPUT:

RESULT:
Thus the output to get LED Light using Arduino has successfully executed.
Ex. No : 8
Date : 29.10.2022

Program for RGB LED using Arduino.

AIM:
To Write a program for RGB LED using Arduino.
COMPONENTS REQUIRED:
1. RGB Light.
2. Jumper wires
3. Connectivity cable or USB cable.
4. Arduino Board.
ALGORITHM:
STEP 1: Start the process.
STEP 2: Start ->Arduino 1.8.8
STEP 3: Then enter the coding in Arduino software.
STEP 4: Complete the coding in Arduino.
STEP 5: In Arduino board connect and RGB Light connect in Bread Board Red pin in 11,
Green pin in 10, blue pin in 9 connect digital pin.
STEP 6: Connect the arduino board with USB cable to the system.
STEP 7: Select tools ->Selected.
STEP 8: Upload the coding to arduino board. Then the output will
be displayed in the serial monitor.
STEP 9: Stop the process.
CODING:

int red_light_pin= 11;


int green_light_pin = 10;
int blue_light_pin = 9;
void setup() {
pinMode(red_light_pin, OUTPUT);
pinMode(green_light_pin, OUTPUT);
pinMode(blue_light_pin, OUTPUT);
}
void loop() {
RGB_color(255, 0, 0); // Red
delay(1000);
RGB_color(0, 255, 0); // Green
delay(1000);
RGB_color(0, 0, 255); // Blue
delay(1000);
RGB_color(255, 255, 125); // Raspberry
delay(1000);
RGB_color(0, 255, 255); // Cyan
delay(1000);
RGB_color(255, 0, 255); // Magenta
delay(1000);
RGB_color(255, 255, 0); // Yellow
delay(1000);
RGB_color(255, 255, 255); // White
delay(1000);
}
void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
{
analogWrite(red_light_pin, red_light_value);
analogWrite(green_light_pin, green_light_value);
analogWrite(blue_light_pin, blue_light_value);
}
OUTPUT:

RESULT:
Thus the output to get RGB Light using Arduino has successfully executed.
Ex. No : 9
Date : 03.11.2022

Gas sensor detector with Arduino.


AIM:
To Write a program Gas sensor detector with Arduino.

COMPONENTS REQUIRED:
1. Gas sensor.
2. Jumper wires
3. Connectivity cable or USB cable.
4.Arduino Board
ALGORITHM:
STEP 1: Start the process.
STEP 2: Start ->Arduino 1.8.8
STEP 3: Then enter the coding in Arduino software.
STEP 4: Complete the coding in Arduino.
STEP 5: In Arduino board connect VCC to the power supply 5V and
connect A0 to Analogy signal A0 and connect GND to ground GND
using jumper wires.
STEP 6: Connect the arduino board with USB cable to the system.
STEP 7: Select tools -> Selected.
STEP 8: Upload the coding to arduino board. Then the output will
be displayed in the serial monitor.
STEP 9: Stop the process.
CODING:

int smokeA0=A0;
int buzzer =11;
float sensorValue;
void setup() {
pinMode(buzzer,OUTPUT);
pinMode(smokeA0,INPUT);
Serial.begin(9600); // sets the serial port to 9600
Serial.println("Gas sensor warming up!");
delay(20000); // allow the MQ-6 to warm up
noTone(buzzer);
}
void loop() {
sensorValue=analogRead(smokeA0);
if(sensorValue > 300)
{
Serial.print(" | Smoke detected!");
tone(buzzer,1000,200);
}
else
{
Serial.print(" | Smoke not detected!");
noTone(buzzer);
}
delay(2000); // wait 2s for next reading
}
OUTPUT:

RESULT:
Thus the output to get Gas Sensor using Arduino has successfully executed.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy