ESIOT Manual
ESIOT Manual
(Approved by AICTE, New Delhi & Affiliated to the Anna University, Chennai)
CHENNAI-BANGALORE HIGH ROAD, OPP. TO HYUNDAI CAR COMPANY IRUNGATTUKOTTAI,
SRIPERUBUDUR, CHENNAI – 602 117
NAME: ____________________________
YEAR: _____________________________
EX NO 1
DATE:
AIM:
To write an assembly language program to transfer N bytes of data from the location A
to location B.
PROGRAM:
mov @rl,a
inc r0
inc r1
end
OUTPUT:
RESULT:
Thus, the assembly language program to transfer the N bytes of data from location A
to location B has been executed successfully.
(b) Write an assembly language program to find the largest element in a given array of
N = _________ h bytes at location 4000h. Store the largest element at location 4062h.
AIM:
To write an assembly language program to find the largest element in a given array.
PROGRAM:
Let N=06h
mov a,@dptr
mov r1,a
movx a,@dptr
mov r1,a
end
OUTPUT:
RESULT
Thus, the assembly language program to find the largest element is a given array has been
executed successfully.
(C) Write an assembly language program to sort an array of N=__________h bytes of
data in ascending/descending order stored from location 9000h. (using bubble sort
algorithm).
AIM:
PROGRAM:
Let N=06h
loop 2: movx a, @dptr //get number from array and store in B register
mov b,a
inc dptr
movx @dptr,a
mov a,r2
movx @dptr,a
inc dptr
end
OUTPUT:
RESULT:
DATE:
AIM:
THEORY:
1. Addition
2. Multiplication
3. Subtraction
4. Division
PROGRAM:
clr c
mov a,r0
mov a,r2
mov 22h,a
mov a,r1
addc a,r3
mov 21h,a
mov 00h,c
end
OUTPUT:
PROGRAM:
clr c
mov a,r0
subb a,r2
mov 22h,a
mov a,r1
subb a,r3
mov 21 h,a
mov 00h,c
end
OUTPUT:
PROGRAM:
Let N= 05
mov a,#05
mov b,a
mul ab
mov 30h,a
mov 31h,b
end
OUTPUT:
PROGRAM:
mov r0,#0fh
mov a,r0
mov b,r0
mul ab
mov r1,b
mov b,r0
mov ab
mov 32h,a
mov r2,b
mov a,r1
mov b,r0
mul ab
add a,r2
mov 31h,a
mov a,b
addc a,#00h
mov 30h,a
end
OUTPUT:
e) Logical operations AND, OR, XOR on two eight-bit numbers stored in internal RAM
locations 21h,22h.
PROGRAM:
mov a,21h
mov a,21h
end
OUTPUT:
RESULT:
DATE:
AIM:
PROGRAM:
#include<reg51.h>
sbit a=P3^0;
sbit b=P3^1;
sbit c=P3^2;
sbit d=P3^3;
void main()
unsigned inti,j;
a=b=c=d=1;
while(1)
for(i=0;i<10;i++)
P2=n[i];
for(j=0;j<60000;j++);
TIMER DELAY
WAR to generate the SOO us time delay using T1M2(timer1 and mode2)?
#include<reg51.h>
void main()
unsigned chari;
TH1=0x00;
TR1=1;//timer ON//
TF1=0;
TR1=0;//timer off//
}
OUTPUT:
RESULT:
Thus, the arithmetic program using embedded C to display the numbers form ‘0 to F’ on
four 7 segment displays has been executed successfully.
EX NO. 4
DATE:
AIM:
THEORY:
Arduino is a project, open-source hardware, and software platform used to design and build
electronic devices. It designs and manufactures microcontroller kits and single-board
interfaces for building electronics projects. The Arduino boards were initially created to help
the students with the non-technical background. The designs of Arduino boards use a variety
of controllers and microprocessors. The Arduino board consists of sets of analog and digital
I/O (Input / Output) pins, which are further interfaced to breadboard, expansion
boards, and other circuits. Such boards feature the model, Universal Serial Bus (USB),
and serial communication interfaces, which are used for loading programs from the
computers.
ESP 32
Before starting this installation procedure, make sure you have the latest version of the
Arduino IDE installed in your computer. If you don’t, uninstall it and install it again.
Otherwise, it may not work. Installing ESP32 Add-on in Arduino IDE.
To install the ESP32 board in your Arduino IDE, follow these next instructions:
ii. Enter the following into the “Additional Board Manager URLs” field:
https://raw.githubusercontent.com/espressif/arduino-sp32/ghpages/package_esp32_index.json
Then, click the “OK” button.
iii. Open the Boards Manager. Go to Tools > Board > Boards Manager
iv. Search for ESP32 and press install button for the “ESP32 by Espressif Systems”:
v. That is it. It should be installed after a few seconds.
Plug the ESP32 board to your computer. With your Arduino IDE open, follow these steps:
1. Select your Board in Tools > Board menu (in my case it’s the DOIT ESP32 DEVKIT
V1)
2. Select the Port (if you don’t see the COM Port in your Arduino IDE, you need to
install the CP210x USB to UART Bridge VCP Drivers)
3. Open the following example under File > Examples > WiFi (ESP32) > WiFiScan
4. A new sketch opens in your Arduino IDE
5. Press the Upload button in the Arduino IDE. Wait a few seconds while the code
compiles and uploads to your board.
6. If everything went as expected, you should see a “Done uploading.” message.
PIN CONFIGURATIONS
1. IR SENSOR - ESP32
2. O/P GPIO 4
3. BUZZER/LED GPIO 13
PROGRAM:
i) //Same code for both LED and Buzzer (mention Pin no)
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
void loop() {
digitalWrite(LED_BUILTIN, LOW); // turn the LED on (HIGH is the
voltage level)
voltage LOW
OUTPUT:
void setup() {
pinMode(buttonPin, INPUT);
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, LOW);
else {
digitalWrite(ledPin, HIGH);
OUTPUT:
RESULT:
Thus, Arduino IDE was installed and basic program was executed.
EX NO 5 EXPLORE DIFFERENT COMMUNICATION METHODS WITH IOT
DEVICES (ZIGBEE, GSM, BLUETOOTH)
DATE:
AIM:
To study various communication methods with IoT devices ZigBee, GSM, Bluetooth.
THEORY:
Zigbee
ZigBee is similar to Bluetooth and is majorly used in industrial settings. It has some
significant advantages in complex systems offering low-power operation, high security,
robustness and high and is well positioned to take advantage of wireless control and sensor
networks in IoT applications. The latest version of ZigBee is the recently launched 3.0, which
is essentially the unification of the various ZigBee wireless standards into a single standard.
Bluetooth
This works with android phones and the HC-05 and HC-06 bluetooth modules, as well as
pretty much any arduino or arduino clone.
RX-pin2
TX-pin 3
GND-GND
VCC-5v
Open up the bluetooth settings on your phone and look for the module. Mine is named
Sailfish but yours should be named either hc-05 or hc-06. The password is almost always
1234, if not, try 0000.
Download a Bluetooth terminal app from the Appstore, this one work great:
https://play.google.com/store/apps/details?id=Qwerty.BluetoothTerminal&hl=en and open it
up. Open the app, hit connect to a device - insecure and select your Bluetooth module from
the list.
Step 5: Ready to Go!
Finally open up the Serial Monitor in the Arduino IDE by hitting the magnifying glass in the
top right corner, and you should be good to go. You now have a back and forth extremely
simple connection between your phone and your Arduino via Bluetooth.
Cellular
Any IoT application that requires operation over longer distances can take advantage of
GSM/3G/4G cellular communication capabilities. While cellular is clearly capable of sending
high quantities of data, especially for 4G, the cost and power consumption will be too high
for many applications. But it can be ideal for sensor-based low-bandwidth-data projects that
will send very low amounts of data over the Internet.
PIN CONFIGURATION
1. DHT 11 - ESP 32
2. O/P - GPIO 2
PROGRAM:
#include <BluetoothSerial.h>
#include "DHT.h"
#define dhtPin 2
BluetoothSerial SerialBT;
void setup() {
Serial.begin(115200);
dht.begin();
void loop() {
if (isnan(temperature) || isnan(humidity)) {
return;
SerialBT.print("Temperature: ");
SerialBT.print(temperature);
SerialBT.print(" °C\t");
SerialBT.print("Humidity: ");
SerialBT.print(humidity);
SerialBT.println(" %");
delay(2000);
OUTPUT:
PIN CONFIGURATION
1. DHT 11 - ESP 32
2. O/P - GPIO 2(On Board LED)
PROGRAM:
#include <BluetoothSerial.h>
#if !defined(CONFIG_BT_ENABLED) ||
!defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menu config` to and enable
it
#endif
#define ledPin 2
BluetoothSerial SerialBT;
char incomingChar;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(115200);
void loop() {
if (SerialBT.available()){
if (incomingChar != '\n'){
message += String(incomingChar);
}else{
message = "";
Serial.write(incomingChar);
if (message =="on"){
digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);
delay(20);
OUTPUT:
RESULT:
Thus, study various communication methods with IoT devices ZigBee, GSM, Bluetooth was
done.
EX NO 6 INTRODUCTION TO RASPBERRY PI PLATFORM AND
PYTHON PROGRAMMING
DATE:
AIM:
THEORY:
• Model A
• Model A +
• Model B
• Model B +
Among these models, the Raspberry Pi B models are the original credit-card sized format.
On the other hand, the Raspberry Pi A models have a smaller and more compact footprint and
hence, these models have the reduced connectivity options.
Raspberry Pi Zero models, which come with or without GPIO (general-purpose input output)
headers installed, are the most compact of all the Raspberry Pi boards types.
PROGRAM:
CONTROL LED:
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18,GPIO.OUT)
while True:
GPIO.output(18,True)
time.sleep(1)
GPIO.output(18,False)
time.sleep(1)
OUTPUT:
RESULT:
Thus, Raspberry Pi is introduced and python program for controlling LED is executed.
EX NO 7 INTERFACING SENSORS WITH RASPBERRY PI
DATE:
AIM:
THEORY:
CIRCUIT DIAGRAM:
COMPONENTS REQUIRED:
Raspberry Pi 3 Model B
IR Sensor
5V Buzzer
Mini Breadboard
Connecting Wires
Power Supply
Computer
CIRCUIT DESIGN:
The IR Sensor Module has only three Pins: VCC, GND and Data. Connect the VCC and
GND pins of the IR Sensor to +5V and GND pins of the Raspberry Pi. Then connect the Data
pin of the IR Sensor to GPIO23 i.e., Physical Pin 16 of the Raspberry Pi. To indicate the
alarm, I have used a simple 5V Buzzer. Connect one terminal of the buzzer to GND of
Raspberry Pi and the other terminal (usually marked +) to GPIO24 i.e., Physical Pin 18 of
Raspberry Pi.
OUTPUT:
OUTPUT:
3) RGB LIGHT
from machine import Pin
import utime
red = Pin(11, Pin.OUT)
green = Pin(12, Pin.OUT)
blue = Pin(13, Pin.OUT)
while True:
red.value(0)
green.value(0)
blue.value(0)
utime.sleep(2)
red.value(1)
green.value(0)
blue.value(0)
utime.sleep(2)
red.value(0)
green.value(0)
blue.value(0)
utime.sleep(2)
red.value(0)
green.value(1)
blue.value(0)
utime.sleep(2)
red.value(0)
green.value(0)
blue.value(0)
utime.sleep(2)
red.value(0)
green.value(0)
blue.value(1)
utime.sleep(2)
OUTPUT:
RESULT:
DATE:
AIM:
PROCEDURE: -
To starting using the Arduino IoT cloud, we first need to log in or sign up to Arduino.
After we have signed up, you can access the Arduino IoT Cloud from any page on arduino.cc
by clicking on the four dots menu in the top right corner. You can also go directly to the
Arduino IoT Cloud.
3. Creating a Thing
The journey always begins by creating a new Thing. In the Thing overview, we can choose
what device to use, what Wi-Fi network we want to connect to, and create variables that we
can monitor and control. This is the main configuration space, where all changes we make are
automatically generated into a special sketch file.
4. Configuring a Device
Devices can easily be added and linked to a Thing. The Arduino IoT Cloud requires your
computer to have the Arduino Create Agent installed. The configuration process is quick and
easy, and can be done by clicking on the “Select device” button in the Thing overview. Here,
we can choose from any board that has been configured, or select the “Configure new device”
option.
Configuring a device
We can also get a complete overview of our devices by clicking the “Devices" tab at the top
of the Arduino IoT Cloud interface. Here we can manage and add new devices.
5. Creating Variables
The variables we create are automatically generated into a sketch file. There are several data
types we can choose from, such as int, float, boolean, long, char. There are also special
variables, such as Temperature, Velocity, Luminance that can be used. When clicking on the
“Add variable” button, we can choose name, data type, update setting and interaction mode.
Creating variables
6. Connecting to a Network
To connect to a Wi-Fi network, simply click the “Configure” button in the network section.
Enter the credentials and click “Save”. This information is also generated into your sketch
file!
An automatically generated sketch file can be found in the “Sketch” tab. It has the same
structure as a typical .ino file, but with some additional code to make the connection to your
network and to the cloud. A sketch that, for example, reads an analog sensor, and use the
cloud variable to store it. When the sketch has been uploaded, it will work as a regular sketch,
but it will also update the cloud variables that we use. Additionally, each time we create a
variable that has the Read & Write permission enabled, a function is also generated, at the
bottom of your sketch file. Each time these variable changes, it will execute the code within
this function! This means that we can leave most of the code out of the loop () and only run
code when needed.To upload the program to our board, simply click the "Upload" button.
The editor also has a Serial Monitor Tool, which can be opened by clicking the magnifying
glass in the toolbar. Here you can view information regarding your connection, or commands
printed via
Serial.print()
After we have successfully uploaded the code, we can open the “Serial Monitor” tab to view
information regarding our connection. If it is successful, it will print “connected to
network_name” and “connected to cloud”. If it fails to connect, it will print the errors here as
well. The cloud editor is a mirrored "minimal" version of the Web Editor. Any changes you
make will also be reflected in the Web Editor, which is more suitable for developing more
advanced sketches.
8. Creating a Dashboard
Now that we have configured the device & network, created variables, completed the sketch
and successfully uploaded the code, we can move on to the fun part: creating dashboards!
Visualize your data
Dashboards are visual user interface for interacting with your boards over the cloud, and we
can setup many different setups depending on what your IoT project needs. We can access
our dashboards by clicking on the “Dashboards” tab at the top of the Arduino IoT Cloud
interface, where we can create new dashboards, and see a list of dashboards created for other
Things.
Navigating to dashboards
If we click on “Create new dashboard”, we enter a dashboard editor. Here, we can create
something called widgets. Widgets are the visual representation of our variables we create,
and there are many different to choose from. Below is an example using several types of
widgets.
The different widgets available
When we create widgets, we also need to link them to our variables. This is done by clicking
on a widget we create, select a Thing, and select a variable that we want to link. Once it is
linked, we can either interact with it, for example a button, or we can monitor a value from a
sensor. As long as our board is connected to the cloud, the values will update.
Let's say we have a temperature widget that we want to link to the temperature variable inside
the Cloud project thing.
Note that not all widgets and variables are compatible. A switch and an integer can for
example not be linked, and will not be an option while setting up your dashboard.
We can also have several things running at once, depending on your Arduino IoT Cloud plan,
which we can include in the same dashboard. This is a great feature for tracking multiple
boards in for example a larger sensor network, where boards can be connected to different
networks around the world, but be monitored from the same dashboard.
RESULT:
DATE:
AIM:
To log data using Raspberry Pi and upload data to the cloud platform.
THEORY:
ThingSpeak is an open IoT platform for monitoring your data online. In ThingSpeak channel
you can set the data as private or public according to your choice. ThingSpeak takes
minimum of 15 seconds to update your readings. Its a great and very easy to use platform for
building IOT projects.
There are also some other platforms available for monitoring your data online which we will
cover in later articles but there are some advantages of ThingSpeak over other platforms like
it is very easy to set up and it also has many options to plot graph.
Components Required
1. Raspberry Pi
2. Power Cable
3. WiFi or Internet
Step 1: Go to https://thingspeak.com.
Step 5: And now paste the Write API Key in your code and your channel number in place of
“myChannelNumber” and “myWriteAPIKey”.
Step 6: After pasting the API key and Channel number, now you can upload the code to
ESP32.
Step 7: Now you can view the temperature and humidity data in the form of graph in your
channel i.e., in the private view.
PROGRAM:
WiFiServer server(80);
WiFiClient client;
//----DHT declarations
void setup()
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, passphrase);
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected.");
Serial.println(WiFi.localIP());
server.begin();
//----nitialize dht11
dht.begin();
void loop ()
delay(2500);
float f = dht.readTemperature(true);
return;
Serial.println("ºC");
Serial.print("Humidity");
Serial.println(h);
ThingSpeak.setField(1, t);
ThingSpeak.setField(2, h);
store up to 8 different
int x = ThingSpeak.writeFields(myChannelNumber,myWriteAPIKey);
if(x == 200){
else{
lastTime = millis();
}
OUTPUT:
RESULT:
The cloud platform is setup and log the data to the cloud is done.
EX NO 10 DESIGN AN IOT BASED SYSTEM
DATE:
AIM:
THEORY:
IoT devices and applications become more prevalent, it’s important to consider the ethical
implications of IoT design. Some key ethical considerations include privacy, security, data
ownership, and transparency. For example, imagine a smart home security system that uses
cameras and sensors to monitor a family’s activity. While the system may be effective in
preventing theft or intruders, it could also collect personal data about the family’s daily
routines and habits, which could be used for nefarious purposes if it falls into the wrong
hands.
2.Develop transparent data policies: IoT designers should develop transparent data
policies that clearly explain what data is being collected and how it will be used, as
well as obtain user consent before collecting any personal data.
3.Consider the impact on vulnerable populations: IoT designers should consider the
potential consequences of their designs, particularly for vulnerable populations such
as children, the elderly, or people with disabilities, and work to ensure that their
products are accessible and inclusive to all users.
5.Educate users: IoT designers should provide clear and concise instructions on how
to use their products safely and securely, as well as provide resources for users to
learn more about IoT security and privacy best practices.
PROGRAM:
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include "DHT.h"
connected
BlynkTimer timer;
void sendSensor(){
float h = dht.readHumidity();
float t = dht.readTemperature(); // or
if (isnan(h) || isnan(t)) {
return;
Blynk.virtualWrite(V0, t);
Blynk.virtualWrite(V1, h);
Serial.print("Temperature : ");
Serial.print(t);
Serial.println(h);
int ledpin = 2;
void setup(){
Serial.begin(115200);
pinMode(ledpin,OUTPUT);
dht.begin();
timer.setInterval(1000L, sendSensor);
void loop(){
Blynk.run();
timer.run();
OUTPUT:
RESULT: