0% found this document useful (0 votes)
18 views

IoT Final PSEE

The document outlines various experiments related to IoT, including the use of Tinkercad for designing IoT devices, implementing home automation systems, smoke detection systems, and wind detection systems using Cisco Packet Tracer. It provides detailed descriptions of devices used, their features, and programming examples for controlling LEDs, motors, and other components. Additionally, it includes instructions for setting up remote servers and configurations for various IoT applications.

Uploaded by

captainboss240
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

IoT Final PSEE

The document outlines various experiments related to IoT, including the use of Tinkercad for designing IoT devices, implementing home automation systems, smoke detection systems, and wind detection systems using Cisco Packet Tracer. It provides detailed descriptions of devices used, their features, and programming examples for controlling LEDs, motors, and other components. Additionally, it includes instructions for setting up remote servers and configurations for various IoT applications.

Uploaded by

captainboss240
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Experiment: 01

Q. What is Tinkercard ?

For those related to IoT, Tinkercad is a good place to design and prototype your projects. Some possible
areas where Tinkercad might relate to IoT are as following:

- 1. Plastic Enclosures: Design and print custom plastic enclosures for ingtevariants, sensor nodes,
micro-controllers or SBCs.
- 2. Building and testing prototypes: With something like Tinkercad you can easily prototype IoT
projects - from home automation systems to wearables.
- 3. Sensor holders/mounts - Create your own customized holder or mount for sensors like
temperature, humidity or motion sensor.
- 4. IoT for Everyone - She then played with the idea of showing people how to build custom IoT
devices like connected smart home items and environmental monitoring systems using things
they could easily design in Tinkercad and make on a 3d printer.
- 5. Fast prototyping: The easiness of use and 3D printing feature make it able to design an IoT
device rapidly with Tinkercad.
- 6. List of IoT device housings to design and printCustom housing, complete with a rain shield
suitable for outdoors (IP66)
- 7. Build wearable IoT devices - I have built my own smartwatch or a fitness tracker using the help
of Tinkercad and it has been 3D printed.

There are several ways that Tinkercad can be used in IoT projects. This includes:

- Reducing the time and costs of prototyping


- Making custom designs for IoT devices and optimizing them
- Improving device performance and function
- Providing custom designs and enclosures to enhance user experience.

Q1. Write a program to blink and led in Code.

int ledPin = 13;


void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}
Q2. Write a program to control brightness of the led in.

int ledPin = 9;
void setup() {
pinMode(ledPin, OUTPUT); // Set the pin as an output
}
void loop() {
for (int brightness = 0; brightness <= 255; brightness++) {
analogWrite(ledPin, brightness);
delay(10);
}
for (int brightness = 255; brightness >= 0; brightness--) {
analogWrite(ledPin, brightness);
delay(10);
}
}

Q3. Write a program to blink a multiple led on a breadboard.

int ledPins[] = {2, 3, 4, 5, 6, 7, 8};


void setup() {
for (int i = 0; i < 7; i++) {
pinMode(ledPins[i], OUTPUT);
}
}
void loop() {
for (int i = 0; i < 7; i++) {
digitalWrite(ledPins[i], HIGH);
delay(100);
digitalWrite(ledPins[i], LOW);
delay(100);
}
}

Q4. Write a program to run a motor in Tinkercad.

const int motorPin1 = 2;


const int motorPin2 = 3;
void setup() {
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
}
void loop() {
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
delay(1000);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
delay(1000);
}
Experiment: 02

Implement Home Automation System using Cisco Packet tracer.

Devices Used :
1. Server
2. Laptop
3. Wireless Router
4. Ceiling Fan
5. Door
6. Window
7. Light
8. Garage Door

1. Garage Door
- A garage door opener.
Features:
• Registration Server Compatible
• Ability to vent Carbon Dioxide and Carbon Monoxide
Usage:
• N/A
Direct Control:
• ALT-click to interact
Local Control:
• Connect device to MCU/SBC/Thing.
• Use the customWrite API per Data Specifications
Remote Control:
• Connect device to Registration Server using Config Tab
Data Specifications:
• Input Slot: D0
• Message Format: [state]
state: 0 = closed, 1 = open
2. Light
- A lamp that can be turned on or off.
Features:
• Registration Server Compatible
• Off
• Dim
• On
• Emits light to the environment
Usage:
• N/A
Direct Control:
• ALT-click to interact
Local Control:
• Connect device to MCU/SBC/Thing.
• Use the "customWrite" API per Data Specifications
Remote Control:
• Connect device to Registration Server using Config Tab
Data Specifications:
Message Format: [state]
state: 0 = off, 1 = dim, 2 = on

3. Window
- A window that can open or close
Features:
• Registration Server Compatible
• Ability to vent Carbon Dioxide and Carbon Monoxide
Usage:
• Window works with Environment object. It reads CARBON_DIOXIDE and CARBON_MONOXIDE
variables set in the Environment object and change these variables when users activate window
opening/closing
Direct Control:
• ALT-click to open and close
Local Control:
• Connect device to MCU/SBC/Thing. Use the "customWrite" API per Data Specifications
Remote Control:
• Connect device to Registration Server using Config Tab
Data Specifications:
Message Format: [state]
state: 0 = closed, 1 = open

4. Door
Open / Close / Unlock / Lock
Features:
• Registration Server Compatible
• Ability to vent Carbon Dioxide and Carbon Monoxide
Usage:
• Connect to the Door from SBC/MCU/Thing with IoT Custom Cable
• Use customWrite function to control the door and lock
Direct Control:
• ALT-click on keyhole to lock/unlock
• ALT-click on door to open/close
Local Control:
• Connect device to SBC/MCU/Thing. Use the "customWrite" API per Data Specifications
Remote Control:
• Connect device to Registration Server using Config Tab
NOTE: opening and closing the door is not remote controllable
Data Specifications:
Message Format: [door],[lock]
door: 0 = closed, 1 = open, -1 = don't care
lock: 0 = unlock, 1 = lock, -1 = don't care

5. Fan
- Ceiling Fan
Features:
• Registration Server Compatible
• Off
• Low Speed
• High Speed
Usage:
• Connect to the Fan with custom cable from MCU/SBC/Thing
• In the script, write the data to the Fan with customWrite function to turn Fan off, set low
speed/high speed
Direct Control:
• ALT-click to interact
Local Control:
• Connect device to MCU/Thing/SBC. Use the "customWrite" API per Data Specifications
Remote Control:
• Connect device to Registration Server using Config Tab
Data Specifications:
Message Format: [state]
state: 0 = off, 1 = low speed, 2 = high speed

All device control


Setting up Iot server username and password

Server Ip Configuration
Laptop Ip Configuration

Setting up Remote server and Ip address for Fan


Setting up Remote server and Ip address for Window

Setting up remote server and ip address for Door.

Setting up remote server and ip address for light


setting up remote server and ip address for Garage door
Experiment: 03
Implement Smoke Detection System using Cisco Packet tracer.

Device Used :

1. Server

2. Access point

3. Lawn sprinkler

4. Smoke detector

5. Old cars

1. Lawn Sprinkler

• A Sprinkler for Lawn.

Features:
• Registration Server Compatible
• Raises the water level
Usage:
• N/A
Direct Control:
• ALT-Click to interact
Local Control:
• Connect device to MCU/SBC/Thing. Use the "customWrite" API per Data Specifications.
Remote Control:
• Connect device to Registration Server using Config Tab
Data Specifications:
• Input Slot: D0
• Message Format: [state]
state: 0 = off, 1 = on

2. Smoke Detector

Features:
• Registration Server Compatible
• Alarm will go off when it detects the environment variable SMOKE at the level of 40%.
Usage:
• Use an Old Car to change the Smoke level
Direct Control:
• N/A
Local Control:
• N/A
Remote Control:
• N/A
Data Specifications:
Message Format: [state],[level]
state: 0 = alarm off, 1 = alarm on
level: a positive number

