CS3691 - E&IoT Lab Manual
CS3691 - E&IoT Lab Manual
NAME :
REG NO. :
YEAR :
SEMESTER :
BRANCH :
1
JEPPIAAR INSTITUTE OF TECHNOLOGY
SELF BELIEF | SELF DISCIPLINE | SELF RESPECT
KUNNAM, SUNGUVARCHATRAM, SRIPERUMBUDUR, CHENNAI - 631 604.
BONAFIDE CERTIFICATE
Date
2
VISION OF THE INSTITUTION
Jeppiaar Institute of Technology aspires to provide technical education in futuristic technologies with
the perspective of innovative, industrial, and social applications for the betterment of humanity.
• To produce competent and disciplined high-quality professionals with the practical skills necessary to
excel as innovative professionals and entrepreneurs for the benefit of society.
• To improve the quality of education through excellence in teaching and learning, research, leadership,
and by promoting the principles of scientific analysis, and creative thinking.
• To provide excellent infrastructure, serene, and stimulating environment that is most conducive to
learning.
• To strive for productive partnership between the Industry and the Institute for research and
development in the emerging fields and creating opportunities for employability.
• To serve the global community by instilling ethics, values, and life skills among the students needed
to enrich their lives.
..
3
VISION OF THE DEPARTMENT
The department will be an excellent centre to impart futuristic and innovative technological education to
facilitate the evolution of problem-solving skills along with knowledge application in the field of Information
Technology, understanding industrial and global requirements and societal needs for the benefit of humanity
M2:Enhance evolution of professional skills and development of leadership traits among the students by
providing favourable infrastructure and environment to grow into successful entrepreneurs.
M3: Training in multidisciplinary skills needed by Industries, higher educational institutions, research
establishments and Entrepreneurship.
Engineering knowledge: Apply the knowledge of mathematics, science, Engineering fundamentals, and
an engineering specialization to the solution of complex engineering problems.
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.
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.
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.
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.
4
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.
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.
Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the
engineering practice.
Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams, and in multidisciplinary settings.
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.
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.
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.
Students are able to analyse, design, implement and test any software with the programming and testing
skills they have acquired.
Students are able to design and develop algorithms for real time problems, scientific and business
applications through analytical, logical and problems solving skills.
Students are able to provide security solution for network components and data storage and management
which will enable them to work efficiently in the industry.
5
LIST OF EXPERIMENTS
6. Explore different communication methods with IOT devices (Zigbee, GSM, Bluetooth)
6
TABLE OF CONTENTS
7
8
INTRODUCTION
Earlier to Microcontrollers, Microprocessors were greatly used for each and every purpose.
Microprocessors were containing ALU, general purpose register, stackpointer, program counter,
clock counter and so many other features which the today’s Microcontroller also possesses. But
the difference between them exists with respect tothe number of instructions, access times, size,
reliability, PCB size and so on. Microprocessor contains large instruction set called as CISC
processor whereas Microcontroller contains less number of instructions and is called as RISC
processor. The access time is less in case of microcontrollers compared to microprocessors and
the PCB size reduces in case of microcontrollers.
There are many versions of microcontrollers 8051, 80528751, AT8951 from Atmel
Corporation and many more. In this manual we will study about the 8051 architecture, its features,
programming and interfacing.
MCS 8051 is an 8-bit single chip microcontroller with many built-in functions and is the
core for all MCS-51 devices.
The main features of the 8051 core are:
Operates with single Power Supply +5V.
8-bit CPU optimized for control applications.
16-bit program counter (PC) and 16-bit data pointer (DPTR).
8-bit program status word (PSW).
8-bit stack pointer (SP).
4K Bytes of On-Chip Program Memory (Internal ROM or EPROM).
128 bytes of On-Chip Data Memory (Internal RAM):
Four Register Banks, each containing 8 registers (R0 to R7) [Total 32 reg]
16-bytes of bit addressable memory.
80 bytes of general-purpose data memory (Scratch Pad Area).
Special Function Registers (SFR) to configure/operate microcontroller.
32 bit bi-directional I/O Lines (4 ports P0 to P3).
Two 16-bit timers/counters (T0 and T1).
Full duplex UART (Universal Asynchronous Receiver/Transmitter).
On-Chip oscillator and clock circuitry.
9
STEPS TO CREATE AND COMPILE Keil µVision-3/4 PROJECT:
4. Create a source file (using File->New), type in the assembly or C program and save this
(filename.asm/filename.c) and add this source file to the project using either one of the
following two methods. (i) Project->Manage->Components,
Environment Books->addfiles-> browse to the required file -> OK
“OR” ii) right click on the Source Group in the Project Window and the Add Files to
Group option.
5. Set the Target options using -> Project – Options for Target opens theµ
Options for Target – Target configuration dialog. Set the Xtal(Crystal frequency) frequency
10
as 11.0592 MHz, and also the Options for Target
– Debug – use either Simulator / Keil Monitor- 51 driver.
6. If Keil Monitor- 51 driver is used click on Settings -> COM Port settings select the COM
Port to which the board is connected and select the baud rate as 19200 or 9600 (recommended).
Enable Serial Interrupt option if the user application is not using on-chip UART, to stop
program execution.
7. Build the project; using Project -> Build Project.
application and links. Any errors in the code are indicated by – “Target not created” in the
Build window, along with the error line. Debug the errors. After anerror free, to build go to
Debug mode.
8. Now user can enter into Debug mode with Debug- Start / Stop Debug session
Also the (reset, run, halt) icons can be used. Additional icons are
(step, step over, and step into, run till cursor).
10. If it is an interface program the outputs can be seen on the LCD, CRO, motor, led
status, etc. If it is a part-A program, the appropriate memory window is opened using View -
> memory window (for data RAM & XRAM locations), Watch window (for timer program),
serial window, etc.
11
11. Note: To access data RAM area type address as D: 0020h. Similarly to access the DPTR
region (XRAM-present on chip in AT89C51ED2) say 9000h location type in X: 09000H.
12
Ex no: ARITHMETIC OPERATIONS USING SIMULATOR
Date:
AIM:
To write a program for performing addition operations using 8051microcontroller using keil simulator.
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
PROGRAM :
13
RESULT :
Thus program for performing addition operations using 8051microcontroller using keil simulator is successfully
completed.
14
Ex no: DATA TRANSFER BETWEEN REGISTERS AND MEMORY
Date:
AIM:
To Write an assembly language program to transfer the data from one location to another
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
Org 000h
Mov r0, #30h
Mov r1, #50h
Mov r3, #05h
BACK : mov a , @r0
Mov @r1 , a
Inc r0inc r1
Djnz r3, BACK
end
15
Be.fore Execution:
After Execution:
Result:
Thus the program for data transfer is verified and executed successfully.
16
ARITHMETIC OPERATIONS
Ex no:
Date:
AIM:
To Write an assembly language program to perform addition operation
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
INSTRUCTIONS COMMANDS
17
RESULT :
Thus , the program for addition operation is verified and executed successfully
18
ARITHMETIC OPERATIONS
Ex no:
Date:
AIM:
To Write an assembly language program to perform subtraction operation
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
INSTRUCTIONS COMMANDS
19
RESULT :
Thus , the program for subtraction operation is verified and executed successfully
20
ARITHMETIC OPERATIONS
Ex no:
Date:
AIM:
To Write an assembly language program to perform multiplication operation
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
INSTRUCTIONS COMMANDS
21
RESULT :
Thus , the program for multiplication operation is verified and executed successfully
22
ARITHMETIC OPERATIONS
Ex no:
Date:
AIM:
To Write an assembly language program to perform division operation
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
INSTRUCTIONS COMMANDS
23
RESULT :
Thus , the program for division operation is verified and executed successfully
24
LOGICAL OPERATIONS
Ex no:
Date:
AIM:
To Write an assembly language program to perform AND logical operation
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
INSTRUCTIONS COMMANDS
25
RESULT :
Thus , the program for AND operation is verified and executed successfully
26
LOGICAL OPERATIONS
Ex no:
Date:
AIM:
To Write an assembly language program to perform OR logical operation
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
INSTRUCTIONS COMMANDS
27
RESULT :
28
ARITHMETIC OPERATIONS USING EMBEDDED C
Ex no:
Date:
AIM:
To Write an assembly language program to perform addition operation using embedded c.
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
#include <reg51.h>
Void main (void)
{
Unsigned char x,y,z;
X=0x34;
Y=0x99;
P1 = 0x00;
Z=x+y;
P1 = z;
}
29
RESULT :
Thus , the program for addition operation using embedded c is verified and executed successfully
30
SUBTRACTION
Ex no:
Date:
AIM:
To Write an assembly language program to perform subtraction operation using embedded c.
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
#include <reg51.h>
Void main (void)
{
Unsigned char x,y,z;
X=0x34;
Y=0x99;
P1 = 0x00;
Z=x - y;
P1 = z;
}
31
RESULT :
Thus , the program for subtraction operation using embedded c is verified and executed successfully
32
DIVISION
Ex no:
Date:
AIM:
To Write an assembly language program to perform division operation using embedded c.
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
#include <reg51.h>
Void main (void)
{
Unsigned char x,y,z;
X=0x34;
Y=0x99;
P1 = 0x00;
Z=x/y;
P1 = z;
}
33
RESULT :
Thus , the program for division operation using embedded c is verified and executed successfully
34
MULTIPLICATION
Ex no:
Date:
AIM:
To Write an assembly language program to perform multiplication operation using embedded c.
APPARATUSREQUIRED:
1. Computer
2. Keil microvision software 3/4
ALGORITHM:
1. Open – keil microvision 5 – new microvision project – once open the project ,dialog box will
be open – set the microcontroller AT89C51 and click ok – it ask whether STARTUP is ok –
click yes – on a project window – target will be generated.
2. Once target is generated – goto new – file – design a name for it with extension .asm and
click ok - right click on target – source group – right click –add existing files – ask file name
– choose file name . asm – ok.
3. Do the program for data transfer in a work place. Once program is done – click save
4. GOTO – project – build target – on command window – error is acknowledged program is
successfully compiler.
PROGRAM :
#include <reg51.h>
Void main (void)
{
Unsigned char x,y,z;
X=0x34;
Y=0x99;
P1 = 0x00;
Z=x*y;
P1 = z;
}
35
RESULT :
Thus , the program for multiplication operation using embedded c is verified and executed successfully
36
Ex No: THE ARDUINO PROGRAMMINGENVIRONMENT (IDE)
Date :
The Arduino Integrated Development Environment - or ArduinoSoftware (IDE) - contains a text editor
for writing code, a message area, a text console, a toolbar with buttons for common functions and a
series of menus. It connects to the Arduino hardware to upload programs and communicate with them.
Software-Installation
• Windows
arduino.cc/windows
Installation for: Windows 7, Vista, e XP
• Mac OS X
37
arduino.cc/mac
Installation for: OS X 10.7 or newer
• Linux
arduino.cc/linux
CommunicationwithArduino
Launch the Arduino IDE (double clic
ArduinoProgramDevelopment
• void setup( )
• void loop( )
• setup( ) runs first and once.
• loop( ) runs over and over, until power is lost or a newsketch is loaded.
38
Open the sketch
39
Select the Board
• Mac:
You can indifferently choose between
40
/dev/tty.usbmodemXXXXX or /dev/cu.usbmodemXXXXX
• Windows:
• There are one or more COM ports:
• choose the one with the higher number if it does not work try with theother proposals
• The connection to the serial port is reported inthe code window in bottom right
41
EX NO:
DATE :
EXPLORE DIFFERENT COMMUNICATION METHODS WITH IOT DEVICES (ZIGBEE, GSM,
BLUETOOTH)
Wi-Fi
Wi-Fi (Wireless Fidelity) is the most popular IOT communication protocols for wireless local
area network (WLAN) that utilizes the IEEE 802.11 standard through 2.4 GHz UHF and 5 GHz
ISM frequencies. Wi-Fi provides Internet access to devices that are within the range of about 20 -
40 meters from the source. It has a data rate upto 600 Mbps maximum, depending on channel
frequency used and the number of antennas. In embedded systems, ESP series controllers from
Espressif are popular for building IoT based Applications. ESP32 and ESP8266 are the most
commonly use wifi modules for embedded applications. You can find various projects based
on ESP32 and ESP8266 by following the link.
In terms of using the Wi-Fi protocol for IOT, there are some pros & cons to be considered. The
infrastructure or device cost for Wi-Fi is low & deployment is easy but the power consumption
is high and the Wi-Fi range is quite moderate. So, the Wi-Fi may not be the best choice for all
types of IOT applications but it can be used for applications like Home Automation.
There are many development boards available that allow people to build IOT applications using
Wi-Fi. The most popular ones are the Raspberry Pi and Node MCU. These boards allow people
to build IOT prototypes and also can be used for small real-time applications. Likewise is the
Marvell Avastar 88W8997 SoC, which follows the Wi-Fi’s IEEE 802.11n standard. The chip
has applications like wearables, wireless audio & smart home.
42
Bluetooth
Bluetooth is a technology used for exchanging data wirelessly over short distances and
preffered over vaouros IOT network protocols. It uses short-wavelength UHF radio waves of
frequency ranging from 2.4 to 2.485 GHz in the ISM band. The Bluetooth technology has 3
different versions based on its applications:
Bluetooth: The Bluetooth that is used in devices for communication has many
applications in IOT/M2M devices nowadays. It is a technology using which two devices can
communicate and share data wirelessly. It operates at 2.4GHz ISM band and the data is split
in packets before sending and then is shared using any one of the designated 79 channels
operating at 1 MHz of bandwidth.
BLE (Bluetooth 4.0, Bluetooth Low Energy): The BLE has a single main
difference from Bluetooth that it consumes low power. With that, it makes the product
of low cost & more long-lasting than Bluetooth.
iBeacon: It is a simplified communication technique used by Apple and is completely
based on Bluetooth technology. The Bluetooth 4.0 transmits an ID called UUID for each
user and makes it each to communicate between iPhone users.
Bluetooth has many applications, such as in telephones, tablets, media players, robotics
systems, etc. The range of Bluetooth technology is between 50 – 150 meters and the data is
being shared at a maximum data rate of 1 Mbps.
After launching the BLE protocol, there have been many new applications developed using
Bluetooth in the field of IOT. They fall under the category of low-cost consumer products and
Smart-Building applications. Like Wi-Fi, Bluetooth also has a module Bluetooth HC-05 that
can be interfaced with development boards like Arduino or Raspberry Pi to build DIY
projects. When it comes to Real-time applications, Marvell’s Avastar 88W8977 comes with
43
Bluetooth v4.2 and has features like high speed, mesh networking for IOT. Another product,
M5600 is a wireless pressure transducer with a Bluetooth v4.0 embedded in it.
Zigbee
ZigBee is another iot wireless protocols has features similar to the the Bluetooth technology.
But it follows the IEEE 802.15.4 standard and is a high-level communication protocol. It has
some advantages similar to Bluetooth i.e. low-power consumption, robustness, high security,
and high scalability.
Zigbee offers a range of about 10 – 100 meters maximum and data rate to transfer data between
communicated devices is around 250 Kbps. It has a large number of applications in technologies
like M2M & IOT.
Having limitations in regards to data rate, range, and power consumption, Zigbee is only appropriate for Small-
Scale Wireless applications. Though having some limitations, it provides a 128-bit AES encryption and is giving
a big hand in making secure communication for Home automation & small Industrial applications. Zigbee
too has its DIY module named XBee & XBee Pro which can be interfaced with Arduino or Raspberry Pi boards to
make simple projects or application prototypes.
The company Develco has made products using Zigbee technologies like Sensors, gateways, meter interfaces, smart
plugs, smart relays, etc which all work on the Zigbee wireless Mesh network, consuming low power and free from
external interferences. Another company, Datanet has Zigbee based products which are used in real-time
applications already, like the DNL910 & DNL920.
44
Ex no: INTRODUCTION TO RASPBERRY PI PLATFORM AND PYTHON PROGRAMMING
Date :
Raspberry Pi
You are going to take a first look at Raspberry Pi! You should have a Raspberry Pi computerin
front of you for this. The computer shouldn’t be connected to anything yet.
o Look at your Raspberry Pi. Can you find all the things labelled on the diagram?
USB ports — these are used to connect a mouse and keyboard. You can also connect
other components, such as a USB drive.
SD card slot — you can slot the SD card in here. This is where the operating system
software and your files are stored.
Ethernet port — this is used to connect Raspberry Pi to a network with a cable.
Raspberry Pi can also connect to a network via wireless LAN.
Audio jack — you can connect headphones or speakers here.
HDMI port — this is where you connect the monitor (or projector) that you are usingto
display the output from the Raspberry Pi. If your monitor has speakers, you can alsouse
them to hear sound.
Micro USB power connector — this is where you connect a power supply. You should
always do this last, after you have connected all your other components.
GPIO ports — these allow you to connect electronic components such as LEDs and buttons
45
to Raspberry Pi.
o Click on the link for the Raspberry Pi Imager that matches your operating system
46
o When the download finishes, click it to launch the installer
47
If this pops up, click on More info and then Run anyway
Follow the instructions to install and run the Raspberry Pi Imager
Insert your SD card into the computer or laptop SD card slot
In the Raspberry Pi Imager, select the OS that you want to install and the SD card you
would like to install it on
Note: You will need to be connected to the internet the first time for the the Raspberry Pi Imager
to download the OS that you choose. That OS will then be stored for future offline use. Being
online for later uses means that the Raspberry Pi imager will always give you the latest version.
48
49
Then simply click the WRITE button
Wait for the Raspberry Pi Imager to finish writing
Once you get the following message, you can eject your SD card
50
Note: Many microSD cards come inside a larger adapter — you can slide the smaller card out
using the lip at the bottom.
o Find the USB connector end of your mouse’s cable, and connect the mouse to a USB port
on your Raspberry Pi (it doesn’t matter which port you use).
o Make sure your screen is plugged into a wall socket and switched on.
o Look at the HDMI port(s) on your Raspberry Pi — notice that they have a flat side on top.
51
o Use a cable to connect the screen to the Raspberry Pi’s HDMI port — use an adapter if
necessary.
Raspberry Pi 4
Connect your screen to the first of Raspberry Pi 4’s HDMI ports, labelled HDMI0.
Raspberry Pi 1, 2, 3
Connect your screen to the single HDMI port.
52
Note: nothing will display on the screen, because the Raspberry Pi is not running yet.
o If you want to connect the Pi to the internet via Ethernet, use an Ethernet cable to connect
the Ethernet port on the Raspberry Pi to an Ethernet socket on the wall or on your internet
router. You don’t need to do this if you want to use wireless connectivity, or if you don’t
want to connect to the internet.
o If your screen has speakers, your Raspberry Pi can play sound through these. Or you could
connect headphones or speakers to the audio port.
Your Raspberry Pi doesn’t have a power switch. As soon as you connect it to a power outlet,
it will turn on.
o Plug the power supply into a socket and connect it to your Raspberry Pi’s power port.
53
You should see a red LED light up on the Raspberry Pi, which indicates that Raspberry Pi is
connected to power. As it starts up (this is also called booting), you will see raspberries appear
in the top left-hand corner of your screen.
54
Click Next to start the setup.
Set your Country, Language, and Timezone, then click Next again.
55
o Connect to your WiFi network by selecting its name, entering the password, and
clicking Next.
Note: if your Raspberry Pi model doesn’t have wireless connectivity, you won’t see this
screen.
56
o Click Next let the wizard check for updates to Raspbian and install them (this might take a
little while).
A tour of Raspberry Pi
58
o Click on File, then choose Save, and then click on Desktop and save the file as .
59
o In the window that appears, type:
ls
and then press Enter on the keyboard.
You can now see a list of the files and folders in your directory.
60
Browsing the web
You might want to connect your Raspberry Pi to the internet. If you didn’t plug in an ethernet
cable or connect to a WiFi network during the setup, then you can connect now.
o Click the icon with red crosses in the top right-hand corner of the screen, and select your
network from the drop-down menu. You may need to ask an adult which network you should
choose.
o Type in the password for your wireless network, or ask an adult to type it for you, then
click OK.
o When your Pi is connected to the internet, you will see a wireless LAN symbol instead of
the red crosses.
61
o Click the web browser icon and search for .
System
In this tab you can change basic system settings of your Raspberry Pi.
62
Password — set the password of the pi user (it is a good idea to change the password
from the factory default ‘raspberry’)
Boot — select to show the Desktop or CLI (command line interface) when your
Raspberry Pi starts
Auto Login — enabling this option will make the Raspberry Pi automatically log in
whenever it starts
Network at Boot — selecting this option will cause your Raspberry Pi to wait until a
network connection is available before starting
Splash Screen — choose whether or not to show the splash (startup) screen when your
Raspberry Pi boots
Interfaces
You can link devices and components to your Raspberry Pi using a lot of different types of
connections. The Interfaces tab is where you turn these different connections on or off, so that
your Raspberry Pi recognises that you’ve linked something to it via a particular type of
connection.
63
Camera — enable the Raspberry Pi Camera Module
SSH — allow remote access to your Raspberry Pi from another computer using
SSH
VNC — allow remote access to the Raspberry Pi Desktop from another computer
using VNC
SPI — enable the SPI GPIO pins
I2C — enable the I2C GPIO pins
Serial — enable the Serial (Rx, Tx) GPIO pins
1-Wire — enable the 1-Wire GPIO pin.
Remote GPIO — allow access to your Raspberry Pi’s GPIO pins from another
computer
Performance
If you need to do so for a particular project you want to work on, you can change the
performance settings of your Raspberry Pi in this tab.
Warning: Changing your Raspberry Pi’s performance settings may result in it behaving
erratically or not working.
64
Overclock — change the CPU speed and voltage to increase performance
This tab allows you to change your Raspberry Pi settings to be specific to a country or
location.
Locale — set the language, country, and character set used by your Raspberry Pi
Timezone — set the time zone
Keyboard — change your keyboard layout
WiFi Country — set the WiFi country code
65
Ex no : INTERFACING OF LED
Date :
Aim :
write a program to blink LED using Arduino
Apparatus required :
1. Computer
2. Arduino software
Procedure:
1. Connect the Arduino UNO board to the system make sure all the connections . and install the
Arduino IDE 2.11 in the system
2. Open Arduino IDE 2.11 - tools-board- Arduino UNO
3. Go to file –new program – save – compile –run
4. Now,view the LED blinking in the Arduino UNO board ,it shows LED on for one second and off for
one second
Program :
Void setup ()
{
Pinmode(LED _BUILTIN,OUTPUT);
}
Void loop()
{
Digitalwrite(LED _BUILTIN, HIGH);
Delay(1000)
Digitalwrite(LED _BUILTIN, LOW);
Delay(1000)
}
66
Result :
Thus the interfacing LED is successfully completed.
67
Ex no: WIRELESS COMMUNICATION USING AURDINO
Date :
Aim :
Write a program to using wireless communication medium in Arduino
Apparatus required :
1. Computer
2. Arduino software
Procedure:
1. Connect the Arduino UNO board to the system make sure all the connections . and install the
Arduino IDE 2.11 in the system
2. Open Arduino IDE 2.11 - tools-board- Arduino UNO
3. Go to file –new program – save – compile –run
4. Now, view the wireless medium bluetooth using Arduino board
Program
Void setup()
{
Pinmode(12,OUTPUT);
Serial.begin(9400);
Void loop
{
Char inchar = (char)serial.read();
If (inchar ==’A’)
{
Digitalwrite (12, HIGH);
Serial printin (inchar);
}
elseif(inchar ==’D’)
Digitalwrite (12,LOW);
Serial printin (inchar);
}
68
Result :
Thus the wireless communication using Arduino is successfully completed.
69
Ex no : SETUP A CLOUD PLATFORM TO LOG THE DATA
Date :
Aim:
Building and hosting a simple website(static/dynamic) on the device and make it accessible
online. There is a need to install server(eg: Apache) and thereby host the website.
By default, Apache puts a test HTML file in the web folder. This default web page is served
when you browse to http://localhost/ on the Pi itself, or http://192.168.1.10 (whatever the
70
Pi's IP address is) from another computer on the network. To find the Pi's IP address,
type hostname -I at the command line (or read more about finding your IP address).
Browse to the default web page either on the Pi or from another computer on the network and
you should see the following:
This default web page is just an HTML file on the filesystem. It is located
at /var/www/html/index.html .
Navigate to this directory in a terminal window and have a look at what's inside:
71
cd
/var/www/htmlls
total 12
drwxr-xr-x 2 root root 4096 Jan 8 01:29 .
To allow your Apache server to process PHP files, you'll need to install the latest version of
PHP and the PHP module for Apache. Type the following command to install these:
sudo rm index.html
Now save and refresh your browser. You should see "hello world". This is not dynamic but
still served by PHP. Try something dynamic:
72
or show your PHP info:
Result :
Thus the setting the cloud platform to logout the data is completed successfully.
73
Ex no: LOG DATA USING RASPBERRY PI AND UPLOAD TO THE CLOUD PLATFORM
Date :
Aim :
Interfacing the regular usb webcam with the device and turn it into fully functional IPwebcam & test
the functionality.
Install fswebcam
If you are not using the default pi user account, you need to add your username to
the vide group, otherwise you will see 'permission denied' errors.
o
To check that the user has been added to the group correctly, use
Basic usage
74
taken using the webcam, and saved to the filename specified:
fswebcam image.jpg
Note the small default resolution used, and the presence of a banner showing the
timestamp.
Specify resolution
75
resolution I want the image to be taken at, use the -r flag:
/dev/video0 opened.
Picture now taken at the full resolution of the webcam, with the banner present.
Specify no banner
76
--- Opening /dev/video0...
Trying source module
v4l2...
/dev/video0 opened.
No input was specified, using the first.
You may experience poor quality pictures with a USB webcam, such as thisaccidentally artistic piece:
77
Some webcams are more reliable than others, but this sort of issue may occur with
poor quality webcams. If the problem persists, ensure your system is up to date. Also
try other webcams, but you'll get the best performance from the RaspberryPi camera
module.
Bash script
You can write a Bash script which takes a picture with the webcam. The script
mkdir webcam
To create a script, open up your editor of choice and write the following example
code:
78
#!/bin/bash
DATE=$(date +"%Y-%m-%d_%H%M")
This script will take a picture and name the file with a timestamp. Say we saved it
chmod +x webcam.sh
./webcam.sh
Which would run the commands in the file and give the usual output:
/dev/video0 opened.
Disabling banner.
You can use cro to schedule taking a picture at a given interval, such as every
n
minute to capture a time-lapse.
First open the cron table for editing:
79
crontab -e
This will either ask which editor you would like to use, or open in your default editor. Once
you have the file open in an editor, add the following line to schedule taking a picture every
minute (referring to the Bash script from above):
* * * * * /home/pi/webcam.sh 2>&1
Ensure your script does not save each picture taken with the same filename. This
will overwrite the picture each time.
Result :
Thus the Log Data using Raspberry PI and upload to the cloud platform is completed
successfully.
80
Ex no : DESIGN AN IoT SYSTEMS
Date :
Aim:
Instead of using the conventional dice, generate a random value similar to dice value and display the
same using a 16X2 LCD. A possible extension could be to provide the user with option of selecting
single or double dice game.
#include <LiquidCrystal.h>
long randNumber;
int Led = 13; //define LED port
int Shock = 2; //define shock port
int val;//define digital variable val
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12 );
byte customChar[] = {
B00000,
B00000,
B11111,
81
B11001,
82
B10101,
B10011,
B11111,
B00000
};
void setup()
{
lcd.begin(16, 2);
lcd.createChar(0, customChar);
lcd.home();
pinMode(Led, OUTPUT); //define LED as a output port
randomSeed(analogRead(0));
pinMode(Shock, INPUT); //define shock sensor as a output port
lcd.write(byte( 0));
lcd.print("Digital dice");
lcd.write(byte( 0));
delay(1000);
}
void loop()
{
val = digitalRead(Shock); //read the value of the digital interface 3 assigned to val
if (val == LOW) //when the shock sensor have signal do the following
{
lcd.clear();
lcd.print("Rolling dice...");
delay(4000);
lcd.clear();
lcd.setCursor(0, 0);
randNumber = random(1,7);
lcd.print("Dice 1 = ");
lcd.print(randNumber);
delay(150);
}
Result :
84