Wa0003.

Download as pdf or txt
Download as pdf or txt
You are on page 1of 58

DEPARTMENT OF MECHANICAL ENGINEERING

--------------------------------------------------------------------------------------------

III YEAR / VI SEMESTER


REGULATION 2021

OCS352- IOT CONCEPTS AND APPLICATIONS

---------------------------------------------------------------------------------------------
DEPARTMENT OF MECHANICAL ENGINEERING

--------------------------------------------------------------------------------------------

III YEAR / VI SEMESTER


REGULATION 2021

OCS352- IOT CONCEPTS AND APPLICATIONS


---------------------------------------------------------------------------------------------

Faculty In charge Head of the Department


Ms. Kavya R V Dr. S. Sumithra
Assistant Professor Professor
COLLEGE VISION MISSION

VISION:

To become a globally recognized ‘Centre of Academic Excellence’ providing Quality

Education to all students.

MISSION:

To provide Quality Education in the fields of Engineering, Management, Information

Technology and other Engineering areas.

DEPARTMENT VISION MISSION

VISION:
To look for greatness in the field of Mechanical Engineering training through information and
abilities to oblige the necessities of the general public.

MISSION:

M1: To constantly improve the instructing and learning cycle to empower understudies to
meet worldwide needs.
M2: To redesign the information and abilities of understudies, individuals from personnel and
supporting staff through standard training.
M3: To produce the best personalities of specialists equipped for meeting assumptions for
Industry, Society and Entrepreneurship improvement.
PROGRAM E D U C A T I O N A L O B J E C T I V E S (PEOs)

Effectuating success in careers by exploring with the design, digital and

computational analysis of engineering systems, experimentation and testing,


PEO1
smart manufacturing, technical services, and research.

Amalgamating effectively with stakeholders to update and improve their core

competencies and abilities to ethically compete in the ever-changing


PEO2
multicultural global enterprise.

To encourage multi-disciplinary research and development to foster advanced

technology, and to nurture innovation and entrepreneurship in order to compete


PEO3
successfully in the global economy.

To globally share and apply technical knowledge to create new opportunities

that proactively advances our society through team efforts and to solve various
PEO4
challenging technical, environmental and societal problems.

To create world class mechanical engineers capable of practice engineering

ethically with a solid vision to become great leaders in academia, industries


PEO5
and society.
PROGRAM OUTCOMES (POs)

Engineering knowledge: Apply the knowledge of mathematics, science, engineering


PO1 fundamentals, and an engineering specialization to the solution of complex engineering
problems.
PO2 Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
PO3 Design/development of solutions: Design solutions for complex engineering problems
and design system components or processes that meet the specified needs with
appropriate consideration for the public health and safety, and the cultural,
Societal, and environmental considerations.
PO4 Conduct investigations of complex problems: Use research-based knowledge
and research methods including design of experiments, analysis and interpretation of
data, and synthesis of the information to provide valid conclusions.
PO5 Modern tool usage: Create, select, and apply appropriate techniques, resources and
modern engineering and IT tools including prediction and modelling to complex
engineering activities with an understanding of the limitations.
PO6 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.
PO7 Environment and sustainability: Understand the impact of the professional
engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.
PO8 Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.

PO9 Individual and teamwork: Function effectively as an individual, and as a member or


leader in diverse teams, and in multidisciplinary settings.
PO10 Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend
and write effective reports and design documentation, make effective presentations,
And give and receive clear instructions.
PO11 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.
PO12 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.
PROGRAM S PE CIFI C OUTCOMES (PSOs):

Apply the knowledge gained in Mechanical Engineering for design and development
PSO1 and manufacture of engineering systems.

Apply the knowledge acquired to investigate research-oriented problems in


PSO2 mechanical engineering with due consideration for environmental and social
impacts.

Use the engineering analysis and data management tools for effective management
PSO3 of multidisciplinary projects.
INSTRUCTIONS

All the students must follow the instructions strictly as appended below:

 All the students should enter the lab class with proper uniform.

 Bring the observation note book and lab manual during all the lab
class.

 Before entering the next lab classes ensure that the experiment is
neatly written in the respective record note book and the same
should be checked / corrected by the faculty in charge.

 Failing this, the entry to the lab class will be denied.

 Get completed signature in the index page of the record note book
from the faculty in charge when all the experiments are completed.

 Before appearing the university practical examination, the students


must get the bonafide signature in the record note book.

 Don’t operate the equipment/machineries/mockups until you are


asked to do so.

 Observe safety precautions strictly as instructed by the faculty in


charge.
OCS352 IOT CONCEPTS AND APPLICATIONS L T P C
2 0 2 3

OBJECTIVES:

The main learning objective of this course is to prepare the students able to:
 To apprise students with basic knowledge of IoT that paves a platform to understand physical
and logical design of IoT.
 To teach a student how to analyse requirements of various communication models and
protocols for cost-
Effective design of IoT applications on different IoT platforms.
 To introduce the technologies behind Internet of Thing (IoT).
 To explain the students how to code for an IoT application using Arduino/Raspberry Pi open
platform.
 To apply the concept of Internet of Things in real world scenario.

IoT CONCEPTS AND APPLICATIONS LABORATORY LIST OF


EXPERIMENTS

1. Introduction to Arduino platform and programming

2. Interfacing Arduino to Zigbee module

3. Interfacing Arduino to GSM module