3. Old Car

A car having lots of problems.

Features:
• Off
• On
• Increases Carbon Dioxide
• Increases Carbon Monoxide
• Increases Smoke
Usage:
• N/A
Direct Control:
• ALT-click to interact
Local Control:
• N/A
Remote Control:
• N/A
Data Specifications:
• N/A

Example:
1. Place a CO detector and a CO2 detector within the same container as the car.
2. Turn on the car and notice the alarm indicators go off on the detectors.

Server Configuration:
Access point configuration :

Sprinkler configurationand setting up remote server configuration


Smoke detector configuration and remote server configuration

Before smoke :
After Smoke:
Experiment: 04
Implement Wind Detection System using Cisco packet tracer.

Solution:-

Hardware Devices :-

- Server-PT
- Wireless Router
- Laptop-PT
- Door
- Window
- Wind Detector

Description of Devices:-

Server-PT:

• A server in Cisco Packet Tracer that simulates various network services such as DHCP, DNS, HTTP,
FTP, and more. It acts as a central node to manage and distribute data across the network,
providing essential services to other devices.

Wireless Router:

• A device in Cisco Packet Tracer that functions as both a router and a wireless access point. It
connects to the internet and provides Wi-Fi connectivity to various devices within its range,
facilitating wireless network access and communication.

Laptop-PT:
• A simulated laptop in Cisco Packet Tracer used to represent a user's computer. It can be
configured to access network services, perform tasks like browsing the internet, and interact
with other networked devices, demonstrating user endpoints in a network.

Door:

• A smart door in Cisco Packet Tracer that can be integrated into an IoT network. It can be
controlled and monitored remotely, often used in security systems to allow or restrict access,
demonstrating smart home automation.

Window:

• A smart window in Cisco Packet Tracer that can be controlled remotely within an IoT network. It
can be opened or closed based on user commands or automated settings, used to regulate
indoor conditions or enhance security.

Wind Detector:

• An IoT device in Cisco Packet Tracer designed to detect wind speed and direction. It can be used
in various applications, such as weather monitoring and smart home automation, to trigger
actions based on wind conditions, like closing windows or adjusting HVAC systems.

Connection:-

Configuration :-

- Server-PT :-
Services -> FTP -> Services On

- Wireless Router :-
- Laptop-PT :-

- Door :- Window :- Wind Detector :-


- Server-PT :-
Output :-
Experiment: 05
Q. Implementation of Smart Home using Motion Detector ,Webcam and Registration Server.
Devices Used:

1. Server
2. Access point
3. Motion detector
4. Web cam

1. Webcam
- A camera device that records and sends data

Features:
• Registration Server Compatible
• Off
• On
• Video recording
Usage:
• N/A
Direct Control:
• ALT-click to interact
Local Control:
• Connect device to MCU/SBC/Thing. Use the "customWrite" API per Data Specifications
Remote Control:
• Connect device to Registration Server using Config Tab
Data Specifications:
Message Format: [state]
state: 0 = off, 1 = on
2. Motion Detector

Features:
• Registration Server Compatible
• Detects motion from mouse movement.
• Automatically deactivates after 5 seconds without any mouse movement.
Usage:
• N/A.
Direct Control:
• Alt-mouse move to interact.
Local Control:
• N/A
Remote Control:
• N/A
Data Specifications:
Message Format: [state]
state: HIGH=activated, LOW=inactive
Connection display

Ip configuration and Remote server setup for web cam


Ip configuration and Remote server setup for motion detector

Access point setup


Experiment: 06

Raspberry Pi Home Automation: LED and Garage Door Control with Python

Device Used :

1. SBC board
2. Garage door
3. LED
4. Push button

1. SBC board

- SBC stands for Single Board Computer, which is a complete computer built on a single circuit
board. SBCs are typically small, low-power, and low-cost computers used for various applications

2. Garage Door

- A garage door opener.


