ESIoT Manual
ESIoT Manual
Page Faculty
Sl.No Date PRACTICAL EXERCISES
Number Signature
To be a leader in imparting quality technical education, research & enterprising skills in pursuit of professional excellence.
T o promote quality education & technical skills to meet the industry requirements
To incorporate team work, leadership skills & lifelong learning
To facilitate career development & higher education assistance
To encourage innovative ideas for research & development and entrepreneurship for societal needs
To inculcate ethical responsibility & human values
To create efficient Electronics and Communication Engineers to meet the current and future
demands of industry and society with ethical values
To instill the quality of leadership and entrepreneurship in students
To elevate the spirit of innovation and creativity among students towards research and
development
PROGRAMME OUTCOMES
1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and an
engineering specialization to the solution of complex engineering problems.
2. 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.
3. 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.
4. 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.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern engineering and IT tools
including prediction and modeling to complex engineering activities with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal, health, safety,
legal and cultural issues and the consequent responsibilities relevant to the professional engineering practice.
7. 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.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the engineering
practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in diverse teams, and in
multidisciplinary settings.
10. 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.
11. Project management and finance: Demonstrate knowledge and understanding of the engineering and management
principles and apply these to one’s own work, as a member and leader in a team, to manage projects and in
multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in independent and life-
long learning in the broadest context of technological change.
Program Educational Objectives (PEOs)
PEO-III: Professionalism:
Graduates will excel as estimable engineers with ethics, effective communication and leadership skills.
PSO1: Identify, analyze and provide solutions to the complex engineering problems in the areas of communication,
networking, signal processing and embedded systems with the societal needs in considerations.
PSO2: Apply the contextual knowledge of Electronics and Communication Engineering to design systems containing
electrical/electronic devices, software and hardware using modern tools and techniques.
WRITE 8051 ASSEMBLY LANGUAGE EXPERIMENTS USING SIMULATOR
EXP NO: 1
DATE :
AIM:
SOFTWARE USED:
Keil uvision5
PROGRAM:
org 00h
sjmp start
org 30h
start:
mov r0,#30h //source address
mov r1,#40h //destination address
mov r7,#05h //Number of bytes to be moved
back: mov a,@r0
mov @r1,a
inc r0
inc r1
djnz r7,back //repeat till all data transferred
end
OUTPUT:
Page | 5
RESULT:
Thus the assembly language program was performed and got output successfully.
Page | 6
TEST DATA TRANSFER BETWEEN REGISTERS AND MEMORY
EXP NO: 2
DATE :
AIM:
SOFTWARE USED:
Keil uvision5
PROGRAM:
ORG 0000
Mov R0,#40H
Mov R1,#51H
Mov a,@R0
Mov R2,A
INC R0
Back : Mov A,@R0
Xch A ,@R1
Mov @R0,A
INC R0
INC R1
DjnZ R2,Back
END
Page | 7
OUTPUT:
RESULT:
Thus the data transfer between registers and memory experiment was performed and
got output successfully.
Page | 8
PERFORM ALU OPERATIONS
EXP NO: 3
DATE :
AIM:
SOFTWARE USED:
Keil uvision5
PROGRAM:
org 0000H
mov a,#25H
mov b,#12H
add a,b
mov 40H,a
mov a,#25H
subb a,b
mov 41H,a
mov a,#25H
mul ab
mov 42H,a
mov 43H,b
mov a,#25H
mov b,#12H
div ab
mov 44H,a
mov 45h,b
mov a,#25H
Inc a
mov 46H,a
Dec a
mov 47H,a
end
Page | 9
ADDITION
SUBTRACTION
Page | 10
MULTIPLICATION
DIVISION
RESULT:
Thus the ALU operation was performed and got output successfully.
Page | 11
WRITE BASIC AND ARITHMETIC PROGRAMS USING EMBEDDED C
EXP NO: 4
DATE :
AIM:
SOFTWARE USED:
Keil uvision5
PROGRAM:
#include<stdio.h>
int main()
{
Page | 12
OUTPUT:
RESULT:
Thus the arithmetic programs using embedded C was performed and got output
successfully.
Page | 13
INTRODUCTION TO ARDUINO PLATFORM AND PROGRAMMING
EXP NO: 5
DATE :
Arduino
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 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.
Features
o Arduino programming is a simplified version of C++, which makes the learning process
easy.
o The Arduino IDE is used to control the functions of boards. It further sends the set of
specifications to the microcontroller.
o Arduino does not need an extra board or piece to load new code.
o Arduino can read analog and digital input signals.
o The hardware and software platform is easy to use and implement.
Arduino Download
The Arduino software (IDE) is open-source software. We are required to write the code and
upload the code to the board to perform some task.
Page | 14
The Arduino IDE software can be used with any type of Arduino boards. The software is
available for various operating system such as, Windows, Linux, and Mac OS X.
Or
Page | 15
3. Scroll the screen a little, as shown below:
4. Click on the 'Windows Installer' as we are operating with the Windows. We can select
the Linux or Mac OS X, accordingly.
5. A contribution window will appear. We can contribute according to our choice and click on
the 'CONTRIBUTE &DOWNLOAD' option. Otherwise, click on the 'JUST
DOWNLOAD' option, as shown below:
Page | 16
6. The downloading process will start. The downloading file will look like the below image:
10. Accept the license by clicking on 'I Agree' button, as shown below:
Page | 17
11. Click on the 'Next' button. It is shown below:
12. The window specifying the location of the installed folder will appear.
Page | 18
If you want to change the location, click on the 'Browse' button.
14. Now, we have to accept the security for the installation. We are required to accept the
security Installation three times.
Page | 19
15. Again, click on the 'Install' button. It is shown below:
17. The installation process is now completed. The window will now appear as:
Page | 20
18. Click on the 'Close' button at the bottom.
The Arduino IDE software will appear on your desktop, as shown below:
20. The Arduino IDE environment is written in the programming language named as Java. So,
we need to allow access to the Java Platform.
As soon we open the Arduino software, a license window will appear, as shown below:
Page | 21
Accept the license by clicking on the 'Allow access' button.
We can view the port of the attached hardware Arduino IDE to our computer.
Page | 22
The steps are listed below:
1. Go to the File Manager and right-click on the This PC option, as shown below:
( OR )
we will learn in easy steps, how to set up the Arduino IDE on our computer and prepare the
board to receive the program via USB cable.
Step 1 − First you must have your Arduino board (you can choose your favorite board) and a
USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560,
or Diecimila, you will need a standard USB cable (A plug to B plug), the kind you would
connect to a USB printer as shown in the following image.
Page | 23
In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the
following image.
You can get different versions of Arduino IDE from the Download page on the Arduino
Official website. You must select your software, which is compatible with your operating
system (Windows, IOS, or Linux). After your file download is complete, unzip the file.
Page | 24
Step 3 − Power up your board.
The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from
either, the USB connection to the computer or an external power supply. If you are using an
Arduino Diecimila, you have to make sure that the board is configured to draw power from the
USB connection. The power source is selected with a jumper, a small piece of plastic that fits
onto two of the three pins between the USB and power jacks. Check that it is on the two pins
closest to the USB port.
Connect the Arduino board to your computer using the USB cable. The green power LED
(labeled PWR) should glow.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the
folder, you can find the application icon with an infinity label (application.exe). Double-click
the icon to start the IDE.
Page | 25
To open an existing project example, select File → Example → Basics → Blink.
Here, we are selecting just one of the examples with the name Blink. It turns the LED on and
off with some time delay. You can select any other example from the list.
To avoid any error while uploading your program to the board, you must select the correct
Arduino board name, which matches with the board connected to your computer.
Page | 26
Go to Tools → Board and select your board.
Here, we have selected Arduino Uno board according to our tutorial, but you must select the
name matching the board that you are using.
Select the serial device of the Arduino board. Go to Tools → Serial Port menu. This is likely
to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To
find out, you can disconnect your Arduino board and re-open the menu, the entry that
disappears should be of the Arduino board. Reconnect the board and select that serial port.
Page | 27
Step 8 − Upload the program to your board.
Before explaining how we can upload our program to the board, we must demonstrate the
function of each symbol appearing in the Arduino IDE toolbar.
F − Serial monitor used to receive serial data from the board and send the serial data to the
board.
Now, simply click the "Upload" button in the environment. Wait a few seconds; you will 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 Arduino Mini, NG, or other board, you need to press the reset button
physically on the board, immediately before clicking the upload button on the Arduino
Software.
SIMPLE PROGRAM:
Structure
Arduino programs can be divided in three main parts: Structure, Values (variables and
constants), and Functions. In this tutorial, we will learn about the Arduino software program,
step by step, and how we can write the program without any syntax or compilation error.
Let us start with the Structure. Software structure consist of two main functions −
Setup( ) function
Page | 28
Loop( ) function
Void setup ( ) {
}
PURPOSE − The setup() function is called when a sketch starts. Use it to initialize the
variables, pin modes, start using libraries, etc. The setup function will only run once,
after each power up or reset of the Arduino board.
Void Loop ( ) {
}
PURPOSE − After creating a setup() function, which initializes and sets the initial
values, the loop() function does precisely what its name suggests, and loops
consecutively, allowing your program to change and respond. Use it to actively control
the Arduino board.
Example:
To control the joystick sensors using Arduino Uno board.
Page | 29
III
ECE
Components required:
Hardware Procedure:
SoftwareProcedure:
1. Click on ArduinoIDE
2. Click on file
3. Click on New
5. Click on Save
6. Click on Verify
Program:
B
int xpin = A0;
Int ypin = A1;
int swpin = 2;
void setup()
{
Serial.begin(9600);
pinMode(A0,INPUT);
pinMode(A1,INPUT);
pinMode(2,INPUT);
}
void loop()
{
int xdata = analogRead(A0);
int ydata = analogRead(A1);
int swdata = digitalRead(2);
Serial.print("xdata:");
Serial.println(xdata);
Serial.print("\t");
Serial.print("ydata:");
Serial.println(ydata);
delay(1000);
}
RESULT:
Thus the Introduction to arduino platform and Joystick sensor output by using Arduino Uno software.
EXP NO: 6
DATE :
B
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
An important short-range IoT communications Protocols / Technology. Bluetooth, which has
become very important in computing and many consumer product markets. It is expected to be
key for wearable products in particular, again connecting to the IoT albeit probably via a
smartphone in many cases.
The new Bluetooth Low-Energy (BLE) – or Bluetooth Smart, as it is now branded – is a
significant protocol for IoT applications. Importantly, while it offers a similar range to
Bluetooth it has been designed to offer significantly reduced power consumption.
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 works 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.
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.
Program:
void setup()
{
Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission
pinMode(13, OUTPUT); //Sets digital pin 13 as output pin
}
void loop()
{
if(Serial.available() > 0) // Send data only when you receive data:
{
data = Serial.read(); //Read the incoming data and store it into variable data
Serial.print(data); //Print Value inside data in Serial monitor
Serial.print("\n"); //New line
if(data == '1') //Checks whether value of data is equal to 1
digitalWrite(13, HIGH); //If value is 1 then LED turns ON
else if(data == '0') //Checks whether value of data is equal to 0
VELAMMALINSTITUTE OFTECHNOLOGY,DEPT OFE.C.E Page 2
III
ECE
RESULT:
Thus the different communication methods with IOT devices(Zigbee, Gsm, Bluetooth) was studied successfully.
VELAMMALINSTITUTE OFTECHNOLOGY,DEPT OFE.C.E Page 2
III
ECE
EXP NO: 7
DATE :
Raspberry Pi - Introduction
Raspberry Pi, developed by Raspberry Pi Foundation in association with Broadcom, is a
series of small single-board computers and perhaps the most inspiring computer available
today.
From the moment you see the shiny green circuit board of Raspberry Pi, it invites you to
tinker with it, play with it, start programming, and create your own software with it. Earlier,
the Raspberry Pi was used to teach basic computer science in schools but later, because of its
low cost and open design, the model became far more popular than anticipated.
It is widely used to make gaming devices, fitness gadgets, weather stations, and much more.
But apart from that, it is used by thousands of people of all ages who want to take their first
step in computer science.
It is one of the best-selling British computers and most of the boards are made in the Sony
factory in Pencoed, Wales.
Generations and Models
In 2012, the company launched the Raspberry Pi and the current generations of regular
Raspberry Pi boards are Zero, 1, 2, 3, and 4.
Generation 1 Raspberry Pi had the following four options −
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.
Speed Specifications
The table below gives the speed specifications of various Raspberry Pi models and
generations focusing on the version‟s release date, form factor and dimensions −
Raspberry
Pi 4 Model 46 40 Pin 1.5 GHz Quad 1,2,4, or 8 GB
B
Raspberry
Pi 3 Model 50 40 Pin 1.4 GHz Quad 1 GB
B+
Raspberry
Pi 3 Model 40 40 Pin 1.2 GHz Quad 1 GB
B
Raspberry
Pi 3 Model 28 40 Pin 1.4 GHz Quad 512 MB
A+
Wireless MB
with
Headers
B
Raspberry
40 Pin 512
Pi Zero 10 1 GHz Single
Unpopulated MB
Wireless
Raspberry
Pi 2 Model 42 40 Pin 1.2 1 GB
Quad
B GHz
Raspberry
700 512
Pi 1 Model 42 40 Pin Single
MHz MB
B+
Raspberry
21 Pin (26 700 512
Pi 1 Model 38 Single
Pin Header) MHz MB
B
Raspberry
700 512
Pi 1 Model 23 40 Pin Single
MHz MB
A+
Raspberry
21 Pin (26 700 256
Pi 1 Model 30 Single
Pin Header) MHz MB
A
Connectivity Specifications
The table below gives the connectivity specifications of various Raspberry Pi boards focusing on
the version‟s full sized USB ports, other USB and charge methods, power and High-Definition
Multimedia Interface (HDMI) ports –
Raspberry Pi Full sized USB Other USB & Power HDMI Ports
Version Ports Charge Methods
The table below gives the connectivity specifications of various Raspberry Pi boards
focusing on the version‟s video out quality, video in, Ethernet, bluetooth, Wi-Fi and
external storage –
B
Raspberry 4kp60 CSI Camera Gigabit Bluetooth 5.0 Dual Band- MicroSD
Pi 4 Connector Ethernet 2.4 GHz and
Model B 5GHz
Raspberry 1080p60 CSI Camera 10/100 Bluetooth 4.1 2.4 GHz MicroSD
Pi 3 Connector Mbit/s
Model B
Page | 37
III
ECE
largest:
l=[2,5,9,8]
max=l[o]
for i in range(len(l));
if l[i]>max;
max=l[i]
print(max)
smallest:
l=[2,5,9,8]
min=l[o]
for i in range(len(l));
if l[i]<min;
min=l[i]
print(min)
RESULT:
Thus the introduction to raspberry pi platform and python programming was studied successfully.
Page | 38
III
INTERFACING SENSORS WITH RASPBERRY PI
ECE
EXP NO: 8
DATE :
The Raspberry Pi IR Sensor Interface can be converted into a Proximity Detector, where the
application will detect if the object is too close to the sensor.
Circuit Diagram
The following image shows the connection diagram of Interfacing IR Sensor with Raspberry Pi.
You have already seen the circuit diagram of the IR Sensor Module.
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.
Page | 39
III
ECE
In order 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.
B
Code
The following is the code for interfacing IR Sensor with Raspberry Pi. It is written in Python.
sensor = 16
buzzer = 18
GPIO.setmode(GPIO.BOARD)
GPIO.setup(sensor,GPIO.IN)
GPIO.setup(buzzer,GPIO.OUT)
GPIO.output(buzzer,False)
print "IR Sensor Ready.... "
print " "
try:
while True:
if GPIO.input(sensor):
GPIO.output(buzzer,True)
print "Object Detected"
while GPIO.input(sensor):
time.sleep(0.2)
else:
GPIO.output(buzzer,False)
except KeyboardInterrupt:
GPIO.cleanup()
Working
We have learned how to interface an IR Sensor with Raspberry Pi. I‟ll now explain the working
of the project.
All the magic happens in the IR Sensor Module. As it is a Reflective type IR Sensor, whenever
an object is placed in front of the sensor, the Infrared light from the IR LED gets reflected back
after hitting the object and falls on the Photo Diode.
The photo diode then starts conducting. As a result, the voltage at the non-inverting input of the
LM358 will be greater than that at the inverting input.
Page | 40
III
ECE
Since the LM358 is acting as a Comparator, its output will become HIGH and the on-board
LED glows. The HIGH on the Data Pin is detected by the Raspberry Pi and it activates the
buzzer.
B
Using the 10 KΩ Potentiometer, you can adjust how far the object can be placed in front of the
sensor in order to detect.
Applications
As mentioned in the earlier sections, Proximity Sensor or Obstacle Detection is the main
application of interfacing IR Sensor with Raspberry Pi. Some of the common applications
include:
Contactless Tachometer
Line Follower Robot
Obstacle Avoiding Robot
Car Reverse Sensor
Mobile Proximity Sensor
RESULT:
Page | 41
III
COMMUNICATE BETWEEN ARDUINO AND RASPBERRY
ECEPI USING ANY
WIRELESS MEDIUM
EXP NO: 9
DATE : B
1. Summary:
The process of how to communicate an Arduino and a Raspberry Pi with nRF24L01 module.
To Start off We will be learning Some basics of Raspberry Pi then we will have a look at
Headless Raspberry Pi setup. For the Implementation firstly, we will understand the simple
communication of Arduino to Arduino then we will learn Arduino to the raspberry pi.
2. Required Components:
Ultrasonic Sensor
2 Arduino Uno
Raspberry Pi 3
2 nRF24l01 transmitter and receiver
Jump wires
Arduino cable
MINI USB 2.0 for Pi
Breadboard
3. Required Software:
Raspbian for pi
Arduino IDE or Visual Studio
Putty on a remote computer for SSH
VNC viewer on a remote computer
4. Introduction to Raspberry Pi 3:
Page | 42
III
ECE
Page | 43
III
ECE
Page | 44
III
ECE
4) Configure Wi-Fi:
It‟s easier to make two devices talk to each other if they are in the same network. An
ethernet cable can easily make your laptop‟s network available to the Pi. But we don‟t
have one. So, we are going to add a file to the SD card so that the Pi boots with a wifi
pre-configured.
The SD card mounts as two volumes boot and rootfs . Open the boot volume and create
a file named wpa_supplicant.conf on booting the RPi, this file will be copied to
/etc/wpa_supplicant directory in /rootfs partition. The copied file tells the Pi the WIFI
setup information. This would overwrite any existing WIFI configuration, so if you had
already configured WIFI on the pi, then that will be overwritten.
A typical wpa_supplicant.conf file is as follows:
ctrl_interface=DIR=/var/run/wpa_supplicant
GROUP=netdevupdate_config=1country=US
network={ ssid="«your_SSID»" psk="«your_PSK»" key_mgmt=WPA-PSK}
NOTE: Your SSID is your WIFI‟s name. And psk is the password of the WI-FI.
5) Enable SSH
We will later access the Pi using a secured shell (SSH), SSH is disabled by default in
Raspbian. To enable SSH, create a file named ssh in the boot partition. If you are on
Linux, use the touch command to do that.
Page | 45
III
ECE
Page | 46
III
ECE
8) Access Pi remotely:
Sometimes it doesn‟t feel right if we can‟t use the mouse. For that, we need to look into
the Raspbian desktop.
We need to setup VNC (Virtual Network Connection) to see and control Pi graphically.
Let‟s do that.
To access the remote desktop, you need VNC-viewer (client) for your laptop.
Fortunately, RealVNC is available for a lot of OSes, pick one for your OS
from https://www.realvnc.com/en/connect/download/viewer/
9) Commands for vncserver:
Page | 47
III
ECE
Page | 48
III
ECE
Schematic Diagram for wiring of Arduino Uno with ultrasonic sensor and NRF24L01
To wire your NRF24L01+ wireless sender to your Arduino, connect the following pins:
Connect the VCC pin to 3.3 Volts
Connect the GND pin to ground (GND)
Page | 49
III
ECE
Page | 50
III
ECE
5.2. Code:
Sender Side code:
Receiver Side code:
Sending the Data
Page | 51
III
ECE
Page | 52
III
ECE
Further are the steps to which involve the installation of the Library. It took me almost
one week to install it as no clear idea about it is present.
=> Way to go:
1. Login to Raspberry Pi using Putty. B
2. Go to the VNC server for GUI.
3. In the terminal type:
sudo raspi-config
Page | 54
III
ECE
Page | 55
III
ECE
Schematic Diagram for wiring of Arduino Uno with ultrasonic sensor and NRF24L01
To wire your NRF24L01+ Wireless Receiver to your Raspberry Pi, connect the
following pins:
Connect the VCC pin to 3.3 Volts (Pin 1)
Connect the GND pin to ground (GND) (Pin 6)
Connect the CE pin to Raspberry GPIO 22
Connect the CSN pin to Raspberry GPIO 8
Connect the SCK pin to Raspberry GPIO 11
Connect the MOSI pin to Raspberry GPIO 10
Connect the MISO pin to Raspberry GPIO 09
Schematic Diagram:
Page | 56
III
ECE
Page | 57
III
ECE
RESULT:
Thus the communicate between arduino and Raspberry Pi Using Any Wireless Medium was
successfully studied.
Page | 58
III
SETUP A CLOUD PLATFORM TO LOG THE DATA
ECE
EXP NO: 10
DATE :
B
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 begin 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.
Page | 59
III
ECE
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.
Page | 60
III
ECE
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‟s 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.
Page | 61
III
ECE
Creating variables.
6. Connecting to a Network
B
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!
Now that we have configured variables, devices and network settings, we can get to
programming our devices!
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 this 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.
Page | 62
III
ECE
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()
Page | 63
III
ECE
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. B
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!
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.
Page | 64
III
ECE
Navigating to dashboards.
B
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.
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.
Page | 65
III
ECE
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:
Thus the setup a cloud platform to log the data was studied successfully
Page | 66
III
LOG DATA USING RASPBERRY PI AND UPLOAD TO THE CLOUD PLATFORM
ECE
EXP NO: 11
DATE :
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
Page | 67
III
ECE
Click on signup if you don‟t have account and if you already have account click on sign in.
After clicking on signup fill your details. B
After clicking on “New Channel”, enter the Name and Description of the data you want to
upload on this channel. For example I am sending my CPU data (temperature), so I named it as
CPU data.
Page | 68
III
ECE
Now enter the name of your data (like Temperature or pressure) in Field1. If you want to use
more than one Field you can check the box next to Field option and enter the name and
description of your data.
After this click on save channel button to save your details. B
Now copy your “Write API Key”. We will use this API key in our code.
python /path/filename.py
Page | 69
III
ECE
Case 1: If you are using monitor screen then just use the given code.
Now install all libraries:
If there are any errors uploading the data, you will receive “connection failed” message.
Case 2: If you are using “Putty” then you should follow these commands:
First update your pi using:
Page | 70
III
ECE
nano cpu.py
B
After creating this file copy your code to this file and save it using CTRL + X and then „y‟ and
Enter.
After this install all libraries using:
python cpu.py
If the code runs properly you will see some CPU temperature values as shown in above image.
Page | 71
III
ECE
Like this you can send any sensor data connected with Raspberry pi to the ThingSpeak Cloud.
In next article we will connect LM35 temperature sensor with Raspberry Pi and send the
temperature data to ThingSpeak, which can be monitored from anywhere.
Complete Python code for this Raspberry Pi Cloud Server is given below. Code is easy and
self-explanatory to understand.
Code
import httplib
import urllib
import time
def thermometer():
while True:
Page | 72
III
ECE
conn = httplib.HTTPConnection("api.thingspeak.com:80")
try:
response = conn.getresponse()
print temp
data = response.read()
conn.close()
except:
break
while True:
thermometer()
RESULT:
Thus the Log Data Using Raspberry Pi and Upload to The Cloud Platform was studied
successfully
Page | 73
III
DESIGN AN IOT BASED SYSTEM ECE
EXP NO: 12
DATE :
Page | 75
III
ECE
Oracle IoT
In case you work with the mass market, an additional step here is building a fast and user-
friendly application. The application development lifecycle consists of designing and
prototyping, programming, testing, and releasing the application. B
9 Best Internet of Things Design Principles
The location of gateways should be as close to the IoT fleet as possible. It‟s necessary to
provide a lower latency in their communication.
#6 Principle: The system should be easily scalable
The future growth of the IoT system directly depends on its opportunities to scale efficiently
and stay robust when the volume of data and the number of devices increase.
#7 Principle: Build trust in your system
Since the Internet of Things often deals with sensitive information, you need to build trust in
your system to acquire more users. Trust should become one of the core values.
#8 Principle: Deploy only working products
Once the connected devices are deployed, their replacement with a newer version will be an
almost impossible task to accomplish because of high costs. That means that one single error in
the fleet which is detected after the fleet deployment can lead to large financial losses. Due to
that, it‟s good to avoid untested hardware iterations and deploy only working products.
Building a great IoT design is not an easy task. However, we managed to find 3 breathtaking
examples that managed to follow our principles above.
Whistle – Better tech for better care
Whistle is an application that connects to the IoT device on a pet through the cellular network.
Its goal is to take care of the pets by providing precise data to their owners. The IoT device
monitors key behaviors like scratching, drinking, sleep, licking, and other activities. Then it
analyzes them and assigns a score to the pet‟s health. The scoring system leverages machine
Page | 77
III
ECE
learning methods and health stories from 100 000 + dogs to evaluate a pet‟s behavior and track
its wellness.
Keymitt – Smart locks for your doors
Keymitt offers smart door locks with voice assistance. The KeymittB application is very
convenient and user-friendly, and it is compatible with Android and iOS smartphones. This IoT
solution is much safer than ordinary door locks because it ensures privacy and secure access
thanks to real-time notifications of the owner. Moreover, smart locks have one great advantage
compared to traditional locks – your application is responsible for lock control, there is no need
to hold keys.
Curve – The smart GPS tracker
Curve is a smart GPS tracker that can be attached to almost anything. You can track your keys,
pets, or your favorite bag. Curve uses 4 different tracking technologies; GPS, Wi-Fi, Cellular
and Bluetooth so even if you‟re at home or outside, you‟ll have a reliable connection to
whatever you‟re trying to find.
August Smart Lock Pro – Key-free access to your home
The August Smart Lock Pro is a smart lock that allows users to remotely control their door
locks using their smartphones. It integrates with popular smart home platforms like Alexa and
Google Assistant, allowing users to lock and unlock their doors with voice commands. The
smart lock also includes a range of security features, such as two-factor authentication and
activity alerts, to ensure that the user‟s home is secure. The lock also allows users to provide
temporary access to guests or service providers through the August app, making it easy to grant
and revoke access as needed.
RESULT:
Page | 78