4. Interfacing Arduino to Bluetooth module

5. Introduction to Raspberry PI platform and python programming

6. Interfacing sensors to Raspberry PI

7. Communicate between Arduino and Raspberry PI using any wireless medium

8. Setup a cloud platform to log the data

9. Log Data using Raspberry PI and upload to the cloud platform

10. Design an IoT based system

Course period: 30 Hours


COURSE OUTCOMES:

At the end of the course the students would be able to:

CO1 – Explain the concept of IoT

CO2 – Understand the communication models and various protocols for IoT

CO3 - Design portable IoT using Arduino/Raspberry Pi/ open platform

CO4 – Apply data analytics and use cloud offerings related to IoT.

CO5 – Analyze applications of IoT in real time scenario.

CORRELATION OF COURSE OUTCOMES (COs) WITH POs/ PSOs

CO/
PO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3

3 3 2 2 2 1 - - - - - 2 3 2 1
CO1

3 3 2 2 1 3 - - - - - 2 3 3 3
CO2

3 3 2 2 2 1 - - - - - 3 2 2 2
CO3

CO4 2 3 3 1 1 3 - - - - - 1 3 1 2

CO5 2 3 1 1 2 2 - - - - - 1 3 1 1
INDEX

IOT CONCEPTS AND APPLICATIONS LABORATORY

Ex.No. Name of the Experiment

1. Introduction to Arduino platform and programming

2. Interfacing Arduino to Zigbee module

3. Interfacing Arduino to GSM module

4. Interfacing Arduino to Bluetooth module

5. Introduction to Raspberry PI platform and python programming

6. Interfacing sensors to Raspberry PI


Communicate between Arduino and Raspberry PI using any wireless
7. medium

8. Setup a cloud platform to log the data

9. Log Data using Raspberry PI and upload to the cloud platform

10. Design an IoT based system


BEYOND THE SYLLABUS

11. Interfacing Arduino to Ultrasonic sensor.

12. Interfacing 16x2 LCD with Arduino

INNOVATIVE PROJECT

13. Solar Power Bank with Wireless Charging


EX. NO: 1 INTRODUCTION TO ARDUINO PLATFORM AND PROGRAMMING

Aim:

To study about the introduction to Arduino platform and its programming.

Apparatus Required:

1. 1 X LED
2. 1 X Resistor, 330 Ohm
3. Breadboard
4. Arduino UNO R4 or earlier versions.
5. Jumper wires

THEORY:

Introduction:

Arduino is a prototype platform (open-source) based on an easy-to-use hardware and


software. It consists of a circuit board, which can be programed (referred to as a
microcontroller) and a ready-made software called Arduino IDE (Integrated Development
Environment), which is used to write and upload the computer code to the physical board.
The key features are:
 Arduino boards are able to read analog or digital input signals from different sensors
and turn it into an output such as activating a motor, turning LED on/off, connect to the
cloud and many other actions.
 You can control your board functions by sending a set of instructions to the
microcontroller on the board via Arduino IDE (referred to as uploading software).
 Unlike most previous programmable circuit boards, Arduino does not need an extra
piece of hardware (called a programmer) in order to load a new code onto the board.
You can simply use a USB cable.
 Additionally, the Arduino IDE uses a simplified version of C++, making it easier to
learn to program.
 Finally, Arduino provides a standard form factor that breaks the functions of the micro-
controller into a more accessible package.
1F ARDUINO PROCEDURES

Launch the Arduino Application

Double-click the Arduino application (arduino.exe) you have previously downloaded.(Note: if


the Arduino Software loads in the wrong language, you can change it in the preferences dialog. See
the Arduino Software (IDE) page for details.)

Open the blink example:


Open the LED blink example sketch: File > Examples
>01.Basics> Blink

Select Your Board


You'll need to select the entry in the Tools > Board menu that corresponds to your
Arduino.
Select Your Serial Port

Select the serial device of the Arduino board from the Tools | Serial Port menu. This is likely
to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serialports). To find out,
you can disconnect your Arduino board and re-open the menu; the entry that disappears should be the
Arduino board. Reconnect the board and select that serial port.

Upload the Program

Now, simply click the "Upload" button in the environment. Wait a few seconds - you should
see the RX and TX leds on the board flashing. If the upload is successful, the message "Done
uploading." will appear in the status bar. (Note: If you have an ArduinoMini, NG, or other board, you'll
need to physically press the reset button on the board immediately before clicking the upload button on
the Arduino Software).

A few seconds after the upload finishes, you should see the pin 13 (L) LED on the board
start to blink (in orange). If it does, congratulations! You've gotten Arduino up-and- running.
If you have problems, please see the troubleshooting suggestions.

Coding:
Program 1:

int LEDpin = 13;


int delayT = 1000;
void setup() {
// put your setup code here, to run once:
pinMode(LEDpin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LEDpin, HIGH);
delay(delayT);
digitalWrite(LEDpin, LOW);
delay(delayT);
}

Program 2:

void setup()
{
pinMode(1
3,OUTPU
T);
}
void loop()
{
digitalWrit
e(13,HIG
H);
delay(100
0);
digitalWrit
e(13,LOW
);
delay(100
0);
}
VIVA-QUESTIONS:-

a) What is Arduino?

b) Which software is installed to run the Arduino program?

c) How much volt battery need to run the Arduino?

d) Arduino is an open source or close source platform?

e) What are the steps to program in Arduino IDE?

ASSIGNMENT QUESTIONS

CO
S.No Questions BT level Complexity
Mapping
Explain the difference between Serial.print(),
C03
Serial.write(), and Serial.println() functions in Understand Medium
1.
Arduino programming. When should each be
used?
How would you develop an Arduino library to be
used in multiple projects? Explain the structure
2. and format of your library. C03 High
Create

What are some considerations for power-efficient


Arduino programming? What coding techniques are
3. used to minimize power consumption in battery- C03 Understand Medium
operated systems?

RESULT:

Thus, the introduction to Arduino platform and programming was studied


EX.NO:02 INTERFACING ARDUINO TO ZIGBEE MODULE

Aim:
To write the Arduino program for communication between two trainers and control
the ledby switch.
Apparatus Required:

1. Arduino UNO
2. AtMega328 microcontroller
3. Zigbee Transmitter (ZTx)
4. Zigbee Receiver (ZRx)
5. USB cables
6. LEDs

Theory:

Zigbee is a low-power wireless mesh network standard targeted at battery-powered


devices in wireless control and monitoring applications. Zigbee delivers low-latency
communication. Zigbee chips are typically integrated with radios and with
microcontrollers.

Program for Zigbee Transmitter:

//Pin 2 connected to ZTx


//Pin 3 Connected to ZRx
//Switch on 7 in Dip switch S3
//Press SW3 Push Button for Led On in Receiver Trainer.
#include "SoftwareSerial.h"
SoftwareSerial

XBee(2,3);

int SW1 = A4;

void setup()
{
Serial.begin(9600
);
pinMode(SW1,
INPUT);
XBee.begin(9600
);
}