Features:
• Registration Server Compatible
• Ability to vent Carbon Dioxide and Carbon Monoxide
Usage:
• N/A
Direct Control:
• ALT-click to interact
Local Control:
• Connect device to MCU/SBC/Thing. Use the customWrite API per Data Specifications
Remote Control:
• Connect device to Registration Server using Config Tab
Data Specifications:
• Input Slot: D0
• Message Format: [state]
state: 0 = closed, 1 = open
3. LED

- Standard green LED.


Features:
• Dimmable
• Color: Green
• High Reliability
Usage:
• Connect to MCU/SBC to Slot 0
• Analog input of 1023 is maximum brightest; 0 is off.
Direct Control:
• N/A
Local Control:
• Connect device to an MCU. From MCU, use "analogWrite" to adjust the device brightness.
Remote Control:
• N/A
Data Specifications:
• Input Slot: D0 [value range 0-1023]

4. Push Button

- Regular Push Button.


Features:
• Default LOW, Push the button to send a digital value of HIGH
• Color: Red
Usage:
• Connect other IoT devices to it in order to receive LOW or HIGH inputs.
Direct Control:
• Alt-Click to interact.
Local Control:
• N/A
Remote Control:
• N/A
Data Specifications:
• OUTPUT SLOT 0:
LOW = Not pushed
HIGH = Pushed
Example:
Connect Push Button to LED. ALT-click to turn on LED.

Programming in python in the SBC board


SBC board configuration

Garage Door Configuration


Before Pushing Button

After Pushing Button


Experiment: 07
implementation of HCSR04 (ultrasonic sensor) using Arduino uno

Hardware Requirements:

Arduino Uno : 1

Bread Bors : 1

Ultrasonic Sensor : 1

Jumper Wires : 6

Cable : 1

Pin Configuration :

Vcc -5V

GND -GND (-VE)

TRIG : 9 DIGITAL PIN

ECHO : 10 DIGITAL PIN

Arduino Uno Diagram:


Sensor Application :

Find the distance between the sensor and an obstacle.

Source Code:

const int trigPin = 9;

const int echoPin = 10;

float duration, distance;

void setup() {

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

Serial.begin(9600);

void loop() {

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration*.0343)/2;

Serial.print("Distance: ");

Serial.println(distance);

delay(100);

}
Output :
Experiment: 08
Implement Soil moisture Sensor to measure water level using Arduino UNO.

Solution:

● Hardware Devices

● Pin Configuration of Soil Moisture sensor

● Arduino UNO pin diagram

● Application of Soil Moisture sensor

● Source code

Design:
Code:

int moisture=0;

void setup()

pinMode(A0,INPUT);

pinMode(9,OUTPUT);

pinMode(10,OUTPUT);

pinMode(11,OUTPUT);

pinMode(12,OUTPUT);

pinMode(13,OUTPUT);

void loop()

moisture = analogRead(A0);

digitalWrite(9,LOW);

digitalWrite(10,LOW);

digitalWrite(11,LOW);

digitalWrite(12,LOW);

digitalWrite(13,LOW);

if(moisture < 200){

digitalWrite(13,HIGH);

else

if(moisture <400)
{

digitalWrite(13,HIGH);

digitalWrite(12,HIGH);

else

if(moisture <600)

digitalWrite(13,HIGH);

digitalWrite(12,HIGH);

digitalWrite(11,HIGH);

else

if(moisture <800)

digitalWrite(13,HIGH);

digitalWrite(12,HIGH);

digitalWrite(11,HIGH);

digitalWrite(10,HIGH);

else

digitalWrite(9,HIGH);

digitalWrite(10,HIGH);
digitalWrite(11,HIGH);

digitalWrite(12,HIGH);

digitalWrite(13,HIGH);

delay(100);

}
Experiment: 09

Implementation of PIR sensor to detect motion using Arduino Uno.

Solution :

• Hardware
• Pin Configuration of PIR sensor:
• Arduino Uno Diagram
• Application of PIR sensor

Output:
Code :

int detect=0;

void setup()

pinMode(2,OUTPUT); //LED DE

pinMode(7,INPUT); //PIR D7

void loop()

detect=digitalRead(7);//input from d7

//if motion detect

if(detect==HIGH)

digitalWrite(2,HIGH);//on led

else

digitalWrite(2,LOW);//off led

delay(10); //10ms

}
Experiment: 10
Implementation of Temperature Sensor using Arduino Uno.

Solution:

Hardware:

Here we will use 3 led for

LED1 : HOT TEMP

LED2 : WARM TEMP

LED3 : COLD TEMP

Arduino Uno -1

Register -3 (200 ohm)

Bread Board -1

Temperature Sensor -1

Jumper Wire

Pin Configuration of Temperature sensor:

Anond-5V

Ground-GND (-ve)

Analog Pin - A0 -Working As Input

LED 1 : 2 digital pin

LED 2 : 3 digital pin

LED 3 : 4 digital pin


Arduino Uno Diagram:

Application of Temperature sensor:

The Temperature Sensor LM35 series are precision integrated-circuit temperature devices with an
output voltage linearly proportional to the Centigrade temperature.

The LM35 device has an advantage over linear temperature sensors calibrated in Kelvin, as the user is
not required to subtract a large constant voltage from the output to obtain convenient Centigrade
scaling. The LM35 device does not require any external calibration or trimming to provide typical
accuracies of ±¼°C at room temperature and ±¾°C over a full −55°C to 150°C temperature
range.

Source Code:
int baselineTemp = 0;

int celsius = 0;

int fahrenheit = 0;

void setup()

pinMode(A0, INPUT);

Serial.begin(9600);

pinMode(2, OUTPUT);

pinMode(3, OUTPUT);

pinMode(4, OUTPUT);

void loop()

// set threshold temperature to activate LEDs

baselineTemp = 40;

// measure temperature in Celsius

celsius = map(((analogRead(A0) - 20) * 3.04), 0, 1023, -40, 125);

// convert to Fahrenheit

fahrenheit = ((celsius * 9) / 5 + 32);

Serial.print(celsius);

Serial.print(" C, ");

Serial.print(fahrenheit);

