CS3691 Embedded Lab Manual
CS3691 Embedded Lab Manual
LAB MANUAL
1
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.
2
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.
3
5. Set the Target options using-> Project – Options for Target opens then Target –
Target configuration dialog. Set the Xtal (Crystal frequency) frequency
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).
4
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. 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.
5
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 :
6
RESULT :
Thus program for performing addition operations using 8051microcontroller using keil simulator is successfully
completed.
7
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
8
Be.fore Execution:
After Execution:
Result:
Thus the program for data transfer is verified and executed successfully.
9
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
10
RESULT :
Thus , the program for addition operation is verified and executed successfully
11
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
12
RESULT :
Thus , the program for subtraction operation is verified and executed successfully
13
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
14
RESULT :
Thus , the program for multiplication operation is verified and executed successfully
15
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
16
RESULT :
Thus , the program for division operation is verified and executed successfully
17
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
18
RESULT :
Thus , the program for AND operation is verified and executed successfully
19
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
20
RESULT :
21
Ex no: ARITHMETIC OPERATIONS USING EMBEDDED C
Date:
AIM:
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;
}
22
RESULT :
Thus , the program for addition operation using embedded c is verified and executed successfully
23
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;
}
24
RESULT :
Thus , the program for subtraction operation using embedded c is verified and executed successfully
25
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;
}
26
RESULT :
Thus , the program for division operation using embedded c is verified and executed successfully
27
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;
}
28
RESULT :
Thus , the program for multiplication operation using embedded c is verified and executed successfully
29
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
30
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.
31
Open the sketch
32
Select the Board
• Mac:
You can indifferently choose between
33
/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
34
EX NO: EXPLORE DIFFERENT COMMUNICATION METHODS WITH IOT DEVICES
(ZIGBEE, GSM,BLUETOOTH)
DATE :
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.
35
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, roboticssystems,
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
36
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.
37
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
38
to Raspberry Pi.
o Click on the link for the Raspberry Pi Imager that matches your operating system
39
o When the download finishes, click it to launch the installer
40
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.
41
42
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
43
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.
44
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.
45
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.
46
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.
47
Click Next to start the setup.
Set your Country, Language, and Timezone, then click Next again.
48
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.
49
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
50
menu: click on it to find lots of applications.
o Click on Accessories, and then click on Text Editor.
51
o Click on File, then choose Save, and then click on Desktop and save the file as .
52
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.
53
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.
54
o Click the web browser icon and search for .
55
System
In this tab you can change basic system settings of your Raspberry Pi.
56
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.
57
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.
58
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
59
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)
}
60
Result :
Thus the interfacing LED is successfully completed.
61
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);
}
62
Result :
Thus the wireless communication using Arduino is successfully completed.
63
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
64
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:
65
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:
66
or show your PHP info:
Result :
Thus the setting the cloud platform to logout the data is completed successfully.
67
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 video group, otherwise you will see 'permission denied' errors.
To check that the user has been added to the group correctly, use
Basic usage
68
taken using the webcam, and saved to the filename specified:
fswebcam image.jpg
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 384x288 to 352x288.
Note the small default resolution used, and the presence of a banner showing the
timestamp.
Specify resolution
69
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
70
--- 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:
71
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 RaspberryPicamera
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:
72
#!/bin/bash
DATE=$(date +"%Y-%m-%d_%H%M")
fswebcam -r 1280x720 --no-banner /home/pi/webcam/$DATE.jpg
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 cron to schedule taking a picture at a given interval, such as every
73
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.
74
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,
B11001,
75
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 :
77
CONTENT BEYOND SYLLABUS
Develop the embedded systems application using software and hardware tools.
Development Process
Consists of cycles of editing-testing debugging.
Processor and hardware part once
chosen remains fixed, the application
software codes have to be perfected by
a number of runs and tests.
78
2. Software Tools
79
80