void loop()
{
if (digitalRead(SW1) == HIGH)
{
Serial.println("Turn on
LED");
XBee.write('1');
delay(1000);
}
else if (digitalRead(SW1) == LOW)
{
Serial.println("Turn off
LED");
XBee.write('0');
delay(1000);
}
}

Program for ZigBee Receiver:

//Pin 2 connected to ZTx


//Pin 3 Connected to
ZRx
#include
"SoftwareSerial.h"
#include<SoftwareSer
ial.h>int led = 13;
int
receive
d = 0;
int i;

//For communicating with


zigbeeSoftwareSerial
zigbee(2,3);

void setup()
{
Serial.begin(9600);
zigbee.begin(9600);
pinMode(led, OUTPUT);

}
void loop()
{
//check if the data is
received
if (zigbee.available() >
0)
{
received = zigbee.read();
//if the data is 0, turn off the
LED
if (received == '0')
{
Serial.println("Turning off LED");
digitalWrite(led, LOW);
}
//if the data is 1, turn on the
LED
else if (received == '1')
{
Serial.println("Turning on LED");
digitalWrite(led, HIGH);
} } }
VIVA QUESTIONS:-

1. What is the purpose of Zigbee module?


2. What are the specifications of Zigbee module?
3. Where is Zigbee used?
4. What is the range of Zigbee?
5. How many channels does Zigbee use?

ASSIGNMENT QUESTIONS

CO
S.No Questions Mapping BT level Complexity

Develop a network application for


1. communication between two devices using C03 Create High
Zigbee.

Develop a Digital Device Using ZigBee for


2. Environmental Monitoring in Underground C03 Create High
Mines

RESULT:

Thus, the Arduino is interfaced to the Zigbee module and the output is verified.
EX.NO:03 INTERFACING ARDUINO TO GSM MODULE

Aim:
To write the Arduino program for detect the flame and send a sms.

Apparatus Required:

1. Arduino UNO board.


2. SIM900A GSM Module
3. Micro SIM Card.
4. USB cable
5. Jumper wires for connections.

Note: DIP Switch S3 in Buzzer Block switch6 should be ON.

Theory:

GSM is combination of TDMA (Time Division Multiple Access), FDMA (Frequency


Division Multiple Access) and Frequency hopping. Initially, GSM use two frequency bands of
25 MHz width: 890 to 915 MHz frequency band for up-link and 935 to 960 MHz frequency
for down-link. Later on, two 75 MHz band were added.

Program for GSM:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2,3); // RX, TX


int flame = A0;
int buz =7;
void setup()
{
pinMode(A0,INPUT);
pinMode(buz,OUTPUT);
mySerial.begin(9600);
Serial.begin(9600);
}
void loop()
{
if (digitalRead(flame) == LOW)
{
init_sms();
send_data("Flame Alert");
mySerial.println(" ");
Serial.println(" ");
send_sms();
digitalWrite(buz,HIGH);
while(1);
}
else
{
digitalWrite(buz,LOW);
}
}
void init_sms()
{
mySerial.println("AT+CMGF=1");
Serial.println("AT+CMGF=1");
delay(400);

mySerial.println("AT+CMGS=\"8838961153\"");// use your 10 digit cell no. here


Serial.println("AT+CMGS=\"8838961153\"");
delay(400);
}
void send_data(String message)
{
mySerial.print(message);
Serial.print(message);
delay(200);
}
void send_sms()
{
mySerial.write(26);
Serial.write(26);
}
VIVA QUESTIONS:-

1. What is the purpose of GSM?


2. What are the different frequency bands supported in GSM?
3. What is the difference between GSM and GPRS?
4. What is BSIC? Why it is needed in GSM system?
5. Explain AMR.

ASSIGNMENT QUESTIONS

CO
S. No Questions Mapping BT level Complexity

1. Design a GSM-Based Environmental Monitoring


System C03 Create High

Design a SMS Based LPG Gas Leakage


2. C03 Create High
Detection System Using GSM”

RESULT:

Thus, the Arduino is interfaced to the GSM module and the output is verified.
EX.NO:04 INTERFACING ARDUINO TO BLUETOOTH MODULE

Aim:
To write the Arduino program for Electronics Notice Board.

Apparatus Required:

1. Arduino UNO
2. AtMega328 Microcontroller
3. HC-05 Bluetooth Module.
4. LED.
5. Breadboard.
6. Resistors - 1K & 2K Ohm.
7. Connecting Wires.

Note: DIP Switch S1 in 16X2 LCD Display Block should be all ON position.

Theory:
The HC-05 is a class 2 Bluetooth module designed for transparent wireless serial
communication. It is pre-configured as a slave Bluetooth device. Once it is paired to a master
Bluetooth device such as PC, smart phones and tablet, its operation becomes transparent to the
user.
Program:

//HC-05 pair password 1234


//Connection A0 ~ BTx , A1 ~
BRx#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
//Create Liquid Crystal Object called LCD
LiquidCrystal lcd (7, 6, 5, 4, 3, 2);
SoftwareSerial mySerial (A0, A1); //(Connect TX, RX from bluetooth to Pin
A0,A1 in Arduino);
String val = "No Data";
String oldval;
String newval = "No Data";
int i = 0;
void setup()
{
// Initialize the LCD
lcd.begin(16,2); //Tell Arduino to start your 16 column 2 row LCDmySerial.begin(9600);
Serial.begin(9600);
lcd.setCursor(0, 0); //Set cursor to first column of first rowlcd.print("Welcome!");
delay(2000);
void loop()
{
val = mySerial.readString();
val.trim();
Serial.println(val);
if(val != oldval)
{
newval = val;
}
lcd.clear(); lcd.setCursor(i, 0);
lcd.print(newval);
i++;
if(i >= 15)
{
i = 0;
}
val = oldval;
}
VIVA-QUESTIONS:-

1. Name few applications of Bluetooth.


2. Why can Bluetooth equipment integrate easily in TCP/IP network?
3. Is it possible to connect multiple Bluetooth hubs?
4. What are some of the uses of Bluetooth?
5. Under what frequency range does Bluetooth work?

ASSIGNMENT QUESTIONS

CO
S.No Questions Mapping BT level Complexity

1. Setup a bluetooth network. C03 Create High

Construct Bluetooth low energy Protocol Stack


2. C03 Create High
Basics

RESULT:

Thus, the Arduino is interfaced to the Bluetooth module and the output is verified.
EX.NO:05 INTRODUCTION TO RASPBERRY PI PLATFORM AND PYTHON
PROGRAMMING

Aim:
To write the python program for Turn on & off a LED.

Apparatus Required:

1. Raspberry Pi
2. PiCo W
3. LED
4. Connecting Wires

Theory:

Python is the official programming language of the Raspberry Pi. It is known for its two unique characteristics:
cross-platform compatibility and easy-to-understand syntax. Unlike lower-level languages like C and C++, Python uses
a Python interpreter that translates the Python program into machine-specific instructions. So as long as you have a
Python interpreter on your computer, you can run any Python program written on whatever machine. Moreover,
compared to other languages, the syntax is simple. Syntax is the arrangement of symbols, words, and phrases needed
to make a Python program work. The friendly Python syntax makes programming fun, which is perfect for a credit card
computer that is made to acquaint people in the field of computer science.

Program:

import machine

import time

led=machine.Pin(15,machine.Pin.OUT)

while (True):

led.on()

time.sleep(1)

led.off()

time.sleep(1)
VIVA QUESTIONS:-

1. What is Raspberry PI?

2. How is Raspberry PI used in IoT?

3. What are the different components of a Raspberry PI board?

4. What is the language used by Raspberry PI?

5. How is Raspberry PI different from Arduino?

ASSIGNMENT QUESTIONS

S. CO
Questions Mapping BT level Complexity
No.
Open source prototype platform- Raspberry-
1. Pi/Beagle board/Arduino - Simple program digital
read/write using LED and Switch - Analog C03 Create High
read/write using sensor and actuators.

Design a web interface to control connected


2. LEDs remotely using Raspberry-Pi/Beagle C03 Create High
board/Arduino.

RESULT:

Thus, the LED was turned on and off and the output was verified.
EX.NO:06 INTERFACING SENSORS TO RASPBERRY PI

Aim:
To write the python program for measure the obstacle distance in cm using Ultrasonic Sensor.

Apparatus Required:

1. Raspberry Pi
2. PiCo W
3. Ultrasonic Sensor (HC-SR04)
4. Connecting Wires

Theory:

HC-SR04 stands for High-Conductance Ultrasonic Sensor consists of a transmitter and


receiver. The sensor measures how far things are without touching them, and it uses sound
waves to get the measurements right. It can work well when things are between two to four
centimeters away.

Program:

from machine import Pin


import utime
trigger = Pin(16, Pin.OUT)
echo = Pin(17, Pin.IN)
def ultra():
trigger.low()
utime.sleep_us(2)
trigger.high()
utime.sleep_us(5)trigger.low()
while echo.value() == 0:
signaloff = utime.ticks_us()
while echo.value() == 1:
signalon = utime.ticks_us()
timepassed = signalon - signaloff
distance = (timepassed * 0.0343) / 2
print("The distance from object is ",distance,"cm")
while True:
ultra()
utime.sleep(1)
VIVA QUESTIONS:-

1. What is the purpose of HC-SR04 sensor?


2. What are the 4 pins of the HC-SR04 sensor?
3. What is the maximum distance of the HC-SR04 sensor?
4. What type of sensor is HC-SR04?
5. How to increase HC-SR04 range?

ASSIGNMENT QUESTIONS

S. CO
Questions Mapping BT level Complexity
No.

1. Write a program for distance measurement using


Ultrasonic sensor and Arduino C03 Create High

Design a web interface to control connected


2. LEDs remotely using Raspberry-Pi/Beagle C03 Create High
board/Arduino.

RESULT:

Thus, the sensors were interfaced to Raspberry Pi and the output was verified.
EX.NO:07 COMMUNICATE BETWEEN ARDUINO AND RASPBERRY PI USING ANY
WIRELESS MEDIUM

Aim of the Experiment:


To write the python program for communication between Arduino and Raspberry Pi
UsingZigBee Wireless Medium.
Apparatus Required:

1. Raspberry Pi
2. PiCo W
3. Arduino UNO
4. AtMega328 Microcontroller
5. Zigbee Transmitter (ZTx)
6. Zigbee Receiver (ZRx)
7. Connecting Wires

Raspberry Pi Interface with ZiGBee Transmitter Program:

#Pin GP0 connected to ZRx


#Pin GP1 Connected to ZTx
#Switch off 7 in Dip switch S3
#Press SW3 Push Button in Transmitter for Led On in Receiver Trainer.from
machine import UART, Pin
import time
sw =machine.Pin(16,machine.Pin.IN)
uart0 = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))
while True:
a = sw.value()
if(a==1):
uart0.write('1')
else:
uart0.write('0')

Arduino Interface with ZigBee Reciver Program:

//Pin 2 connected to ZTx


//Pin 3 Connected to ZRx
//Led13 On in receiver kit while press sw3 switch in Tranmitter Trainer.
#include "SoftwareSerial.h"
#include<SoftwareSerial.>
int led = 13;
int received = 0;
int i;
//For communicating with zigbee
SoftwareSerial zigbee(2,3);
void setup()
{
Serial.begin(9600);
zigbee.begin(9600);
pinMode(led, OUTPUT);
}
void loop()
{
//check if the data is received
if (zigbee.available() > 0)
{
received = zigbee.read();
//if the data is 0, turn off the LED
if (received == '0')
{
Serial.println("Turning off LED");
digitalWrite(led, LOW);
}
//if the data is 1, turn on the LED
else if (received == '1')
{
Serial.println("Turning on LED");
digitalWrite(led, HIGH);
}
}

}
VIVA QUESTIONS:-

1. What is the principle of zigbee?


2. Which network is zigbee used in?
3. What is the speed of zigbee?
4. Why Zigbee is better?
5. What is the application of zigbee?

ASSIGNMENT QUESTIONS

S. CO
Questions Mapping BT level Complexity
No.

1. Write a program for communication between


Arduino and Raspberry Pi through WiFi. C03 Create High

Write a program for communication between Arduino


2. and Raspberry Pi using LoRa Module SX1278 C03 Create High

RESULT:

Thus, the communication between Arduino and Raspberry Pi using ZigBee wireless medium
is done and the output was verified.
EX.NO:08 SETUP A CLOUD PLATFORM TO LOG THE DATA

Aim:

To setup a Thingspeak cloud platform to log the data.

Apparatus Required:

1. Arduino UNO
2. Arduino IDE 1.8.2 or higher
3. Thingspeak Account
4. Thinhspeak Library
5. Arduino Wifi Shield 101
6. Photocell
7. Temperature Sensor (This example uses a TMP36)
8. 10K Ohm Resistor

Procedure:

Step-1: The first step is to create an account. The good part is that ThingSpeak does not require a
Credit card (like AWS/Azure) for signing up. You may sign up here.
Step-2: After signing up on ThingSpeak, login here.
Step-3: Create a new ThingSpeak channel by clicking on the "New Channel".
Step-4: In the new channel creation screen, fill out the details of the device from which data will be
received.
Step-5: In the new channel creation screen, scroll down further and make this channel public. So that
you can post data to it.
Step-6: After saving the channel, the channel details screen will get displayed (as shown below). Notice
that there will be 5 tabs: Private View, Public View, Channel Settings, API Keys and Data
Import/Export. You are all set! Browse through them to get a feeling of the contents. Make note of the
Channel ID, as you will need it for posting and reading data to ThingSpeak.
Step-7: Now we will see how to log data and read data to and from this channel. Browse to the API
Keys tab for your channel. Note down the read and write api_keys (as shown below), as you will need
it for posting and reading data to ThingSpeak. I have obscured the api keys for my channel intentionally.
Never share your channel api keys with unintented recipients as they might spam the channel
inadvertently.
Step-8: Use the following URL format to log data to ThingSpeak.
https://api.thingspeak.com/update.json?api_key=<your-write-api-key>&field1=58
Upon hitting the above URL, the data '58' will get logged in the ThingSpeak IoT cloud.
Correspondingly, you can also see the logged data in the ThingSpeak channel's Private/Public.
Step-9: Use the following URL format to read the logged data from ThingSpeak.
http://api.thingspeak.com/channels/<your-channel-id>/feeds.json?key=<your-read-api-
key>&results=1
On hitting the above URL in the browser, you will receive the last posted data row from ThingSpeak.