Serial.println(" F");
if (celsius < baselineTemp) {

digitalWrite(2, LOW);

digitalWrite(3, LOW);

digitalWrite(4, LOW);

if (celsius >= baselineTemp && celsius < baselineTemp + 10) {

digitalWrite(2, HIGH);

digitalWrite(3, LOW);

digitalWrite(4, LOW);

if (celsius >= baselineTemp + 10 && celsius < baselineTemp + 20) {

digitalWrite(2, HIGH);

digitalWrite(3, HIGH);

digitalWrite(4, LOW);

if (celsius >= baselineTemp + 20 && celsius < baselineTemp + 30) {

digitalWrite(2, HIGH);

digitalWrite(3, HIGH);

digitalWrite(4, HIGH);

if (celsius >= baselineTemp + 30) {

digitalWrite(2, HIGH);

digitalWrite(3, HIGH);

digitalWrite(4, HIGH);

}
delay(1000); // Wait for 1000 millisecond(s)

Output:
Experiment: 11
Implement gas sensor using Arduino Uno

Solution :

• Hardware
• Pin Configuration of PIR sensor:
• Arduino Uno Diagram
• Application of PIR sensor

Output:
Code :

int LED = A1;

const int gas = 0;

int MQ2pin = A0;

void setup() {

Serial.begin(9600);

void loop() {

float sensorValue,MQ2pin;

sensorValue = analogRead(MQ2pin); // read analog input pin 0

if(sensorValue >= 470){

digitalWrite(LED,HIGH);

Serial.print(sensorValue);

Serial.println(" |SMOKE DETECTED");

else{

digitalWrite(LED,LOW);

Serial.println("Sensor Value: ");

Serial.println(sensorValue);

delay(1000);

float getsensorValue(int pin){

return (analogRead(pin));

}
PCIE EXAM
Implementation of Temperature Sensor, Ultrasonic sensor, Motion Sensor, Soil Moisture using single
Arduino Uno. Use Bread Board and LED pin for Output.

1. If LED1 Blink then Ultrasonic sensor will work.

2. If LED2 Blink then Temperature Sensor will work.

3. If LED3 Blink then Motion Sensor will work.

4. If LED4 Blink then Soil Moisture will work.

Solution:

❖ Pin Configuration
❖ Output
❖ Code

Link :

https://www.tinkercad.com/things/1TRseSjQgxo-daring-bruticus-
waasa/editel?returnTo=%2Fthings%2F1TRseSjQgxo-daring-bruticus-
waasa&sharecode=01A6YOQVvIWYmbPvXLtH2UYhgVnDGH3_EYOii1fd3WU
Pin Configuration :

• Ultrasonic Sensor (HC-SR04)

o VCC: 5V

o GND: GND

o Trig: Pin 9

o Echo: Pin 8

• Temperature Sensor (TMP36)

o VCC: 5V

o GND: GND

o Output: A0

• Motion Sensor (PIR)

o VCC: 5V

o GND: GND

o Output: Pin 7

• Soil Moisture Sensor

o VCC: 5V

o GND: GND

o Output: A1

• LEDs

o LED1: Pin 2

o LED2: Pin 3

o LED3: Pin 4

o LED4: Pin 5
Output:

• Ultrasonic Sensor (HC-SR04)


• Temperature Sensor (TMP36)
• Motion Sensor (PIR)
• Soil Moisture Sensor
Code :

// Pin Definitions
const int trigPin = 9; // Ultrasonic Sensor Trig Pin
const int echoPin = 10; // Ultrasonic Sensor Echo Pin
const int tempSensorPin = A0; // Temperature Sensor Pin
const int pirPin = 8; // PIR Sensor Pin
const int soilMoisturePin = A1; // Soil Moisture Sensor Pin

const int led1 = 2; // LED1 for Ultrasonic Sensor


const int led2 = 3; // LED2 for Temperature Sensor
const int led3 = 4; // LED3 for PIR Motion Sensor
const int led4 = 5; // LED4 for Soil Moisture Sensor

void setup() {
// Initialize serial communication
Serial.begin(9600);

// Set up pin modes for sensors


pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(tempSensorPin, INPUT);
pinMode(pirPin, INPUT);
pinMode(soilMoisturePin, INPUT);

// Set up pin modes for LEDs


pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
}

void loop() {
// Ultrasonic Sensor Operation
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
long duration = pulseIn(echoPin, HIGH);
long distance = (duration / 2) / 29.1; // Convert to centimeters

// Only turn on LED1 if a valid distance is detected


if (distance > 0 && distance < 200) { // Assuming valid distance is less than 200 cm
digitalWrite(led1, HIGH);
Serial.println("Ultrasonic Sensor Active");
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
} else {
digitalWrite(led1, LOW);
}

// Temperature Sensor Operation


int tempValue = analogRead(tempSensorPin);
float voltage = tempValue * (5.0 / 1023.0);
float temperatureC = (voltage - 0.5) * 100.0;

// Only turn on LED2 if a valid temperature reading is obtained


if (temperatureC > 0) {
digitalWrite(led2, HIGH);
Serial.println("Temperature Sensor Active");
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.println(" C");
} else {
digitalWrite(led2, LOW);
}

// Motion Sensor Operation


int motionDetected = digitalRead(pirPin);

// Only turn on LED3 if motion is detected


if (motionDetected == HIGH) {
digitalWrite(led3, HIGH);
Serial.println("Motion Sensor Active");
Serial.println("Motion Detected!");
} else {
digitalWrite(led3, LOW);
}

// Soil Moisture Sensor Operation


int soilMoistureValue = analogRead(soilMoisturePin);

// Only turn on LED4 if the soil moisture level is valid


if (soilMoistureValue > 0) {
digitalWrite(led4, HIGH);
Serial.println("Soil Moisture Sensor Active");
Serial.print("Soil Moisture: ");
Serial.println(soilMoistureValue);
} else {
digitalWrite(led4, LOW);
}
}

You might also like