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

2019 DEPARTMENT OF

Pattern ELECTRICAL ENGINEERING

Laboratory Manual
Fundamentals of
Microcontroller
& its Application

Lab Manual
Mr. RAJAN PATEL
Asst. Prof.
Electrical Engg. Dept., GCOERC
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Name of Student: - _________________________________________________________Roll No.:___________


Class: S.E. Electrical Academic Year: 2020-21
Subject: Fundamental of Microcontroller & It’s Appln Subject Code: 203149
INDEX
Sr. Page
Name of Experiment Date Sign
No. No
A-1 Study and use of 8051 Microcontroller trainer kit
Assembly Language Program for the arithmetic operation of 8-bit
A-2
numbers
Assembly Language Program for finding the largest number and
A-3 smallest number from a given an array of 8-bit numbers
Assembly Language program to arrange 8-bit numbers stored in an
A-4
array in ascending order and descending order

A-5 The blinking display of LED’s interfaced with 8051

A-6 Interfacing of LCD with 8051

A-7 Interfacing of the relay with 8051

A-8 Stepper motor control by 8051 Microcontroller


Study of GSM Module SIM800/SIM900/QUECTEL M95 and AT
B-1 Commands

B-2 Study of IoT system


Interfacing of GSM with a computer through COM port to Send and
B-3 Receive SMS
Interfacing GSM with 8051 trainer kit and develop a program to
B-4
send AT commands

B-5 Develop a program in C to read and send SMS from the GSM module
Development of mobile app for various applications in electrical
B-6 engineering

CERTIFICATE
This is to certify that Mr. /Miss. / Mrs. _________________________________________________ Examination
Seat Number ____________________ of Second Year Electrical Engineering (Semester- IV) has
satisfactorily completed the Term Work/ Practical/Oral in the subject Fundamental of
Microcontroller & it’s Application (203149) during the academic year 2020-2021.

Mr. R. V. Patel Dr. S. P. Sonar Dr. N. G. Nikam


Subject In-charge Head of the Department Principal

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Institute Vision
An institute striving for excellence in providing Transformative Academic
Education and Stimulating environment for Research to enhance skills for Developing
Intellectuals and to Inculcate quality education with Social and Technical knowledge
which will benefit the Society and Industrial Challenges.
Institute Mission
1) To be a Technical Educational Institute in transforming aspiring engineers
through rigorous course work and technical skills.
2) To benchmark with the best global standards of quality education.
3) To enhance commitment of the faculty, staff and students by inculcating the spirit
of inquiry, team work and professionalism.
4) Establish a Centre of Excellence to enhance academia-industry partnership, work
on collaborative projects, and develop new products, services and patents.
5) To develop globally competent students by enhancing indigenous technologies
and inculcate entrepreneurship in them.

Department of Electrical Engineering


Department Vision
To develop graduates with foundation of electrical engineering who can cater to
dynamic needs of the industry & provide stimulated environment for young minds to
acquire & apply to allocate engineering knowledge.
Department Mission

1) To provide effective & quality education in the field of electrical engineering.


2) To inculcate students with knowledge & experience in the field of specialization to
contribute in the making of professional leader.
3) To materialize partnership with industry by meeting the career changing need of
market for future engineers.
4) To enrich students with the latest development through seminars, guest lecture,
workshop & paper presentations.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

DEPARTMENT OF ELECTRICAL ENGINEERING


PROGRAM EDUCATIONAL OBJECTIVES
PEO1: Graduate will be able to apply technical knowledge & skills in multidisciplinary
environment.
PEO2: Graduate will able to design & develop electrical system.
PEO3: Graduate will be competent to develop career with lifelong learning.

PROGRAM SPECIFIC OBJECTIVE


PSO1: Graduate will able to apply knowledge & skills in the field of renewable energy.
PSO2: Graduate will able to utilize knowledge in the field of automation.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