Code:

char ssid[] = "networkssid"; // your network SSID (name)


char pass[] = "password"; // your network password
char thingSpeakAddress[] = "api.thingspeak.com";
String APIKey = "O2JUIN8J6CPPX1AW"; //enter your channel's Write API Key
const int updateThingSpeakInterval = 20 * 1000; // 20 second interval at which to update ThingSpeak
float voltage = analogRead(A1) * (3.3 / 1024); // convert from range 0 - 1023 to 0 - 3.3V
int tempVal = (voltage - 0.5) * 100; // convert to Celsius using offset of 0.5V
String light = String(analogRead(A0),DEC);
String temp = String(tempVal,DEC);
if (!client.connected() && (millis() - lastConnectionTime > updateThingSpeakInterval)) {
updateThingSpeak("field1=" + light + "&field2=" + temp);
}
VIVA QUESTIONS:-

1. What is a ThingSpeak cloud?

2. How much data can be stored in ThingSpeak?

3. Is ThingSpeak open source?

4. What protocols are supported in ThingSpeak?

5. What is the difference between Google IoT and ThingSpeak?

ASSIGNMENT QUESTIONS

CO
S.No Questions Mapping BT level Complexity

1. Draw the diagram of the procedure of IoT cloud


platform ThingSpeak. CO4 Create Medium

2. Construct the IoT architecture. CO4 Create Medium

RESULT:

Thus, the IoT cloud platform ThinkSpeak was set up to log the data and the output was

verified.
EX.NO:09 LOG DATA USING RASPBERRY PI AND UPLOAD TO THE CLOUD
PLATFORM

Aim:
To write the python program for Log Temperature Data using Raspberry Pi and upload to
the Cloud Platform.

Apparatus Required:
1. Raspberry Pi
2. PiCo W
3. LM35 Temperature Sensor

Theory:

LM35 sensor uses the basic principle of a diode, whereas the temperature increases, the
voltage across a diode increases at a known rate. By precisely amplifying the voltage change, it is
easy to generate an analog signal that is directly proportional to temperature.

Program:
Import network
import urequests
from time import sleep
import machine
sensor_temp = machine.ADC(26)
#Network Initialization
ssid = "IElec Systems"
password = "9840838264"
def ConnectWiFi():
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(ssid, password)
while wlan.isconnected() == False:
print('Waiting for connection...')
sleep(1)
ip = wlan.ifconfig()[0]
print(f'Connected on {ip}')
return ip
#Connect to Network
ip = ConnectWiFi()
#ThingSpeak Initialization
server = "http://api.thingspeak.com/"
apikey = "74085BCYRZG0G9YJ"
field = 1
#Main Program
while True:
temperature = sensor_temp.read_u16()
temperature = ((temperature/65535)*3300)/10
print(temperature)

url = f"{server}/update?api_key={apikey}&field{field}={temperature}"
request = urequests.post(url)
request.close()

sleep(20)
VIVA QUESTIONS: -

1. Which type of sensor is LM35?


2. What is the range of LM35/
3. Why is LM35 used to measure the temperature?
4. What are the advantages of LM35?
5. What are the applications of LM35 sensor?

ASSIGNMENT QUESTIONS

CO
S.No Questions Mapping BT level Complexity

1. Write a code for Interfacing LM35 Temperature


Sensor with Arduino. CO4 Create High

Design an embedded system using an LM35


2. sensor that monitors the temperature and flashes
CO4 High
an external LED whenever the temperature Create
exceeds 30ºC.

RESULT:

Thus, the data was logged using Raspberry Pi and uploaded to the Cloud Platform.
EX.NO:10 DESIGN AN IOT BASED SYSTEM

Aim:

To write a program to design a Home Automation system using Ardunio and Bluetooth control.

Apparatus Required
1. PIR Motion Sensor (generic)
2. HC-05 Bluetooth Module
3. LDR (Light Dependent Resistor)
4. LED (generic)
5. Arduino UNO
6. Temperature Sensor
7. Relay (generic)
8. Jumper wires (generic)
9. Apps and platforms
10. Arduino IDE
11. Windows 10

Theory:

Configurations for room:

An Arduino UNO will control devices and reads sensor data. The figure "Room
Architecture" depicts how the Arduino UNO will connects with the devices and sensors. Room
have multiple controllable devices (i.e. Light(s), Fan, Wall Socket(s), etc.), one PassiveIR (to
detect human presence in the room), one temperature sensor (LM35 to collect room temperature)
and LDR (to detect light intensity near room window).

PIR:

PIR sensor consists of three pins, ground, signal, and power at the side or bottom.
Generally, the PIR sensor power is up to 5V, but, the large size PIR modules operate a relay instead
of direct output.

Program:

float x,y; //TEMP


#define trigPin 12 //ULTRA
#define echoPin 10
int ledPin= 13;
int duration, distance; //ULTRA
#include<Servo.h> //servo
Servo my; //servo
char val; //bluetooth
void setup() {
Serial.begin(9600);
pinMode(2,INPUT); //IR GATE FIRST
pinMode(3,INPUT);
my.attach(11); //servo
pinMode(4, OUTPUT); //IR GATE FIRST
pinMode(7,OUTPUT); //TEM
pinMode(8,INPUT); //pir 1
pinMode(9,OUTPUT); //LED 1
// pinMode(10,INPUT); //pir 2
//pinMode(11,OUTPUT); //LED2
pinMode(trigPin, OUTPUT); //12 PIN ULTRA
pinMode(echoPin, INPUT); //10 PIN ULTRA
pinMode(ledPin, OUTPUT); //13 PIN ULTRA
pinMode(3,OUTPUT); //bluetooth
}
void loop() {
x=analogRead(0); //TEMP
y=((x/1024)*5)*100;
Serial.println(y);
delay(500);
if(y>44)
{
digitalWrite(7,1);
}
else
{
digitalWrite(7,0);
delay(500);
}
//TEMP

if(digitalRead(8)==HIGH) //pir
{
digitalWrite(9,HIGH);
}
Else
{ digitalWrite(9,LOW);}
digitalWrite(trigPin, HIGH); //ULTRA
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance >= 10 || distance <= 0)
{
// Serial.println("no object detected");
digitalWrite(ledPin,LOW);
}
else
{
Serial.println("object detected \
");
Serial.print("distance= ");
Serial.print(distance);
digitalWrite(ledPin,HIGH);
} //ULTRA
if(digitalRead(2)==HIGH) //gate first
{
my.write(0); //servo
}
Else
{
my.write(90); //servo
}
analogRead(5); //ldr
float a = analogRead(5);
Serial.println(a);
if (a <=200) {
digitalWrite(4,1);
Serial.println("LDR is DARK, LED is ON");
}
else {
digitalWrite(4,0);
Serial.println("-----");
} //ldr
if (Serial.available()) //bluetooth
{
val = Serial.read();
Serial.println(val);
if(val == 'TV')
digitalWrite(3,HIGH);
else if(val == 'tv')
digitalWrite(3,LOW);
} //Bluetooth
}
VIVA QUESTIONS: -

1. Can you explain how a microcontroller works?

2. What’s the difference between digitalWrite() and analogWrite() in Arduino?

3. What is serial communication in context with Arduino?

4. What types of inputs can be used with Arduino?

5. What is an IDE (Integrated Development Environment)? Which one would you use when
working with Arduino?

ASSIGNMENT QUESTIONS

CO
S.No Questions Mapping BT level Complexity

You have just joined as an IoT Architect at


Ingenious IoT. The first project you have been tasked
with is the setup of a demo IoT Smart Office, with a
link to the company offices. The project is divided
into 2 parts:
1.
1. Create a smart office with the criteria and CO5 Create High
devices given
2. Control these smart devices from the branch
office which is in the same city.

RESULT:

Thus, the program was written to design a Home Automation system using Ardunio and
Bluetooth control and the output was verified.
EX. NO: 11 INTERFACING ARDUINO TO ULTRASONIC SENSOR

Aim of the Experiment:

To interface an Arduino with an ultrasonic sensor to measure distance and show it on the Serial
monitor.

Components Required

1. Arduino board (e.g., Arduino Uno)


2. HC-SR04 Ultrasonic Sensor
3. I2C LCD Display (e.g., 16x2 characters)
4. Jumper wires

HCSR04 Ultrasonic Sensor Pinout:


The Ultrasonic Sensor has 4 pins: - VCC, Trig, Echo and GND.

VCC - The supply pin of the HC-SR04 Module.

GND - This is the Ground pin of the module

Trig - This is the trigger pin of the HC-SR04 module

Echo - This is the echo pin of the HC-SR04 sensor module.

Working of Ultrasonic Sensor

An ultrasonic sensor comprises several essential components that work together to


measure distances or detect objects using high-frequency sound waves. At its core is the
transducer, typically made of a piezoelectric crystal, which both emits and receives ultrasonic
waves. The sensor's operation begins with the ultrasonic transmitter, which sends out bursts of
high-frequency sound waves into the environment.
On the back of the Ultrasonic sensor, we have the MAX232 sensor on right side, which converts
the electrical signal received from the trig pin. Converts it into ultrasonic pulse and send it’s
through the transmitter side.

These waves bounce off objects in their path and are detected by the ultrasonic receiver.
The two LM324 ICs on the left side take this ultrasonic pulse converts it into electrical signal and
sends it to the echo pin. The receiver converts the reflected waves into electrical signals.

The time it takes for the sound waves to travel to the object and back is precisely measured
by signal processing circuitry within the sensor. This time measurement is crucial for calculating
distances and determining the presence of objects in proximity to the sensor. Now to calculate the
distance we will use the following formula.

Speed= Distance x Time


Code for Interfacing Ultrasonic Sensor with Arduino:

const int trigPin = 4;

const int echoPin = 5;

long duration;

int distance;

void setup() {

Serial.begin(9600);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

void loop() {

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = duration * 0.034 / 2;

Serial.print("Distance: ");

Serial.print(distance);

Serial.println(" cm");

delay(1000);
RESULT:

Finally, a delay of 1000 milliseconds (1 second) is added to control the rate at which
distance measurements are taken. You can adjust this delay to change the measurement frequency
as per your requirements.
EX. NO.: 12 INTERFACING 16x2 LCD WITH ARDUINO

Aim of the Experiment:

To Interface A 16x2 LCD with Arduino UNO.

Components Required
Hardware:

1. ARDUINO UNO,
2. power supply (5v),
3. JHD_162ALCD(16x2LCD),
4. 100uF capacitor.
Software:

1. Arduino IDE (Arduino nightly).

Circuit Diagram and Explanation

In 16x2 LCD there are 16 pins over all if there is a back light, if there is no back light there
will be 14 pins. One can power or leave the back light pins. Now in the 14 pins there are 8 data
pins (7-14 or D0-D7), 2 power supply pins (1&2 or VSS&VDD or GND&+5v), 3rd pin for contrast
control (VEE-controls how thick the characters should be shown), and 3 control pins
(RS&RW&E).

In the circuit, you can observe I have only took two control pins, this gives the flexibility.
The contrast bit and READ/WRITE are not often used so they can be shorted to ground. This puts
LCD in highest contrast and read mode. We just need to control ENABLE and RS pins to send
characters and data accordingly.

The connections which are done for LCD are given below:

PIN1 or VSS to ground

PIN2 or VDD or VCC to +5v power

PIN3 or VEE to ground (gives maximum contrast best for a beginner)

PIN4 or RS (Register Selection) to PIN0 of ARDUINO UNO

PIN5 or RW (Read/Write) to ground (puts LCD in read mode eases the communication for user)

PIN6 or E (Enable) to PIN1 of ARDUINO UNO


PIN11 or D4 to PIN8 of ARDUINO UNO

PIN12 or D5 to PIN9 of ARDUINO UNO

PIN13 or D6 to PIN10 of ARDUINO UNO

PIN14 or D7 to PIN11 of ARDUINO UNO

The ARDUINO IDE allows the user to use LCD in 4 bit mode. This type of communication
enables the user to decrease the pin usage on ARDUINO, unlike other the ARDUINO need not to
be programmed separately for using it in 4 it mode because by default the ARDUINO is set up to
communicate in 4 bit mode. In the circuit you can see we have used 4bit communication (D4-D7).
So from mere observation from above table we are connecting 6 pins of LCD to controller in which
4 pins are data pins and 2 pins for control.

Code
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(0, 1, 8, 9, 10, 11); /// REGISTER SELECT PIN,ENABLE PIN,D4 PIN,D5 PIN, D6
PIN, D7 PIN

void setup()

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

void loop()

// set the cursor to column 0, line 1

lcd.print(" CIRCUIT DIGEST");//print name

lcd.setCursor(0, 1); // set the cursor to column 0, line 2

lcd.print("www.circuitdigest.com");//print name
delay(750);//delay of 0.75sec

lcd.scrollDisplayLeft();//shifting data on LCD

lcd.setCursor(0, 0);// set the cursor to column 0, line1

}
RESULT:

Thus, the 16x2 LCD was interfaced with Arduino UNO and the output was verified.
INNOVATIVE PROJECT
EX. NO: 13 SOLAR POWER BANK WITH WIRELESS CHARGING
Aim of the Experiment:
To provide a multi-functional unique power bank product and the device is able to self-
charge anywhere during day time so that the user never runs out of power.
Apparatus Required:
Components

1. Solar Panels
2. Charge Controller
3. Charging Coil
4. Battery Panel
5. LED
6. Voltage Booster IC
7. Charging Circuitry
8. Resistors Capacitors
9. Diodes & transistors
10. Buttons & Switches
11. Electrical & Wirings
12. PCB Board
13. Coil Mounting
14. hinges
15. Plastic Cover
16. Connectors
17. Screws and Fittings

Theory:

Power banks are one of the need to have product these days. But even power banks need
charging. For that one needs to get the power bank charged in a power plug. This is not always
possible when travelling so here we design a smart solar powered folding power bank.
The solar power bank integrates solar charging with efficient battery support and wireless charging
to provide a multi-functional unique power bank product. The device is able to self-charge
anywhere during day time so that he user never runs out of power.

This Wireless charging solar power bank provides the following advantages:

 Easy Wireless Charging for compatible phones


 Solar Self Charging
 Foldable Design for Portability
 20000maH battery backup
 Added USB Type Charging port availability

The smart solar power bank integrates lithium battery pack with solar panels battery protection
and wireless charging coils using dc power boosters and charge controllers to provide for a feature
packed power bank.

This solar panels are used with charge controllers to charge the battery pack using charging
circuitry. The powerbank makes use of LED for indication of current battery capacity. AN Adapter
can also be used to directly charge the powerbank using AC power if needed.

The battery pack power is used to power the induction coil that is mounted on the top of the power
bank. When mobile phone is placed over the top of the power bank an electromagnetic induction
effect induces electric current in the coil mounted in the phone back. This is used to charge the
phone wirelessly.

Applications:

 Camping and Outdoors


 Travelling
 Home and office

Advantages:
 Easy Wireless Charging for compatible phones
 Solar Self Charging
 Foldable Design for Portability
 20000maH battery backup
 Added USB Type Charging port availability

Disadvantages:
 It has a limited battery Life
Block Diagram:
RESULT

Thus, the solar power bank is charged through wireless charger and the output was
verified.

You might also like