PROGRAM OUTCOME
PO1 Apply the knowledge of mathematics, science, Electrical Engineering fundamentals to
get the solution for different engineering problems.
PO2 Identify, formulate and analyze different Electrical Engineering problems and reaching
sustained conclusion using the principle of mathematics, natural sciences and
engineering fundamentals.
PO3 Design the solutions for different electrical engineering problems, components or
processes that meet the specified needs with appropriate considerations & social
aspects.
PO4 Use knowledge of Electrical Engineering which includes design of experiments,
analysis and interpretation of data and synthesis of information to provide valid
conclusions.
PO5 Apply appropriate techniques, resources, modern engineering and IT tools including
prediction and modelling to complex engineering activities with understanding of the
limitations.
PO6 Use appropriate knowledge to assess society welfare and consequent responsibility
relevant to professional engineering practices.
PO7 Understand the impact of professional engineering solution in social and
environmental context and demonstrate the knowledge, and need for sustainable
development.
PO8 Apply ethical principles and responsibilities commit to professional engineering
practices for the society
PO9 Function effectively as an individual, a member or leader in diversity and multi-
disciplinary fields.
PO10 Communicate effectively in professional engineering activities with society to
understand and write effective reports, presentations with clear interpretation
Demonstrate and apply knowledge of engineering management skills with
PO11
understanding financial aspects in multi-disciplinary environments.
PO12 Recognize the social needs and prepare it for lifelong learning in the growing
technological change.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Fundamental of Microcontroller & it’s Application


Course Objectives:
 Explain the microcontroller architecture & describe the features of a typical
microcontroller.
 To use the 8051 addressing modes and instruction set and apply this knowledge
to.88
 To define the protocol for serial communication and understand the
microcontroller.
 Explain the interrupt structure of the microcontroller and to develop programs
related to interrupt handling.
 To introduce students to Global System for Mobile Communication (GSM).
 To provide students with interfacing concepts and develop interfacing circuits for
simple devices.
Graduate Attributes (as per NBA)
 Engineering knowledge
 Problem analysis
 Design/development of solutions
 Modern tool usage
 Ethics
Course Outcomes:
E214.1: Describe the architecture and features of various types of the microcontroller
E214.2: Illustrate addressing modes and execute programs in assembly language for the
microcontroller.
E214.3: Write programs in C language for microcontroller 8051.
E214.4: Elaborate interrupt structure of 8051 and program to handle interrupt and ADC809
E214.5: Define the protocol for serial communication and understand the microcontroller
development systems.
E214.6: Interface input output devices and measure electrical parameters with 8051 in real
time.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Instructions to students
 Maintain silence and discipline.
 Students keep their bags in the rack.
 Students must take care of their valuable things.
 Students must bring Observation book, record and manual along with pen, pencil,
and eraser Etc., no borrowing from others.
 Students must handle the trainer kit and other components carefully, as they are
expensive.
 Before entering to lab, must prepare for Viva for which they are going to conduct
experiment.
 Before switch on the trainer kit, must show the connections to one of the faculties
or instructors.
 After the completion of the experiment should return the components to the
respective lab instructors.
 Before leaving the lab, should check whether they have switch off the power
supplies and keep their chairs properly.
Do’s And Don’ts
 Be regular to the Lab Do not come late to the Lab.
 Do not throw connecting wires on the Floor.
 Wear your College ID card.
 Do not operate the IC trainer kits without permission.
 Avoid unnecessary talking while doing the experiment.
 Avoid loose connection and short circuits.
 Take the signature of the lab in charge before taking the components.
 Do not interchange the ICs while doing the experiment.
 Handle the trainer kit properly.
 Do not panic if you do not get the output.
 Keep your work area clean after completing the experiment.
 After completion of the experiment switch off the power and return the
components.
 Arrange your chairs and tables before leaving.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Rules for Maintaining Laboratory Record


1. Put your name, Roll number and subject name on the outside front cover of the record.
Put that same information on the first page inside.
2. Update Table of Contents every time you start each new experiment or topic
3. Always use pen and write neatly and clearly
4. Start each new topic (experiment, notes, calculation, etc.) on a right-side (odd
numbered) page
5. Obvious care should be taken to make it readable, even if you have bad handwriting
6. Date to be written every page on the top right side corner
7. On each right side page;
 Title of experiment
 Aim/Objectives
 Components Required
 Theory
 Procedure described clearly in steps
 Result
8. On each left side page;
 Pin diagrams
 Circuit diagram
 Tables
 Graphs
9. Use labels and captions for figures and tables
10. Attach printouts and plots of data as needed. Stick printouts (A4 Size) on the right
side of the lab record
11. Strictly observe the instructions given by the Teacher/ Lab Instructor.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Experiment No.:- B-1 Date:-

 Aim: Study of GSM Module SIM800/SIM900/QUECTEL M95 and AT Commands.


 Objective:
1. To study of GSM module SIm900.
2. To understand AT commands.
 Theory
The SIM900 is a complete Quad-band GSM/GPRS solution in a SMT module which
can be embedded in the customer applications. Featuring an industry
standard interface, the SIM900 delivers GSM/GPRS 850/900/1800/1900MHz
performance for voice, SMS, Data, and Fax in a small form factor and with low power
consumption. With a tiny configuration of 24mm x 24mm x 3 mm, SIM900 can fit almost
all the space requirements in your M2M application, especially for slim and compact
demand of design.
Features:
 SIM900 is designed with a very powerful single-chip processor integrating
AMR926EJ-S core
 Quad - band GSM/GPRS module with a size of 24mmx24mmx3mm
 SMT type suit for customer application
 An embedded Powerful TCP/IP protocol stack
 Based upon mature and field-proven platform, backed up by our support service,
from definition to design and production
SIM900 General Specification:
 Quad-Band 850/ 900/ 1800/ 1900 MHz
 GPRS multi-slot class 10/8
 GPRS mobile station class B
 Compliant to GSM phase 2/2+
o Class 4 (2 W @ 900 MHz)
o Class 1 (1 W @ 1800MHz)
 Dimensions: 24x24x3mm
 Weight: 3.4g

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

 Control via AT commands (GSM 07.07 ,07.05 and SIMCOM enhanced AT


Commands)
 SIM application toolkit
 Supply voltage range : 3.4V to 4.5V
 Low power consumption: 1.0mA(sleep mode)
 Operation temperature: -40°C to +85 °C
 Fax: Group 3, Class 1
 Data
o GPRS class 10: max. 85.6 kbps (downlink)
o PBCCH support
o Coding schemes CS 1, 2, 3, 4
o CSD up to 14.4 kbps
o USSD
o Non transparent mode
o PPP-stack
 SMS
o Point to point MO and MT
o SMS cell broadcast
o Text and PDU mode
AT Commands
1. AT – It is the most basic AT command. It also initializes Auto-baud’er. If it works
you should see the AT characters echo and then OK, telling you it’s OK and it’s
understanding you correctly! You can then send some commands to query the
shield and get information about it such as
2. AT+CSQ – Check the ‘signal strength’ – the first # is dB strength, it should be higher
than around 5. Higher is better. Of course it depends on your antenna and location!
3. AT+CCID – get the SIM card number – this tests that the SIM card is found OK and
you can verify the number is written on the card.
4. AT+CREG? Check that you’re registered on the network. The second # should be
1 or 5. 1 indicates you are registered to home network and 5 indicates roaming
network. Other than these two numbers indicate you are not registered to any
network.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

5. ATI – Get the shield name and revision


6. AT+COPS? – Check that you’re connected to the network
7. AT+COPS=? – Return the list of operators present in the network
8. AT+CBC – will return the lipo battery state. The second number is the % full (in
this case its 93%) and the third number is the actual voltage in mV (in this case,
3.877 V)
9. AT+CMGF=1 – Selects SMS message format as text. Default format
is Protocol Data Unit (PDU)
10. AT+CMGS=+ZZxxxxxxxxxx – Sends SMS to the phone number specified. The text
message entered followed by a ‘Ctrl+z’ character is treated as SMS. ‘Ctrl+z’ is
actually a 26th non-printing character described as ‘substitute’ in ASCII table. So,
we need to send 26Dec (1AHex) once we send a message.
11. AT+CMGF=1 – Selects SMS message format as text. Default format
is Protocol Data Unit (PDU)
12. AT+CNMI=1,2,0,0,0 – specifies how newly arrived SMS messages should be
handled. This way you can tell the SIM900 shield either to forward newly arrived
SMS messages directly to the PC, or to save them in message storage and then
notify the PC about their locations in message storage.
13. ATD+ +ZZxxxxxxxxxx; – Dials a specified number. The semicolon ; modifier at the
end separates the dial string into multiple dial commands. All but the last
command must end with the semicolon ; modifier.
14. ATH – Hangs up the call
15. ATA – Accepts incoming call.
16. ATH – Hangs up the call. On hanging up the call it sends NO CARRIER on the serial
monitor indicating call couldn’t connect.
 Conclusion: - Hence we studied GSM Module SIM900 & its AT Commands.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Experiment No.:- B-2 Date:-

 Aim: Study of Iot Module.


 Objective:
1. To understand Iot Module.
 Theory
The Internet of Things (IoT) is revolutionizing and improving the way we work
and live. Still, it's only possible with pervasive IoT solutions built on flexible and long-
lived wireless connectivity.
At the heart of it all is a tiny device called the IoT module responsible for
connecting virtually anything to wireless networks.
IoT Modules come with a wide range of wireless technology standards, and they
provide a variety of features that can impact the success of IoT applications.
What is an IoT module?
An IoT module is a small electronic device embedded in objects, machines, and
things connected to wireless networks and sends and receives data.
Sometimes referred to as a "radio chip", "rf module" or "IoT chip," the IoT module
contains the same technology and data circuits found in mobile phones but without
features like a display or keypad.
Another key differentiator of IoT modules is that they provide always-
on connectivity.
Wireless communication mediums that IoT devices can make use of include:
Long Range Wireless Communication:
 GPRS
 3G
 4G / LTE
Short Range Wireless Communication:
 Bluetooth
 Wi-Fi
 RF
 Zigbee
 SIGFOX

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Location Services:
 GPS
 GLONASS
 Galileo
IoT modules and IoT terminals use a variety of wireless technologies to stay
seamlessly and securely connected.
These range from :
 5G, 4G, and 3G cellular solutions for high bandwidth applications like connected cars,
 to Low-Power, Wide-Area (LPWAN) solutions such as MTC (Machine Type
Communication),
 Bluetooth and LoRa are used for intelligent road systems, smart city applications, and
enterprise applications.
Types of Iot Modules:
1. LPWANs
Low Power Wide Area Networks (LPWANs) are the new phenomenon in IoT.
By providing long-range communication on small, inexpensive batteries that last for
years, this family of technologies is purpose-built to support large-scale IoT networks
sprawling over vast industrial and commercial campuses.
LPWANs can literally connect all types of IoT sensors – facilitating numerous
applications from asset tracking, environmental monitoring and facility
management to occupancy detection and consumables monitoring.
2. Cellular (3G/4G/5G)
Well-established in the consumer mobile market, cellular networks offer
reliable broadband communication supporting various voice calls and video
streaming applications. On the downside, they impose very high operational costs
and power requirements.
While cellular networks are not viable for the majority of IoT applications
powered by battery-operated sensor networks, they fit well in specific use cases such
as connected cars or fleet management in transportation and logistics.
3. Zigbee and Other Mesh Protocols
Zigbee is a short-range, low-power, wireless standard (IEEE 802.15.4),
commonly deployed in mesh topology to extend coverage by relaying sensor data

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

over multiple sensor nodes. Compared to LPWAN, Zigbee provides higher data rates ,
but at the same time, much less power-efficiency due to mesh configuration.
Because of their physical short-range (< 100m), Zigbee and similar mesh
protocols (e.g. Z-Wave, Thread etc.) are best-suited for medium-range IoT
applications with an even distribution of nodes in close proximity. Typically, Zigbee
is a perfect complement to Wi-Fi for various home automation.
4. Bluetooth and BLE
Defined in the category of Wireless Personal Area Networks, Bluetooth is a
short-range communication technology well-positioned in the consumer
marketplace. Bluetooth Classic was originally intended for point-to-point or point-
to-multipoint data exchange among consumer devices.
BLE-enabled devices are mostly used in conjunction with electronic devices,
typically smartphones that serve as a hub for transferring data to the cloud.
Nowadays, BLE is widely integrated into fitness and medical wearables (e.g.
smartwatches, glucose meters, pulse oximeters, etc.) as well as Smart Home devices
5. Wi-Fi
There is virtually no need to explain Wi-Fi, given its critical role in providing
high-throughput data transfer for both enterprise and home environments. However,
in the IoT space, its major limitations in coverage, scalability and power consumption
make the technology much less prevalent.
Imposing high energy requirements, Wi-Fi is often not a feasible solution for
large networks of battery-operated IoT sensors, especially in industrial IoT and smart
building scenarios. Instead, it more pertains to connecting devices that can be
conveniently connected to a power outlet like smart home gadgets and appliances,
digital signages or security cameras.
6. RFID
Radio Frequency Identification (RFID) uses radio waves to transmit small
amounts of data from an RFID tag to a reader within a very short distance. Till now,
the technology has facilitated a major revolution in retail and logistics.
 Conclusion: - Hence we studied and understand IoT Module.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Experiment No.:- B-3 Date:-

 Aim: Interfacing of GSM with a computer through COM port to Send and Receive SMS.
 Objective:
1. To understand serial communication.
 Theory
The modem can either be connected directly to the PC serial port or to any microcontroller
through MAX232. It can be used to send and receive SMS or to make/receive voice calls. It
can also be used in GPRS mode to connect to the internet and do many applications for data
logging and control. In GPRS mode you can also connect to any remote FTP server and
upload files for data logging.
Software description
 To communicate with the network we use ELEMENTZ GSM Modem Test
Utility software.
 It is an executable file which supports serial data transmission and reception similar
to HyperTerminal in Windows XP.
How to connect to computer ?
 Firstly insert the SIM card in the sim holder. Make sure to use a normal SIM card
(Micro or nano SIM cards are not supported)
 Connect the GSM modem to the usb2serial hardware via DB9 connector. Then using
a USB A to B cable connect to the computer.
 Connect a 12V/9V 1A adapter to the power jack provided on the GSM
modem. The LM317 voltage regulator regulates the voltage to 3.6V.
 Please note when you connect the power, a RED LED will glow. It shows that the
modem has got the power required for its operation.
 When you connect the power , a BLUE LED will glow for approximately 1sec. After
that it will blink with a delay of approximately half sec. That means the SIM card is
searching for network. If the SIM card has connected to a network, then the BLUE
LED will blink with a delay of approximately 4sec. Depending on the network
strength, the time to connect to a network may vary. If there is no SIM card in the
modem, the BLUE LED blinks with a delay approximately half sec.
 The steps required for connecting the modem to the PC is shown below:

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

 Right click My Computer → select the Device manager →Ports(COM & LPT).
 Note the COM PORT. Here you can see its COM3.

 Double click ‘GSM Tester.exe→click on Scan ports


 The Status box will show “Port Scan complete”.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

 Click on “Port” dropdown menu. Select COM Port for your device. Here its COM3.
 Then click on Open port. The status box will show “Port opened successfully.
Message cleared.”

 Connect the 12V/9V 1A adapter to the power jack of the modem. You can see the
following details in the status box.
“+CFUN: 1 ”
“+CPIN: READY”
“CALL READY” This means that the modem is ready for normal functioning.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

 Please note if SIM is not inserted then it will show “+CPIN: NOT INSERTED”.
 Making a CALL
 To make a call, enter the phone number and press the Call button.

 The status box will show “Data received: ATD9037200424; “. This is the AT
command for making a call.

 If a call is coming to the GSM modem, a series of “RING” will appear on ths Status
box.
 If you want to connect to the call ,then type “ATA” in the AT command window and
press “Execute“.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Sending message
 The first thing you have to do before sending a message is to make the modem to text
mode.
 To do that type ” AT+CMGF=1;&W ” in the AT command window and press
execute. DO NOT TYPE THE DOUBLE QUOTES. &W is used to write to the
SIM900a memory permanently.
 To send a message, type the phone number in Phone number window and the
message content in the Message window and press the Send button.

 You can see that after the message has been sent, the modem gives a response
“+CMGS: 234″.
 From this you can confirm that message has been sent successfully.
 The number 234 means 234 messages has been sent from the modem.
 The AT command for sending message is AT+CMGS=”9036800569″. When you
press enter, “>” prompt will appear.
 Type the content of the message and after that press Ctrl+z to send the message.
 Conclusion: - Hence we studied and understand interfacing of GSM with computer 7
also serial communication.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Experiment No.:- B-4 Date:-

 Aim: Interfacing GSM with 8051 trainer kit and develop a program to send AT
commands.
 Objective:
1. To understand serial communication.
 Theory
Mobile communication is an emerging technology these days. GSM is the acronym for
Global System for Mobile Communication. GSM module is wireless modem that transmits
data using radio waves. GSM architecture is similar to the mobile architecture. GSM
modems are generally used in many electronic applications and they are required to
interface with the microcontrollers. This article describes interfacing of a GSM modem to
an AT89C51 microcontroller.
The main principle of this circuit is to interface a GSM modem with the
microcontroller. The microcontroller used is AT89C51 microcontroller. To communicate
with GSM modem, AT commands are required. Microcontroller sends these commands to
the GSM modem, which is then activated to perform the required operation.
The following AT commands are frequently used to control the operations of GSM
modem.
Command – Operation
AT+CSMS – Select message service. AT+CMGF – Message format.
AT+CMGL – List messages. AT+CMGR – Read message.
AT+CMGS – Send message. AT+CMGD – Delete message.
ATA – Answer a call. ATD – Dial a number.
ATDL – Dial the last outgoing number. ATH – Hang up the call.
Instead of sending commands from the HyperTerminal, AT commands are sent to
the GSM/GPRS module by the microcontroller itself. In this case, the receive (Rx) and
transmit (Tx) pin of the GSM module’s RS232 port are connected to the transmit (Tx) and
receive (Rx) pin of AT89C51’s serial port, respectively. This eliminated the role of
computer and just the controller’s circuit provides a complete user interface for the
module.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

The controller is programmed to send a fixed command ‘AT’ to the module. The
command AT is used to check the communication with module. It returns a result code
OK if the module and the controller are connected properly. If either of the module or SIM
are not working, it returns a result code ERROR.
The program complexities for display of information responses and result codes
on LCD mentioned in MC075 remain same here as well.
How to Operate GSM Interfacing with 8051 Microcontroller Circuit?
 Initially, connect the circuit as shown in the circuit diagram.
 Switch on the power supply.
 Now send a message from any other phone to the SIM present in the GSM module.
 Whenever a message is received by the GSM, it is displayed on the LCD.
 If you want to send a message press the button B1 connected to port B.
 This sends a message written in the code.
Project Source Code
#include<reg51.h>
#define port P1
#define dataport P2 // Data port for LCD
sbit rs = port^2;
sbit rw = port^3;
sbit en = port^4;
int count,i;
unsigned char check,str[15];
bit check_space;

void init_serial() // Initialize serial port


{
TMOD=0x20; // Mode2
TH1=0xfd; // 9600 baud
SCON=0x50; // Serial mode=1 ,8-Bit data,1 Stop bit ,1 Start bit,
Receiving on
TR1=1; // Start timer
}

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

void delay(unsigned int msec) // Function for delay


{
int i,j;
for(i=0;i<msec;i++)
for(j=0; j<1275; j++);
}

void lcd_cmd(unsigned char item) // Function to send command on LCD


{
dataport = item;
rs= 0;
rw=0;
en=1;
delay(1);
en=0;
return;
}

void lcd_data(unsigned char item) // Function to display character on LCD


{
dataport = item;
rs= 1;
rw=0;
en=1;
delay(1);
en=0;
return;
}

void lcd_data_string(unsigned char *str) // Function to display string on LCD


{
int i=0;
while(str[i]!='')
{
lcd_data(str[i]);
i++;
delay(10);
}
return;
}
void lcd()
{
lcd_cmd(0x38); // For using 8-bit 2 row LCD
delay(5);
lcd_cmd(0x0F); // For display on cursor blinking
delay(5);
lcd_cmd(0x80); // Set the cursor on first position of LCD
delay(5);
}

void transmit_data(unsigned char str) // Function to transmit data through serial port
{

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

SBUF=str; //Store data in SBUF


while(TI==0); //Wait till data transmits
TI=0;
}

void receive_data() interrupt 4 // Function to recieve data serialy from RS232 into
microcontroller
{
RI=0;
str[++count]=SBUF; //Read SBUF

unsigned char byte_check() // Function to check carraige return and new line
character
{
switch(str[0])
{
case 0x0a:
{ // Return 0x00 for new line
return 0x00;
break ;
}
case 0x0d:
{ // Return 0x01 for carriage return
return 0x01;
break ;
}
default :return 0x02 ; // Return 0x02 for characters except new line and
carriage return
}
}

void main()
{
lcd(); // Initialize LCD
init_serial(); // Initialize serial port
count=(-1);
delay(500);
lcd_data_string("Ready");
delay(10);
lcd_cmd(0x01);
IE=0x94;
transmit_data('A'); // Transmit 'A' to serial port
delay(1);
transmit_data('T'); // Transmit 'T' to serial port
delay(1);
transmit_data(0x0d); // Transmit carriage return to serial port
delay(50);
while(1)
{
if(count>=0)

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

{
check=byte_check(); // Check the character
if(check!=0x00)
{
if(check==0x01)
{
if(check_space==1) // Check previous character
{
lcd_data(0x20);
check_space=0;
}
}
else
{
lcd_data(str[0]);
check_space=1;
}
}
count--;
for(i=0;i<count;i++) // Shift the whole array to one left
{
str[i]=str[i+1];
}
}
}
}

 Conclusion; Hence we studied and understand interfacing of 8051 with GSM.


 Circuit Diagram

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Experiment No.:- B-5 Date:-

 Aim: Develop a program in C to read and send SMS from the GSM module.
 Objective:
1. To understand C language.
 Theory
Program to Send SMS:
#include <reg51.h>
#define NUMBER 0123456789 //Here insert your number where you want
to send message
void ser_init();
void tx(unsigned char send);
void tx_str(unsigned char *s);
unsigned char rx();
void sms(unsigned char *num1,unsigned char *msg);
void gsm_delay();
unsigned int dell;
int main()
{
ser_init();
sms(NUMBER, "Welcome to the Embetronicx");
while(1);
}
void ser_init()
{
SCON=0x50;
TMOD=0x21;
TH1=0xFD;
TL1=0xFD;
TR1=1;
}
void tx(unsigned char send)
{
SBUF=send;
while(TI==0);
TI=0;
}
void tx_str(unsigned char *s)
{
while(*s)
tx(*s++);
}
unsigned char rx()

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

{
while(RI==0);
RI=0;
return SBUF;
}
void gsm_delay()
{
unsigned int gsm_del;
for(gsm_del=0;gsm_del<=50000;gsm_del++);
}
void sms(unsigned char *num1,unsigned char *msg)
{
tx_str("AT");
tx(0x0d);
gsm_delay();
tx_str("AT+CMGF=1");
tx(0x0d);
gsm_delay();
tx_str("AT+CMGS=");
tx('"');
while(*num1)
tx(*num1++);
tx('"');
tx(0x0d);
gsm_delay();
while(*msg)
tx(*msg++);
tx(0x1a);
gsm_delay();
}
 Conclusion; Hence we understand C language for sending SMS using GSM

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Experiment No.:- B-6 Date:-

 Aim: Development of mobile app for various applications in electrical engineering.


 Objective:
1. To understand mobile app making process.
2. To understand electricity billing calculation.
 Theory:
The project is a web based application where users can get instant electricity bill and
pay them online via credit card. The system automates the conventional process of paying
electricity bill by visiting the place. Users have to stand in queue for paying bill and wait
for their turn. The process is tiresome and time consuming. They even have to wait for
the bill being delivered to their place which sometimes can be delivered late by the
delivery boy. Hence the system is developed to automate the electricity bill calculation
and payment for user convenience.
The system would be having two logins admin and user login. Admin can view user
account details and can even add or updates things in their account. Admin has to feed
the system with electricity usage data into respective users account. The system then
calculates the electricity bill for every user and updates the information into their account
every month. User can then view their electricity bill and pay on the spot before month
end. If user is incapable of paying the bill before month end, it then calculates fine for each
day.
Features:
 Admin login: It has admin login who has the authority of the system and acts as a
communicator between user and seller. Admin can add and delete notifications
and updates in the system.
 User login: User has to first create an account in the system to gain access. User
can then view their account balance and electricity being used by them.
 Bill Calculation: The system uses a formula to calculate the bill according to the
electricity usage provided by the admin for each user.
 Fine calculation: If the user is unable to pay the bill within month end, the system
automatically calculates the fine that the user has to pay for subsequent days.
Software Requirements:
 Windows Xp, Windows 7(ultimate, enterprise)
 Android Studio

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

 Procedure to create mobile app:


Step 1: Install Android Studio

1. Go to http://developer.android.com/sdk/index.html to download Android


Studio.
2. Use the installer to install Android Studio following its instructions.
Step 2: Open a New Project

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

1. Open Android Studio.


2. Under the "Quick Start" menu, select "Start a new Android Studio project."
3. On the "Create New Project" window that opens, name your project "HelloWorld".
4. If you choose to, set the company name as desired*.
5. Note where the project file location is and change it if desired.
6. Click "Next."
7. Make sure on that "Phone and Tablet" is the only box that is checked.
8. If you are planning to test the app on your phone, make sure the minimum SDK is
below your phone's operating system level.
9. Click "Next."
10. Select "Blank Activity."
11. Click "Next."
12. Leave all of the Activity name fields as they are.
13. Click "Finish."

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

Step 3: Edit the Welcome Message in the Main Activity

1. Navigate to the activity_main.xml tab if it is not already open.


2. Make sure that the Design tab is open on the activity_main.xml display.
3. Click and drag the "Hello, world!" from the upper left corner of the phone display to
the center of the screen.
4. In the project file system on the left side of the window, open the values folder.
5. In the values folder, double-click the strings.xml file.
6. In this file, find the line "Hello world!".
7. After the "Hello world!" message, add "Welcome to my app!"
8. Navigate back to the activity_main.xml tab.
9. Make sure that your centered text now reads "Hello world! Welcome to my app!"
Step 4: Add a Button to the Main Activity

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

1. Navigate to the Design tab of the activity_main.xml display.


2. In the Palette menu to the left of the phone display, find Button (under the heading
Widgets).
3. Click and drag Button to be centered underneath your welcome message.
4. Make sure your button is still selected.
5. In the Properties menu (on the right side of the window), scroll down to find the
field for "text."

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

6. Change the text from "New Button" to "Next Page."


Step 5: Create a Second Activity

1. At the top of the project's file system tree, right click on "app."
2. Navigate through to New > Activity > Blank Activity.
3. Change the name of this activity to "SecondActivity".
4. Click "Finish."

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

5. Make sure you are in the Design view of activity_second.xml.


6. Drag the text box in the upper left of the phone display down to the center as you did
on the Main Activity.
7. With the text box still selected, find the "id" field in the Properties menu on the right,
and set it to "text2".
8. Open strings.xml again.
9. Add a new line under "Hello world! Welcome to my app!" that reads "Welcome to
the second page!".
10. Navigate back to activity_second.xml.
11. Select the text box again.
12. In the Properties pane, set the "text" field to "@string/second_page".
13. Make sure that the text box now reads "Welcome to the second page!" and is in the
center of the screen in the phone display.
Step 6: Write the Button's "onClick" Method

1. Select the MainActivity.java tab along the top of the work environment.
2. Add the following lines of code at the end of the onCreate method:
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.onClickListener() {
@Override
public void onClick(View v) {
goToSecondActivity();
}
});

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

3. Add the following method to the bottom of the


MainActivity class:
private void goToSecondActivity() {
Intent intent = new Intent(this, SecondActivity.class);
startActivity(intent);
}
4. Click the + next to import at the third line of MainActivity.java to expand the import
statements.
5. Add the following to the end of the import statements if they are not already there:
import android.content.Intent;
import android.view.View;
import android.widget.TextView;
Step 7: Test the Application

1. Click the green play symbol from the toolbar at the top of the Android Studio window.
2. When the "Choose Device" dialog apperas (this may take a few moments), select the
"Lauch emulator" option.
3. Click OK.
4. When the emulator opens (this too could take awhile), the app will automatically
launch the app upon the virtual phone being unlocked.

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

5. Make sure that all of your text displays correctly and that the button takes you to the
next page.
Step 8: Up, Up, and Away!

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”
Guru Gobind Singh Foundation’s
Guru Gobind Singh College of Engineering & Research Centre
(Approved by AICTE Gov. of Maharashtra & DTE Mumbai. Affiliated to Savitribai Pune University)
NAAC Accreditation First Cycle “B+” with CGPA 2.72 in April 2019, DNY- GL – Certified for ISO 9001 2015 Standards
Khalsa Education Complex, Guru Gobind Singh Marg Wadala, Parthidi Road, Indira Nagar, Nashik-9
Ph: 0253 2372766, 2372666 Email- gcoerc.nashik@ggsf.edu.in, Website – www.ggsf.edu.in

 Program:
class ComputeElectricityBill
{
public static void main(String args[])
{
int units=280;
double billpay=0;
if(units<100)
{
billpay=units*1.20;
}
else if(units<300)
{
billpay=100*1.20+(units-100)*2;
}
else if(units>300)
{
billpay=100*1.20+200*2+(units-300)*3;
}
System.out.println("Bill to pay : " + billpay);
}
}

We Transform Youngsters …..By Creating “Intellectuals innovative Learners with social Commitment”

You might also like