Finalprojectreport-161008191804.pdf

  • Uploaded by: Warrior Prince
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Finalprojectreport-161008191804.pdf as PDF for free.

More details

  • Words: 19,467
  • Pages: 92
ABSTRACT Home security system is needed for convenience and safety. This system invented to keep home safe from intruder. In this work, we present the design and implementation of a GSM & PIR sensor based home security system using ARDUINO-UNO board. Which take a very less power. The system is a arduino-uno based home security system which contains a GSM modem and PIR sensor with servo-motor and a camera which provides a better security. The system can response rapidly as intruder enters into the trigged zone, PIR sensor sense the object and GSM module will send a notification as a SMS to the registered number of the home owner, and can also give a snapshot of that object. This security system for alerting a house owner wherever he will. In this system as a object enters into the zone GSM module produce a signal through a public telecom network and sends a message or redirect a call that that tells about your home update or predefined message which is embedded in arduino-uno board. Suspected activities are conveyed to remote user through SMS or Call using GSM technology. KEYWORDS: GSM (Global System for Mobile Communications), ARDUINO-UNO, PIR, SMS.

P a g e 1 | 92

INDEX

Page No. CHAPTER (1) INTRODUCTION OF PROJECT…………….…...(8) 1.1Aim of project……………………………………………………………….....(8) 1.2 Outlines of project…………………………………………………….………(8) 1.3 Methodology……………………………………………………………...…..(9)

CHAPTER (2) LITRETURE REVIEW………….…………….....(11) 2.1 Embedded system…………………………………………………………...(11) 2.1.1 Introduction…………………………………………………………………....…(11) 2.1.2 Major building blocks of embedded system………………………………………(13) 2.1.3 Example of embedded system…………………………………………………….(14) 2.1.4 Characteristics of embedded system……………………………………………...(15) 2.1.5 Comparison…………………………………………………………………….…(16) 2.1.6 Embedded system hardware ……………………………………………………...(16) 2.1.7 Typical architecture ………………………………………………………….......(18) 2.1.8 Element of embedded system design……………………………………....……..(19)

2.2 Arduino……………………………………………………………..........…(20) 2.2.1 Introduction………………………………………………………………........…(20) 2.2.2 Who created Arduino……………………………………………………………..(21) 2.2.3 Why Arduino…………………………………………………………………......(22) 2.2.4 Working in Arduino………………………………………………………………(23)

CHAPTER (3) ARDUINO-UNO……………………………..........(27) 3.1 Overview……………………………………………………………..….….(27) 3.2 Pin diagram……………………………………………………………....…(28) 3.3 ATMega328……………………………………………………………...…(29) 3.3.1 Introduction………………………………………………………………...…...(29) 3.3.2 Features……………………………………………………………………....….(29) 3.3.3 Pin description…………………………………………………………………..(30) P a g e 2 | 92

3.3.4

Comparison

among

ATmega48PA,

ATmega88PA,

ATmega168PA

and

ATmega328P…………………………………………………………………………...(33) 3.3.5 Internal Description……………………………………………………….…..….(33) 3.3.6 Communication…………………………………………………………….........(35) 3.3.7 Processor architecture…………………………………………………….….…...(36) 3.3.8 Pin description………………………………………………….……...................(40) 3.3.9 Things to remember about ATMEGA328 controllers…………………....………(40)

CHAPTER (4) ARDUINO SOFTWARE……………………………...(41) 4.1 Arduino IDE……………………………………………………………..…..(41) 4.1.1 What is IDE? …………………………………………………….….....................(42)

4.2 Serial Communication…………………………………………………….....(42)

CHAPTER (5) GSM TECHNOLOGY AND MODEM……...........(44) 5.1 Introduction………………………………………………………………….(44) 5.2 Cellular mobile system………………………………………....................…(45) 5.3 GSM technology……………………………………………………………..(46) 5.4 System architecture………………………………………………….………(48) 5.4.1 Mobile Station…………………………………………………………………....(48) 5.4.2 Base Station Subsystem……………………………………………………….….(48) 5.4.3 Base Transceiver Station…………………………………………….....................(48) 5.4.4 Base Station Controller…………………………………………………………...(48) 5.4.5 Trans-coder and Rate Adaptation Unit……………………………….…………...(49)

5.5 Network and switching sub system…………………………………….…….(49) 5.5.1 Mobile Service Switching Center………………………………………………...(50) 5.5.2 Inter Working Function, (IWF) …………………………………………………..(50) 5.5.3 Home Location Register, (HLR) …………………………………………………(50) 5.5.4 Visitor Location Register, (VLR) ……………………………………...................(50) 5.5.5 Gateway MSC (GMSC) …………………………………………...……………..(50) 5.5.6 Signaling Transfer Point………………………………………….........................(50)

5.6 More points…………………………………………………………………..(50) 5.6.1 Operating subsystem……………………………………………………………...(50) P a g e 3 | 92

5.6.2 Layer modeling…………………………………………………...……………...(51) 5.6.3 Radio link aspects……………………………………………...…………………(51) 5.6.4 Multiple access and channel structure……………………………….…………...(51) 5.6.5 Traffic channels………………………………………………. …………………(51) 5.6.6 Cell selection……………………………………………………………………..(51)

CHAPTER (6) SERVO MOTOR………………………………….(53) 6.1 Introduction………………………………………………………………….(53) 6.2 Commercial application……………………………………………………..(54) 6.3 Types…………………………………………………………………...........(54) 6.4 Principle of operation………………………………………………………..(54) 6.5 Application…………………………………………………………………..(56)

CHAPTER (7) PIR SENSOR………………………………………(57) 7.1 Introduction…………………………………………………………….……(57) 7.2 How it works………………………………………………. ……………….(58) 7.3 Technical data……………………………………………………. …….......(58) 7.4 Application……………………………………………………. ……………(59)

CHAPTER (8) COMPONENTS…………………………………(60) 8.1 Capacitor…………………………………………………………………….(60) 8.1.1 Introduction………………………………………………………………………(60) 8.1.2 Actual Capacitance………………………………………………..……………...(60) 8.1.3 Breakdown voltage………………………………………………..……………...(61) 8.1.4 Types of Capacitors……………………………………………….……………...(61) 8.1.5 Variable Capacitors……………………………………………….……………...(62) 8.1.6 Methods of Making Capacitors…………………………………………………..(62)

8.2 LCD……………………………………………………………………….…(62) 8.2.1 Introduction………………………………………………………………………(62) 8.2.2 Pin description……………………………………………………………………(63) 8.2.3 Sequence of writing to the LCD………………………………………………….(63) 8.2.4 LCD interface diagram…………………………………………….……………..(64) P a g e 4 | 92

8.3 LED………………………………………………….………………………(65) 8.3.1 Introduction………………………………………………………………………(65) 8.3.2 Applications……………………………………………………...........................(66) 8.3.3 LED specifications……………………………………………..………………...(66)

CHAPTER (9) ACCESSORIES…………………………………...(68) 9.1 Adapters………………………………………………………………..……(68) 9.2 Dip Bases……………………………………………………………………(68) 9.3 Power Jack…………………………………………………………..………(68) 9.4 Switches……………………………………………………………..………(68) 9.5 Connectors……………………………………………………………..……(70) 9.6 Berge Strip…………………………………………………………..………(70) 9.7 DC connectors…………………………………………………….…………(70)

CHAPTER (10) SOURCE CODE…………………………………(71) CHAPTER (11) RESULTS AND DISCUSSIONS………...……...(89) 11.1 Results and Conclusions…………………………………………...………(89) 11.2 Uses and further scope………………………………………………..……(90)

CHAPTER (12) REFERENCES…………………………...………(92)

P a g e 5 | 92

LIST OF FIGURES Figure No.

Description

Page No.

2.1.1

Components of embedded system

12

2.1.3

Examples of embedded system

14

2.1.6(a)

Embedded system hardware (in loop)

16

2.1.6(b)

Circuit diagram of embedded system hardware

17

2.1.7

Typical architecture of embedded system

18

3.2

Pin diagram OF Arduino UNO

28

3.3.3(a)

Pin description of ATmega 328

31

3.3.3(b)

Pin diagram of ATmega328

32

3.3.7(a)

Process architecture of microcontroller

37

3.3.7(b)

Variation of input and output voltage of microcontroller

39

3.3.8

Pin diagram of ATmega 328

40

5.4.4(a)

Block diagram of BSC

49

5.4.4(b)

Block diagram of GSM technology

49

6.1

Block diagram of servo motor

53

6.4(a)

Principle of operation of servo motor

55

6.4(b)

Principle of operation sending of high pulse at every 20 ms

55

7.1(a)

PIR sensor

57

7.1(b)

Pcb of PIR sensor

57

7.2

Working of PIR sensor

58

8.2.4

LCD interfacing diagram

65

8.3.1(a)

Schematics diagram of LED

66

8.3.1(b)

LED

66

11.1

GOOGLE trends comparing ARDUINO with its biggest

89

competitors

P a g e 6 | 92

LIST OF IMAGES Image No.

Description

Page No.

2.2.1

Picture of Arduino board

20

2.2.3(a)

Working step1

23

2.2.3(b)

Working step2

24

2.2.3(c)

Showing the basic syntax of the programm

46

4.2

Transmission and reception of Arduino board

43

6.1

Block diagram of BSC

53

8.1.4(a)

Picture of polarize capacitors

61

8.1.4(b)

Picture of un-polarize capacitors

62

8.1.5

Picture of variable capacitors

62

8.3.1

Picture of LED

65

8.3.3

Identification of LED terminals

67

LIST OF TABLE Table No. 2.1.5

Description

Page No.

Comparison between embedded system and general purpose

16

computing 3.3.4

Memory summary of different ATmega microcontroller

33

3.3.6

Arduino specification

36

5.2

Cellular mobile system

45

8.2.2

Pin description of 16x2 LCD display

63

8.3.3

Specification of LED

66

P a g e 7 | 92

CHAPTER (1) INTRODUCTION OF PROJECT 1.1 Aim of Project From last few year home security is an essential requirement of households to keep home safe from intruders to get rob. So the researchers and companies tries to implement an algorithms and make some gradates that keep your home safe from intruders. This leads to advance technology that make your home intelligent or modern this called as home automation & security system also. With this technology house owner can control other appliances as well like lighting system, dimming, electrical appliances and many more. Now a day's wireless technology is used to control home appliances instead of wired topological connection. GSM (Global System for Mobile Communication) technology makes used to communicate input signal from appliances to output message on device. That means after detection of any intrusion GSM Modem sends the appropriate message to house owner's phone. The signals or data which is comes from sensors or other equipment digitize it by GSM module and send it to receiver. So that better security is provided by the user. Home automation or home security system offers many benefits. After so many research I gave a mainly focused on GSM based home security. It is very easy to install and having a very less cost. Basically it installed over the entry that front door where a matrix keypad and 16x2 LCD display is installed which is connected to the arduino-uno board and the coding is done in such manner so that “ENTER PASSWORD” is display on the LCD screen we enters the password to activate the system, once the system is activated the PIR sensor sense the objects and the camera which is mounted on the servo-motor, moves to the location of the object, signals will generate via PIR sensor and sends it to ATMEGA 328microcontroller of the arduino-uno board and action takes place according to piece of code written in the chip and GSM module sends the message to owner's phone. There has been much research done on various type of home security systems like Sensor based Home security System, Figure print, Palm print and keypad activation for authentication and so much. All type of Security system uses only a technique of GSM module. In this project the work mainly focuses on the security of home when the user is out from the place. GSM based technology proposed to keep updated owner about house security. In this security system is SMS based and uses GSM technology to send SMS to the owner. Normally the aim of this type of system is to keep secure home from intruders. To increase the performances of a smart automated house, lots of research is going on. For an example; The Aware Home Research Initiative (AHRI) at Georgia Institute of Technology is an interdisciplinary research endeavor aimed at addressing the fundamental technical, design, and social challenges for people in a home setting.

1.2 Outlines of Report P a g e 8 | 92

This report contains a detailed information about all the components used in this project. The components used are: Arduino-uno PIR sensor GSM module Servo-motor LCD LED Keypad interfacing A detailed report about each and every component is described in separate chapter. Chapter 2 contains information about Embedded System & Arduino board. Chapter 3 contains information about Arduino-uno. Chapter 4 contains information about Arduino software. Chapter 5 contains information about GSM technology and MODEM Chapter 6 contains information about Servo motor Chapter 7 contains information about PIR sensor Chapter 8 contains information about all the components Chapter 9 contains information about Accessories used in the project Chapter 10 contains Source code Chapter 11 contains Result and descriptions Chapter 12 contains Reference

1.3 Methodologies The idea of this project is to give information about the perpetrator to the victim of stolen car, confidential data from any organization, presence of unauthorized person in the home etc. So we have chosen GSM technology to give the information by sending SMS.

P a g e 9 | 92

Sending SMS alone can’t help to the victim, if we send and an SMS with the snapshot of the perpetrator or able to take a video of that incident. So we include a camera which is mounted on the servo-motor which provides motion covered to the trigged zone when the incident has occurred. To run the CAMERA/WEBCAM and GSM module we use Arduino UNO board which has ATmega328 microcontroller. The Arduino is a very user friendly device which can be easily interfaced with any sensors or modules and is very compact in size. Also we can make RFID card detector using Arduino-uno using which one can make detect his own RFID card if available like if one wants to check balance in metro card, attendance record in office, and many more. Finally we can sense the room temperature and distance of any object. One can also glow LED’s in some beautiful dancing patterns and display them on LCD.

P a g e 10 | 92

CHAPTER (2) LITERATURE REVIEW A literature review is collection of a critical, unbiased, and comprehensive evaluation of published information in a chosen and specific area of study of interest. It gives a general understanding of findings of the research work, conclusions, and recommendations and thereby brings out their strengths and weaknesses. This helps in identifying gaps, scope for further work and generalized concepts in the existing body of knowledge.

2.1 Embedded System 2.1.1 Introduction Embedded system are components integrating software and hardware jointly and specifically designed to provide given functionalities. A combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a dedicated function. In some cases, embedded system are part of a larger system or product, as in the cases of an antilock braking system in a car. Such equipment is electrical or battery powered. The chip controls one or more functions of the equipment, such as remembering how long it has-been since the device last received maintenance. An Embedded System is a special-purpose computer system designed to perform one or a few dedicated functions, often with real- time computing constraints. “An embedded system is an application that contains at least one programmable computer (typically in the form of a microcontroller, a microprocessor or digital signal processor chip) and which is used by individuals who are, in the main, unaware that the system is computer-based.” Embedded systems are designed to do some specific task, rather than be a general-purpose computer for multiple tasks. Some also have real time performance constraints that must be met, for reason such as safety and usability; others may have low or no performance requirements, allowing the system hardware to be simplified to reduce costs. An embedded system is not always a separate block very often it is physically built-in to the device it is controlling. The software written for embedded systems is often called firmware, and is stored in read-only memory or flash convector chips rather than a disk drive. It often runs with limited computer hardware resources: small or no keyboard, screen, and little memory. An embedded system is some combination of hardware and software, either fixed in capability or programmable, that is specifically designed for a particular function. Industrial machines, automobiles, medical equipment, cameras, household appliances, airplanes, vending machines and toys (as well as the more obvious cellular phone and PDA) are among the myriad possible hosts of an embedded system. In embedded systems, software commonly known as firmware is hidden inside the same hardware rather than in some other hardware. Basically embedded systems are P a g e 11 | 92

task specific devices. One of its most important characteristic is gives the output within the time constraints or you can say they are time bound systems.

Figure no-2.1.1Components of embedded system

These embedded systems help to make the work more convenient and accurate. So, we often use these embedded systems in simple and complicated devices too. We use these embedded systems in our real life for many devices and applications such as Calculators, microwave, television remote control, home security and neighborhood traffic control systems, etc. Modern embedded systems are often based on microcontrollers (i.e. CPUs with integrated memory or peripheral interfaces) but ordinary microprocessors (using external chips for memory and peripheral interface circuits) are also still common, especially in more complex systems. In either case, the processor(s) used may be types ranging from general purpose to those specialized in certain class of computations or even custom designed for the application at hand. A common standard class of dedicated processors is the digital signal processor (DSP). Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale.

P a g e 12 | 92

Embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, and largely complex systems like hybrid

vehicles, MRI,

and avionics.

Complexity

varies

from

low,

with

a

single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large or enclosure. 2.1.2 Major building blocks of embedded system The major building blocks of an embedded system are listed below:     

Microcontrollers / digital signal processors (DSP) Integrated chips Real time operating system (RTOS) - including board support package and device drivers Industry-specific protocols and interfaces Printed circuit board assembly

Usually, an embedded system requires mechanical assembly to accommodate all the above components and create a product or a complete embedded device. A controller is used to control some process. At one time, controllers were built exclusively from logic components, and were usually large, heavy boxes. Later on, microprocessors were used and the entire controller could fit on a small circuit board. Real time system: A system where correctness depends not only on the correctness of the logical result of the computation, but also on the result delivery time. It responds in a timely, predictable way to unpredictable external stimuli arrivals. The real Time Systems can be further divided into two types: 

Soft Real-Time System: Compute output response as fast as possible, but no specific deadlines that must be met.



Hard Real-Time System: Output response must be computed by specified deadline or system.

P a g e 13 | 92

2.1.3 Example of embedded system

Figure no- 2.1.3 examples of embedded system P a g e 14 | 92

2.1.4 Characteristics of embedded system 

Must be dependable:



Reliability (t) = probability of system working correctly provided that is was working at t=0



Maintainability (d) = probability of system working correctly d time units after error occurred.



Availability: probability of system working at time t



Safety: no harm to be caused



Security: confidential and authentic communication

Even perfectly designed systems can fail if the assumptions about the workload and possible errors turn out to be wrong. Making the system dependable must not be an after-thought, it must be considered from the very beginning. 1. Must be Efficient a) Energy efficient. b) Code-size efficient (especially for systems on a chip) c) Run-time efficient d) Weight efficient 2. Dedicated user interface & Dedicated towards a certain application: Knowledge about behavior at design time can be used to minimize resources and to maximize robustness. 3. Many ES must meet real-time constraints: a) A real-time system must react to stimuli from the controlled object (or the operator) within the time interval dictated by the environment. b) For real-time systems, right answers arriving too late (or even too early) are wrong. 4. Frequently connected to physical environment through sensors and actuators 5. Hybrid systems (analog + digital parts). 6. Typically, ES are reactive systems: A reactive system is one which is in continual interaction with is environment and executes at a pace determined by that environment“ P a g e 15 | 92

2.1.5 Comparison Embedded Systems

General Purpose Computing

Few applications that are known at design-time.

Broad class of applications.

Not programmable by end user

Programmable by end user.

Fixed run-time requirement computing power not useful).

(additional Faster is better.

Criteria: 1. Cost 2. Power consumption 3. Predictability

Criteria: 1. Cost 2. Average speed

Table no-2.1.5 comparison between embedded system and general purpose computing

2.1.6 Embedded system hardware

Figure no- 2.1.6(a) embedded system hardware (in loop)

We learnt that the hardware elements: a) Processor and b) Basic circuit elements: power source, clock, reset, timers, memory, glue circuit for the elements linking and interfaces. c) Keypad, LCD display matrix or touch screen

P a g e 16 | 92

d) IO communication elements: buses (serial and parallel), interfaces for network interface, ADC, DAC, pulse dialer, modem, Bluetooth, 802.11, as per the application e) Interrupt handler Embedded system hardware basically consists of three main elements: 

Input System: Input system is the basically used to interact with external environment or type of input the user want to give. There can be various type of the input system depending upon the user or system need. Some of the examples are sensor interfaces (IR, LDR etc.), UART interface (for communication with PC), Wireless interfaces for various type of wireless communication etc. These interfaces have also a good circuit design and should be properly designed so that it can easily interact with the next unit.



Processing Unit: The next unit is the processing unit that consist either analog circuit to process the input or to make the system perform good and user dependant (as per program) uses the microcontroller interface circuit. The main function of this unit is to take the input, process it and generate the desired output as per the program (done by user) to control the output unit.



Output unit: The output unit consists of the circuit interface to generate and control the desired output. For example the relay driving unit, motor driver unit, alarm systems, Display units etc.

Figure no- 2.1.6(b) circuit diagram of embedded system hardware P a g e 17 | 92

2.1.7 Typical Architecture of embedded system

Figure no-2.1.7 typical architecture of embedded system

P a g e 18 | 92

2.1.8 Element of embedded system design The design of embedded system includes three things: 1. Hardware: Embedded system hardware basically consists of three main elements: 

Input System: Input system is the basically used to interact with external environment or type of input the user want to give. There can be various type of the input system depending upon the user or system need. Some of the examples are sensor interfaces (IR, LDR etc.), UART interface (for communication with PC), Wireless interfaces for various type of wireless communication etc. These interfaces have also a good circuit design and should be properly designed so that it can easily interact with the next unit.



Processing Unit: The next unit is the processing unit that consist either analog circuit to process the input or to make the system perform good and user dependent (as per program) uses the microcontroller interface circuit.



Output unit: The output unit consists of the circuit interface to generate and control the desired output. For example the relay driving unit, motor driver unit, alarm systems, Display units etc.

2. Embedded Software (Compilers): Embedded software is computer software that plays an integral role in the electronics it is supplied with. Embedded software's principal role is not information technology (i.e. it is not about information and the technologies related to providing information services), but rather the interaction with the physical world. It's written for machines that are not, first and foremost, computers. Manufacturers 'build in' embedded software in the electronics in cars, telephones, audio equipment, robots, appliances, toys, security systems, pacemakers, televisions and digital watches, for example. This software can become very sophisticated in applications such as airplanes, missiles, and process control systems. Varying hardware requires different embedded system depending upon the architecture. Linker Program (software): In computer science, a linker or link editor is a program that takes one or more objects generated by a compiler and combines them into a single executable program (hex code). These are inter-linked with the compilers 3. These are the Flash program that is capable of reading from the controllers writing to the hardware controllers to the HEX code.

P a g e 19 | 92

2.2 Arduino 2.2.1 Introduction Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board.

Image no-2.2.1 picture of Arduino board

Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects can be stand-alone, or they can be communicating with software running on your computer (e.g. Flash, Processing, MAX-MSP.) The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free. The Arduino programming language is an implementation of Wiring, a similar physical computing platform, which is based on the Processing multimedia programming environment. Arduino is a popular open-source single-board microcontroller, descendant of the open-source Wiring platform designed to make the process of using electronics in multidisciplinary projects more accessible. The hardware consists of a simple open hardware design for the Arduino board with an Atmel AVR processor and on-board input/output support. The software consists of a standard programming language compiler and the boot loader that runs on the board. Arduino hardware is programmed using a Wiring-based language (syntax and libraries), similar to C++ with some slight simplifications and modifications, and a Processing-based integrated development environment. Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects. Arduino can take the P a g e 20 | 92

input from many sensors attached to it & can give the output to many lights, motors etc. There is no prerequisite knowledge of Advance electronics for operating Arduino. All you should know is basic electronics and C programming language. Arduino platform mainly contains a Hardware Board called Arduino Board & software Arduino IDE to program it. Other external hardware like Sensor Modules, Motors, lights etc. could be attached with the board. ARDUINO BOARDS:Arduino UNO.

Arduino MEGA.

Arduino MINI.

Arduino DUE.

Arduino YUN.

Arduino Lily pad.

The most common Board used is Arduino UNO. “UNO" means one in Italian and was chosen to mark the release of Arduino Software (IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference versions of Arduino, now evolved to newer releases. 2.2.2 Who created Arduino? Author Steve Heath There are many definitions for this but the best way to define it is to describe it in terms of what it is not and with examples of how it is used. An embedded system is a microprocessor-based system that is built to control a function or range of functions and is not designed to be programmed by the end user in the same way that a PC is. Yes, a user can make choices concerning functionality but cannot change the functionality of the system by adding/replacing software. With a PC, this is exactly what a user can do: one minute the PC is a word processor and the next it’s a games machine simply by changing the software. An embedded system is designed to perform one particular task albeit with choices and different options. The last point is important because it differentiates itself from the world of the PC where the end user does reprogram it whenever a different software package is bought and run. However, PCs have provided an easily accessible source of hardware and software for embedded systems and it should be no surprise that they form the basis of many embedded systems. To reflect this, a very detailed design example is included at the end of this book that uses a PC in this way to build a sophisticated data logging system for P a g e 21 | 92

a race car. If this need to control the physical world is so great, what is so special about embedded systems that has led to the widespread use of microprocessors? There are several major reasons and these have increased over the years as the technology has progressed and developed. Replacement for discrete logic-based circuits. The microprocessor came about almost by accident. Arduino started in 2005 as a project for students at the Interaction Design Institute Ivrea in Ivrea, Italy. At that time program students used a "BASIC Stamp" at a cost of $100, considered expensive for students. Massimo Banzi, one of the founders, taught at Ivrea. The name "Arduino" comes from a bar in Ivrea, where some of the founders of the project used to meet. The bar, in turn, has been named after Arduin of Ivrea, who was the margrave of Ivrea and king of Italy from 1002 to 1014. Colombian student Hernando Barragan created the Wiring development platform which served as the basis for Arduino. Following the completion of the Wiring platform, its lighter, less expensive versions were created and made available to the open-source community; associated researchers, including David Cuartielles, promoted the idea. The Arduino's initial core team consisted of Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, and David Mellis. 2.2.3 Why Arduino? There are many other microcontrollers and microcontroller platforms available for physical computing. Parallax Basic Stamp, and many others offer similar functionality. All of these tools take the messy details of microcontroller programming and wrap it up in an easy-to-use package. Arduino also simplifies the process of working with microcontrollers, but it offers some advantage for teachers, students, and interested amateurs over other systems: Inexpensive - Arduino boards are relatively inexpensive compared to other microcontroller platforms. The least expensive version of the Arduino module can be assembled by hand, and even the pre-assembled Arduino modules cost less than $50 Cross-platform - The Arduino software runs on Windows, Macintosh OSX, and Linux operating systems. Most microcontroller systems are limited to Windows. Simple, clear programming environment - The Arduino programming environment is easy-touse for beginners, yet flexible enough for advanced users to take advantage of as well. For teachers, it's conveniently based on the Processing programming environment, so students learning to program in that environment will be familiar with the look and feel of Arduino Open source and extensible software- The Arduino software and is published as open source tools, available for extension by experienced programmers. The language can be expanded through C++ libraries, and people wanting to understand the technical details can make the leap from P a g e 22 | 92

Arduino to the AVR C programming language on which it's based. Similarly, you can add AVRC code directly into your Arduino programs if you want to. Open source and extensible hardware - The Arduino is based on Atmel's ATMEGA8 and ATMEGA168microcontrollers. The plans for the modules are published under a Creative Commons license, so experienced circuit designers can make their own version of the module, extending it and improving it. Even relatively inexperienced users can build the breadboard version of the module in order to understand how it works and save money. 2.2.4 Working in Arduino The Arduino development environment 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. Software written using Arduino is called sketches. It has features for cutting/pasting and for searching/replacing text. The message area gives feedback while saving and exporting and also displays errors. The console displays text output by the Arduino environment including complete error messages and other information. Now let us install the Arduino into our system and start working with it. Follow the following steps to install the Arduino in your computer/laptop: Step1. Install the FTDI driver provided in the CD given to you. To install it simply, unzip the FTDI file and install the driver. It may take from few seconds to even minutes to install depending on the computer and operating systems.

Image no-2.2.3(a) working step1

P a g e 23 | 92

Step2. Open the “Arduino-022” folder and click on the Arduino icon. A window will appear as shown here.

Image no-2.2.3(b) working step2

Step3. Click on Tools from menu bar and select the board, and then select the board as “Arduino NG or older / ATMEGA 168”. Note: Please note that this option can be changed depending on the hardware used by the user. This is just an example of the board which is based on Arduino NG based on ATMEGA 168; hence we have selected this option. Step4. Connect the device with the computer using USB cable. Now we have to select the serial port on which the board will communicate with the computer. Go to Tools->Serial Port->COM X. Here the ‘x, varies from computer to computer. See the image. Note: It is very confusing to select the proper com port. We can check it by inserting and removing the USB cable, the new com generated by inserting the cable should be selected. Although, the Arduino selects the com port automatically, but sometimes we have to select the ports manually.

The proper board has to be selected manually only. The code which goes inside the microcontroller is known as ‘HEX’ code. This code is generated by compilers. P a g e 24 | 92

The process of loading the code into the (flash memory of) microcontrollers is known as ‘Burning’ the microcontroller. There are several methods of burning microcontroller like using ‘ISP’ method, using ‘High Voltage Programming’ using ‘Boot-loaders’ etc. Each method has its own merits and demerits. The easiest way of programming is by using ‘Boot-loaders’. Boot-loaders are small programs residing inside the flash of the microcontrollers. For example in our system, the Boot-loader is there to program the device using serial port (UART). To program using UART interface make sure the device is Boot loaded. The Arduino works on UART interfaced programming. Let us explain more about environment of Arduino. There is a menu bar on the top of the window. All the lists in here are self-explanatory. We will seldom use these lists. Below menu bar, there is a tool bar frequently used in the environment. The icons of tool bar are explained here. Verify: It is used to verify the code, if there is any syntax error then it gets highlighted. If there is no error, then compilation is done. Stop: It is used to stop the verification at any time. New: Used to create a new workspace, but current workspace will be closed. Open: It is used to save any saved sketch. Save: Use to save the current sketch. Upload: Used to upload the sketch into the microcontroller. Any error, warning or notification can be shown in dark black window of the IDE. The development board provided contains all these connections. Hence we never need to make any such connections unless otherwise stated. For each program described further may have different circuit. The circuits are shown if necessary. Now let us start programming. Open the Arduino environment; select the proper com port and board as described earlier. Now, try to compile this code given in figure, it will produce no error. Because it is complete. There are two functions here: 1. void setup() 2. void loop() Before discussing about these, let us know what the ‘function’ is. Function is nothing but a group of statements under a single name.

P a g e 25 | 92

Image no-2.2.3(c) showing the basic syntax of the programm

All these statements are assumed to be executed at once. All the functions start with an opening parentheses (‘{‘) and terminates closing parentheses (‘}’). With and More discussion about ‘function’ is described later in the tutorial. All the lines written under void setup () function will execute only once as the program starts. Hence everything written under this function will execute only once. All the programs written under void loop () function will keep on executing as long as the system is kept on as this function keeps on executing continuously.

P a g e 26 | 92

CHAPTER (3) ARDUINO UNO 3.1 Overview Arduino is an open-source computer hardware and software company, project and user community that designs and manufactures microcontroller-based kits for building digital devices and interactive objects that can sense and control the physical world. The project is based on a family of microcontroller board designs manufactured primarily by Smart Projects

in

Italy,

and

also

by

several

other

vendors,

using

various

8-

bit Atmel AVR microcontrollers or 32-bit Atmel ARM processors. These systems provide sets of digital and analog I/O pins that can be interfaced to various expansion boards ("shields") and other circuits. The boards feature serial communications interfaces, including USB on some models, for loading programs from personal computers. For programming the microcontrollers, the Arduino platform provides an integrated development environment (IDE) based on the Processing project, which includes support for C, C++ and Java programming languages. The first Arduino was introduced in 2005, aiming to provide an inexpensive and easy way for novices and professionals to create devices that interact with

their environment

using sensors and actuators. Common examples of such devices intended for beginner hobbyists include simple robots, thermostats, and motion detectors. Arduino boards are available commercially in preassembled form, or as do-it-yourself kits. The hardware design specifications are openly available, allowing the Arduino boards to be manufactured by anyone. Adafruit Industries estimated in mid-2011 that over 300,000 official Arduinos had been commercially produced, and in 2013 that 700,000 official boards were in users' hands. The Uno is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. You can tinker with your UNO without worrying too much about doing something wrong, worst case scenario you can replace the chip for a few dollars and start over again. "Uno" means one in Italian and was chosen to mark the release of Arduino Software (IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference P a g e 27 | 92

versions of Arduino, now evolved to newer releases. The Uno board is the first in a series of USB Arduino boards, and the reference model for the Arduino platform; for an extensive list of current, past or outdated boards see the Arduino index of boards.

3.2 Pin Diagram

Figure no-3.2 pin diagram of Arduino UNO

Arduino/Genuino Uno is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. You can tinker with your UNO without worrying too much about doing something wrong, worst case scenario you can replace the chip for a few dollars and start over again.

P a g e 28 | 92

3.3 ATmega328 3.3.1 Introduction The computer on one hand is designed to perform all the general purpose tasks on a single machine like you can use a computer to run a software to perform calculations or you can use a computer to store some multimedia file or to access internet through the browser, whereas the microcontrollers are meant to perform only the specific tasks, for e.g., switching the AC off automatically when room temperature drops to a certain defined limit and again turning it ON when temperature rises above the defined limit. There are number of popular families of microcontrollers which are used in different applications as per their capability and feasibility to perform the desired task, most common of these are 8051, AVR and PIC microcontrollers. In this we will introduce you with AVR family of microcontrollers. History of AVR AVR was developed in the year 1996 by Atmel Corporation. The architecture of AVR was developed by Alf-Egil Bogen and Vegard Wollan. AVR derives its name from its developers and stands

for Alf-Egil

Bogen Vegard

Wollan RISC

microcontroller,

also

known

as Advanced Virtual RISC. AVR microcontrollers are available in three categories: 

Tiny AVR – Less memory, small size, suitable only for simpler applications



Mega AVR – These are the most popular ones having good amount of memory (up-to 256 KB), higher number of in-built peripherals and suitable for moderate to complex applications.



Xmega AVR – Used commercially for complex applications, which require large program memory and high speed?

3.3.2 Features 

RISC Architecture with CISC Instruction set



Powerful C and assembly programming P a g e 29 | 92



Scalable



Same powerful AVR microcontroller core



Low power consumption



Both digital and analog input and output interfaces

3.3.3 Pin description The Atmel ATmega48/88/328 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega48/88/328 achieves throughputs approaching 1 MIPS per MHz allowing the system designed to optimize power consumption versus processing speed. The Atmel ATmega48/88/328 provides the following features: 4K/8K/16K bytes of In-System Programmable Flash with Read-While-Write capabilities, 256/512/512 bytes EEPROM, 512/1K/1K bytes SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counters with compare modes, internal and external interrupts, a serial programmable USART, a byte-oriented 2-wire Serial Interface, an SPI serial port, a 6-channel 10bit ADC (8 channels in TQFP and QFN/MLF packages), a programmable Watchdog Timer with internal Oscillator, and five software selectable power saving modes. The Idle mode stops the CPU while allowing the SRAM, Timer/Counters, USART, 2-wire Serial Interface, SPI port, and interrupt system to continue functioning. The Power-down mode saves the register contents but freezes the Oscillator, disabling all other chip functions until the next interrupt or hardware reset. In Power-save mode, the asynchronous timer continues to run, allowing the user to maintain a timer base while the rest of the device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except asynchronous timer and ADC, to minimize switching noise during ADC conversions. In Standby mode, the crystal/resonator Oscillator is running while the rest of the device is sleeping. This allows very fast start-up combined with low power consumption. The ATmega48, ATmega88 and ATmega328 differ only in memory sizes, boot loader support, and interrupt vector sizes. Table 2-1 summarizes the different memory and interrupts vector sizes for the three devices. ATmega88 and ATmega328 support a real Read-While-Write Self-Programming mechanism. There is a separate Boot Loader Section, and the SPM instruction can only execute from there. In P a g e 30 | 92

ATmega48, there is no Read-While-Write support and no separate Boot Loader Section. The SPM instruction can execute from the entire Flash.

Figure no-3.3.3(a) pin description of ATmega 328

The ATmega48PA/88PA/168PA/328P is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture (RISC, or Reduced Instruction Set Computer. is a type of microprocessor architecture that utilizes a small, highly-optimized set of instructions). By executing powerful instructions in a single clock cycle, the ATmega48PA/88PA/168PA/328P achieves throughputs approaching 1 MIPS per MHz allowing the system designed to optimize power consumption versus processing speed. The AVR (Advanced Virtual RISC) core combines a rich instruction set with 32 general purpose working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), P a g e 31 | 92

allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers. The ATmega48PA/88PA/168PA/328P provides the following features: 4/8/16/32K bytes of In System Programmable Flash with Read-WhileWrite capabilities, 256/512/512/1K bytes EEPROM, 512/1K/1K/2K bytes SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counters with compare modes, internal and external interrupts, a serial programmable USART, a byte-oriented 2-wire Serial Interface, an SPI serial port, a 6-channel 10-bit ADC , a programmable Watchdog Timer with internal Oscillator, and five software selectable power saving modes.

Figure no-3.3.3(b) pin diagram of ATmega328

The Idle mode stops the CPU while allowing the SRAM, Timer/Counters, USART, 2-wire Serial Interface, SPI port, and interrupt system to continue functioning. The Power-down mode saves the register contents but freezes the Oscillator, disabling all other chip functions until the next interrupt or hardware reset. In Power-save mode, the asynchronous timer continues to run, allowing the user to maintain a timer base while the rest of the device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except asynchronous timer and ADC, to minimize switching noise during ADC conversions. In Standby mode, the P a g e 32 | 92

crystal/resonator Oscillator is running while the rest of the device is sleeping. This allows very fast start-up combined with low power consumption. The device is manufactured using Atmel’s high density non-volatile memory technology. The Onchip ISP Flash allows the program memory to be reprogrammed In-System through an SPI serial interface, by a conventional non-volatile memory programmer, or by an On-chip Boot program running on the AVR core. The Boot program can use any interface to download the application program in the Application Flash memory. 3.3.4 Comparison among ATmega48PA, ATmega88PA, ATmega168PA and ATmega328P The ATmega48PA, ATmega88PA, ATmega168PA and ATmega328P differ only in memory sizes, boot loader support, and interrupt vector sizes. Table summarizes the different memory and interrupt vector sizes for the three devices. Table: memory summary DEVICE

FLASH

EEPROM

RAM

INTERRUPT SIZE

ATmega48PA

4K Bytes

256 Bytes

512 Bytes

1 instruction word/vector

ATmega88PA

8K Bytes

512 Bytes

1K Bytes

1 instruction word/vector

ATmega168PA

16K Bytes

512 Bytes

1K Bytes

2 instruction word/vector

ATmega328P

32K Bytes

1K Bytes

2K Bytes

2 instruction word/vector

Table no-3.3.4 memory summary of different ATmega microcontroller

3.3.5 Internal Description Power The Arduino/Genuino Uno board can be powered via the USB connection or with an external power supply. The power source is selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in P a g e 33 | 92

the GND and Vin pin headers of the POWER connector. The board can operate on an external supply from 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may become unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts. The power pins are as follows: 

Vin. The input voltage to the Arduino/Genuino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.



5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.



3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.



GND. Ground pins.



IOREF. This pin on the Arduino/Genuino board provides the voltage reference with which the microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power source or enable voltage translators on the outputs to work with the 5V or 3.3V.

Memory The ATmega328 has 32 KB (with 0.5 KB occupied by the bootloader). It also has 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library). Input and Output Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(),digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive 20 mA as recommended operating condition and has an internal pull-up resistor (disconnected by default) of 20-50k ohm. A maximum of 40mA is the value that must not be exceeded on any I/O pin to avoid permanent damage to the microcontroller. P a g e 34 | 92

In addition, some pins have specialized functions: 

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.



External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.



PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.



SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.



LED: 13. There is a built-in LED driven by digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.



TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library.



The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and the analogReference()

function.



There are a couple of other pins on the board:



AREF. Reference voltage for the analog inputs. Used with analogReference().



Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.

3.3.6 Communication Arduino/Genuino Uno has a number of facilities for communicating with a computer, another Arduino/Genuino board, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the board channels this serial communication over USB and appears as a virtual com port to software on the computer. The 16U2 firmware uses the standard USB COM drivers, and no external driver is needed. However, on Windows, a .inf file is required. The Arduino Software (IDE) includes a serial monitor which allows simple textual data to be sent to and from the board. P a g e 35 | 92

The RX and TX LEDs on the board will flash when data is being transmitted via the USB-to-serial chip and USB connection to the computer (but not for serial communication on pins 0 and 1). Table: Arduino Specifications Microcontroller

ATmega328P

Operating Voltage

5V

Input Voltage (recommended)

7-12 V

Input Voltage (limit)

6-20 V

Digital I/O Pins

14 (of which 6 provide PWM Output)

PWM Digital I/O Pins

6

Analog Input Pins

6

DC Current per I/O pin

20 mA

DC Current for 3.3V Pin

50 mA

Flash Memory

32 KB (ATmega 328P) of which 0.5 KB used by bootloader

SRAM

2 KB (ATmega 328P)

EEPROM

1 KB (ATmega328P)

Clock Speed

16 MHz

Length

68.6 mm

Width

53.4 mm

Weight

25 g

Table no-3.3.6 Arduino specification

3.3.7 Processor architecture AVR follows Harvard Architecture format in which the processor is equipped with separate memories and buses for Program and the Data information. Here while an instruction is being executed, the next instruction is pre-fetched from the program memory. P a g e 36 | 92

Figure no-3.3.7(a) process architecture of microcontroller

ALU: The high-performance AVR ALU operates in direct connection with all the 32 general purpose working registers. Within a single clock cycle, arithmetic operations between general purpose registers or between a register and an immediate are executed. The ALU operations are divided into three main categories – arithmetic, logical, and bit-functions. Some implementations of the architecture also provide a powerful multiplier supporting both signed/unsigned multiplication and fractional format. In-system reprogrammable flash program memory: The ATmega48/88/328 contains 4K/8K/16K bytes On-chip In-System Reprogrammable Flash memory for program storage. Since all AVR instructions are 16 or 32 bits wide, the Flash is organized as 2K/4K/8K × 16. For software security, the Flash Program memory space is divided into two sections, Boot Loader Section and Application Program Section in ATmega88 and ATmega328. EEPROM data memory: The Atmel ATmega48 /88/328 contains 256/512/512 bytes of data EEPROM memory. It is organized as a separate data space e, in which single bytes can be read and written. The EEPROM has an endurance of at least 100,000 write/erase cycles. The access P a g e 37 | 92

between the EEPROM and the CPU is described in the following, specifying the EEPROM Address Registers, the EEPROM Data Register, and the EEPROM Control Register. Program counter: A program counter is a register in a computer processor that contains the address (location) of the instruction being executed at the current time. As each instruction gets fetched, the program counter increases its stored value by 1. After each instruction is fetched, the program counter points to the next instruction in the sequence. When the computer restarts or is reset, the program counter normally reverts to 0. In computing, a program is a specific set of ordered operations for a computer to perform. An instruction is an order given to a computer processor by a program. Within a computer, an address is a specific location in memory or storage. A register is one of a small set of data holding places that the processor uses. Program counter is very important feature in the microcontrollers. RAM: RAM stands for random access memory. This type of memory storage is temporary and volatile. You might have heard that if your system is working slowly you say that increase the RAM processing will increase. Let us understand in detail. Let us consider two cases to execute a task first the complete task is execute at one place(A), second the task is distributed in parts and the small tasks are executed at different places(A,B C)and finally assembled. It is clear the work will be finished in second case earlier. The A, B, C basically represent different address allocation for temporary processing. This is the case with RAM also if you increase the RAM the address basically increases for temporary processing so that no data has to wait for its turn. On major importance of the RAM is address allocations. However the storage is temporary every time u boot your system the data is lost but when you turn on the system The BIOS fetch number of addresses available in the RAM. This memory supports read as well as write operations both. Instruction execution section (IES). It has the most important unit—instruction register and instruction decoder to control the flow of the instruction during the processing’s. INPUT/OUTPUT Ports: To interact with the physical environment there are different input and output ports in every system like in PC we have VGA port to connect the monitor, USB port for flash memory connections and many more ports. Similarly ATMEGA 328 has its input and output ports with different configurations depending on the architecture like only input, only output and bi-directional input output ports. The accessing of this port is referred as input output interface design for microcontrollers. IT has analog input port, analog output port, digital input port ,digital output port, serial communication pins, timer execution pins etc. Analog Comparator & A/D converters: The major question is that how a controller manage to detect variation of voltage in-spite it could not understand the voltage but understand only digital sequence Most of the physical quantities around us are continuous. By continuous we mean that the quantity can take any value between two extreme. For example the atmospheric temperature can take any value (within certain range). If an electrical quantity is made to vary directly in proportion to this P a g e 38 | 92

value (temperature etc) then what we have is Analogue signal. Now we have we have brought a physical quantity into electrical domain. The electrical quantity in most case is voltage. To bring this quantity into digital domain we have to convert this into digital form. For this a ADC or analog to digital converter is needed. Most modern MCU including AVRs has an ADC on chip. An ADC converts an input voltage into a number. An ADC has a resolution. A 10 Bit ADC has a range of 0-1023. (2^10=1024) The ADC also has a Reference voltage (ARef). When input voltage is GND the output is 0 and when input voltage is equal to ARef the output is 1023. So the input range is 0-ARef and digital output is 01023.

Figure no-3.3.7(b) variation of input and output voltage of microcontroller

Inbuilt ADC of AVR Now you know the basics of ADC let us see how we can use the inbuilt ADC of AVR MCU. The ADC is multiplexed with PORTA that means the ADC channels are shared with PORTA. The ADC can be operated in single conversion and free running more. In single conversion mode the ADC does the conversion and then stop. While in free it is continuously converting. It does a conversion and then start next conversion immediately after that. ADC Pre-scalar The ADC needs a clock pulse to do its conversion. This clock generated by system clock by dividing it to get smaller frequency. As the system frequency can be set to any value by the user (using internal or externals oscillators) (In board™ a 16MHz crystal is used). So the Pre-scalar is provided to produces acceptable frequency for ADC from any system clock frequency. System clock can be divided by 2, 4,16,32,64,128 by setting the Pre-scalar. ADC Channels The ADC in ATmega328 has 6 channels that mean you can take samples from eight different terminals. You can connect up to 8 different sensors and get their values separately. P a g e 39 | 92

3.3.8 Pin description

Figure no-3.3.8 pin diagram of ATmega 328

3.3.9 Things to remember about ATMEGA328 controllers The ATMEGA controllers are strong controllers but you have to take some small points in mind always like: 



When you go for the programming of atmega328 consider the pin no. as configures in red color in Pin diagram shown before (like controllers pin number 2 is digital pin number 0 for input or output ,pin23 is analog pin A0 ). Sao you will address the pin according to that number. Use the proper pin for proper input output interface that analog input should be configured at analog pin analog output should be configured on PWM pins and likewise the digital inputs and outputs.

P a g e 40 | 92

CHAPTER (4) ARDUINO SOFTWARE 4.1 Arduino IDE The Arduino IDE is a cross-platform application written in Java, and is derived from the IDE for the Processing programming language and the Wiring project. It is designed to introduce programming to artists and other newcomers unfamiliar with software development. It includes a code editor with features such as syntax highlighting, brace matching, and automatic indentation, and is also capable of compiling and uploading programs to the board with a single click. Although building on command-line is possible if required with some third-party tools such as Ino. The Arduino IDE comes with a C/C++ library called "Wiring" (from the project of the same name), which makes many common input/output operations much easier. Arduino programs are written in C/C++, although users only need define two functions to make a run-able program: setup () – a function run once at the start of a program that can initialize settings loop() – a function called repeatedly until the board powers off A typical first program for a microcontroller simply blinks an LED on and off. #define LED_PIN 13 void setup () { pinMode (LED_PIN, OUTPUT);

// enable pin 13 for digital output

} void loop () { digitalWrite (LED_PIN, HIGH); // turn on the LED delay (1000);

// wait one second (1000 milliseconds)

digitalWrite (LED_PIN, LOW); // turn off the LED delay (1000);

// wait one second

}

P a g e 41 | 92

4.1.1 What is IDE? •

The Arduino integrated development environment (IDE) is a cross-platform application written in Java, and derives from the IDE for the Processing programming language and the Wiring projects.



It is designed to introduce programming to artists and other newcomers unfamiliar with software development.



It includes a code editor with features such as syntax highlighting, brace matching, and automatic indentation, and is also capable of compiling and uploading programs to the board with a single click. A program or code written for Arduino is called a "sketch



Arduino programs are written in C or C++. The Arduino IDE comes with a software library called "Wiring" from the original Wiring project, which makes many common input/output operations much easier.



The source code for the IDE is available and released under the GNU General Public License, version 2.

4.2 Serial Communication Used for communication between the Arduino and a computer or other devices. All Arduino boards have at least one serial port (also known as a UART or USART): Serial. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if one use these functions, one cannot also use pins 0 and 1 for digital input or output. One can use the Arduino environment's built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin(). Information passes between the computer and Arduino through USB cable. Information is transmitted as 0’s and 1’s, also known as bits. •

Compiling turns your program into binary data (ones and zeros) P a g e 42 | 92



Uploading sends the bits through USB cable to the Arduino



The two LEDs near the USB connector blink when data is transmitted •

RX blinks when the Arduino is receiving data



TX blinks when the Arduino is transmitting data

Image no-4.2 Transmission and reception of Arduino board

P a g e 43 | 92

CHAPTER (5) GSM TECHNOLOGY AND MODEM 5.1 Introduction 

GSM (Groupe Spéciale Mobile, now named Global System for Mobile Communications) is a 2nd Generation cellular mobile system innovated in Europe by ETSI (European Telecommunications Standardization Institute). It is now a “family name” of a number of systems including 2.5G and 3G systems such as:



PCS (Personal Cellular System/Service) – North American GSM



HSCSD (High-Speed Circuit Switched Data) – GSM with high-speed data by bundling up to four voice equivalent channels



GPRS (General Packet Radio Services) – GSM enhancement in cell-phone software and network hardware and



software to support packet switching (the one used by the Internet)



EDGE (Enhanced Data rates for GSM Evolution) – a technique to achieve better ‘compression’ of data on the air interface



EGPRS (EDGE based GPRS)



UMTS (Universal Mobile Telecommunications Service) – 3G System based on W-CDMA (Wideband Code Division Multiple Access)



HSPA (High Speed Packet Access) – Data speed enhancement for 3G systems



3GSM (3rd



Generation GSM) – new name for 3G systems that are based on GSM technologies

The development of GSM started in 1982 when a study group ‘Group Special Mobile’ was formed during Conference of European Posts and Telegraphs (CEPT) this group was to develop a PanEuropean public cellular system in the 900 MHz range. Some of the basic criteria for their proposed system were: 

Good subjective speech quality



ISDN compatibility



Spectral efficiency



Support for international roaming



Support for range of new services and facilities

In 1989, GSM responsibility was transferred to European Telecommunication Standards Institute (ETSI) and commercial service was started in mid1991. Although GSM was standardized in P a g e 44 | 92

Europe, now it is operational in other continents also. The acronym GSM now aptly stands for Global System for Mobile Communication.

5.2 Cellular mobile system Cellular radio was devised in order to make better use of limited resource of Radio Spectrum. Each Megahertz of spectrum will only support a comparatively a small number of simultaneous conversations and the same frequency must be reused many times in order to meet the capacity needed for national or regional service. So with the development in Political, Commercial and Industrial areas there arose a necessity for uniformity in cellular communication Cellular mobile communication has generations: 1. First generation: Analog radio; mostly telephony only, virtually no data capability other than special device with analog modem. 2. Second Generation: Digital radio and short messaging; this is now the main stream system. Recently a variety of technique has been innovated and employed to enhance data capability of 2G systems. The data capability includes Internet access and picture sharing. These systems are called 2.5G systems. 3. Third Generation: Digital system with multimedia services including video phone and relatively higher speed (say up to 1 Mbps) Internet access. A slow roll off of 3G system has been started in advanced networks of developed and rapidly developing countries. 4. Fourth Generation: Digital system with voice-over-IP (VOIP) technology (Note that the voice for G1, 2 and 3 are circuit-switched). That is, the services are integrated into all IP network. This is expected to be future network and not coming any time soon.

Table no-5.2 cellular mobile sysytem P a g e 45 | 92

5.3 GSM technology One of the most important conclusions from the early tests of the new GSM technology was that the new standard should employ Time Division Multiple Access (TDMA) technology. This ensured the support of major corporate players like Nokia, Ericsson and Siemens, and the flexibility of having access to a broad range of suppliers and the potential to get product faster into the marketplace. After a series of tests, the GSM digital standard was proven to work in 1988. With global coverage goals in mind, being compatible with GSM from day one is a prerequisite for any new system that would add functionality to GSM. As with other 2G systems, GSM handles voice efficiently, but the support for data and Internet applications is limited. A data connection is established in just the same way as for a regular voice call; the user dials in and a circuit-switched connection continues during the entire session. If the user disconnects and wants to re-connect, the dial-in sequence has to be repeated. This issue, coupled with the limitation that users are billed for the time that they are connected, creates a need for packet data for GSM. The digital nature of GSM allows the transmission of data (both synchronous and asynchronous) to or from ISDN terminals, although the most basic service support by GSM is telephony. Speech, which is inherently analog, has to be digitized. The method employed by ISDN, and by current telephone systems for multiplexing voice lines over high-speed trunks and optical fiber lines, is Pulse Coded Modulation (PCM). From the start, planners of GSM wanted to ensure ISDN compatibility in services offered, although the attainment of the standard ISDN bit rate of 64 Kbit/s was difficult to achieve, thereby belying some of the limitations of a radio link. The 64 Kbit/s signal, although simple to implement, contains significant redundancy. Since its inception, GSM was destined to employ digital rather than analog technology and operate in the 900 MHz frequency band.

Most GSM systems operate in the 900 MHz and 1.8 GHz

frequency bands, except in North America where they operate in the 1.9 GHz band. GSM divides up the radio spectrum bandwidth by using a combination of Time- and Frequency Division Multiple Access (TDMA/FDMA) schemes on its 25 MHz wide frequency spectrum, dividing it into 124 carrier frequencies (spaced 200 Khz apart). Each frequency is then divided into eight time slots using TDMA, and one or more carrier frequencies are assigned to each base station. The fundamental unit of time in this TDMA scheme is called a ‘burst period’ and it lasts 15/26 ms (or approx. 0.577 ms). Therefore the eight ‘time slots’ are actually ‘burst periods’, which are grouped into a TDMA frame, which subsequently form the basic unit for the definition of logical channels. The development of standards and systems spans well beyond the technical realm and often into P a g e 46 | 92

the political; this is best exemplified by what happened with GSM. Shortly after the suitability of TDMA for GSM was determined, a political battle erupted over the question of whether to adopt a wide-band or narrow-band TDMA solution. Whereas France and Germany supported a wideband solution, the Scandinavian countries favored a narrow-band alternative. These governmental preferences were clearly a reflection of the respective countries’ domestic equipment manufacturers as German and French manufacturers SEL and Alcatel had invested substantially into wide-band technology, whereas their Scandinavian counterparts Ericsson and Nokia poured resources into the narrow-band alternative. Italy and the UK, in turn, were the subjects of intense lobbying on behalf of the two camps with the result of frequently changing coalitions The culmination of this controversy between the two camps was a CEPT (Conference des Administrations Europeans des Posts et Telecommunications) Meeting in Madeira in February 1987. The Scandinavian countries finally convinced Italy, the UK and a few smaller states of the technical superiority of narrow-band technology and left Germany and France as the only proponents of the wide-band alternative.

Since CEPT followed purely intergovernmental

procedures, however, decisions had to be taken unanimously, and Germany and France were able to veto a decision that would have led to the adoption of narrow-band TDMA as the technology underlying the GSM project. A unique feature of GSM is the Short Message Service (SMS), which has achieved wide popularity as what some have called the unexpected ‘killer application’ of GSM. SMS is a bi-directional service for sending short alphanumeric message in a store-and-forward process. SMS can be used both ‘point-to-point’ as well as in cell-broadcast mode. (Further information in Section 3.5) Supplementary services are provided on top of tele-services or bearer services, and include features such as, inter alia, call forwarding, call waiting, caller identification, three-way conversations, and call-barring. Another of GSM’s most attractive features is the extent to which its network is considered to be secure. All communications, both speech and data, are encrypted to prevent eavesdropping, and GSM subscribers are identified by their Subscriber Identity Module (SIM) card (which holds their identity number and authentication key and algorithm). While the choice of algorithm is the responsibility of individual GSM operators, they all work closely together through the Memorandum of Understanding (MOU) (to be described in greater detail in section 2.2.2) to ensure security of authentication. This smartcard technology minimizes the necessity for owning terminals - as travelers can simply rent GSM phones at the airport and P a g e 47 | 92

insert their SIM card. Since it’s the card rather than the terminal that enables network access, feature access and billing, the user is immediately on-line.

5.4 System architecture The functional architecture of a GSM system can be broadly classified into 

Mobile Station (MS)



Base Station Subsystem (BSS)



Network and Switching Subsystem (NSS)



Operation Subsystem (OSS)

The MS and the BSS communicate via the Um interface or radio link. The BSS communicates with Mobile Service Switching Center across the A interface. 5.4.1 Mobile Station This may be a standalone piece of equipment for certain services or support the connection of external terminals. The MS consists of the Mobile Equipment (ME) and a Subscriber Identity Module (SIM).The ME is uniquely identified by the International Mobile Equipment Identity (IMEI), but it need not be personally assigned to one subscriber, The SIM which is a smart card provides personal mobility and the user can access the subscriber services. The subscriber can operate on any terminal just by inserting the SIM card in that GSM terminal. SIM card contains the International Mobile Subscriber Identity (IMSI) used to identify the subscriber to the system, a secret key for authentication and other security information’s. SIM card may be protected against unauthorized use by a password. 5.4.2 Base Station Subsystem The BSS is composed of three parts, Base Transceiver Station (BTS) and U3ase Station Controller (BSC). These two communicate across the standardized Abis interface. The third part is Transponder and Rate Adaptation Unit (TRAU). 5.4.3 Base Transceiver Station This provides the GSM radio coverage within a cell. It comprises of radio transmitting and receiving equipment and associated signal processing units. This complements the radio features of ME. 5.4.4 Base Station Controller This manages the radio resources for one or more BTS’s. It handles radio channel set-up, Handovers and frequency hopping. Handovers between BTS’s belonging to different BSC’s P a g e 48 | 92

however can involve MSC’s but are still managed by the original serving BSC. It controls the transmission of information about Local Area Codes (LAC), signaling channel configuration and information’s about neighboring cells.

Figure no-5.4.4(a) block diagram of BSC

Figure no-5.4.4(b) block diagram of GSM technology

5.4.5 Trans-coder and Rate Adaptation Unit This is responsible for trans-coding between GSM encoded speech at I 3KPS and fixed network speech at 64KPS. Similarly it performs rate adaptation of GSM data services. Although it is a part of BSS, it is located at MSC Sites. This is to benefit from the lower rate coding and consequent saving in transmission costs.

5.5 Network and switching sub system NSS in GSM uses an Intelligent Network (The central component of NSS is the Mobile Service Switching Center (MSC). It is supported by Interworking functions (JWF), Home Location Register (HLR), Visitor Location Register (VLR), Gateway MSC (GMSC) and Signal Transfer Point (STP). P a g e 49 | 92

5.5.1 Mobile Service Switching Center It acts like a switching node and additionally provides all the functionality needed to handle a mobile subscriber such as registration, authentication, and location updating. Handovers and call routing to a roaming subscribe. These functions are provided in conjunction with several functional entities. An MSC controls several BSC’s. 5.5.2 Inter Working Function, (IWF) A gateway for MSC to interface with external networks for communications with users outside GSM. The role of IWF depends upon the type of user data and the network to which it interfaces. 5.5.3 Home Location Register, (HLR) It consists of a computer without switching capabilities. It is a database, which contains subscriber information related to the subscriber’s current locations but not the actual location. HLR has two divisions Authentication Center (AuC) and Equipment Identity Register (EIR). The AuC manages the security data for subscriber authentication. The EIR database carry information about certain ME’s. The security procedure is discussed later. 5.5.4 Visitor Location Register, (VLR) It links to one or more MSC’s, temporarily storing subscription data currently served by its corresponding MSC. VLR holds more current subscriber location than l—ILR. Although VLR is an independent unit, it is always implemented together with the MSC. 5.5.5 Gateway MSC (GMSC) In order to set-up a requested call, the call is initially routed to a GMSC which finds the correct HLR.GMSC has an interface with external network for gate -waying and the network operates the full signaling system 7 (SS7) between NSS Machines. 5.5.6 Signaling Transfer Point It acts as a standalone node to optimize the cost of the signaling transport among MSC/VLR, GMSC and HLR>

5.6 More points 5.6.1 Operating subsystem: There are three area of OSS 

Network operation and maintenance function.



Subscription management including charging and billing.



Mobile Equipment and Management. P a g e 50 | 92

5.6.2 Layer modeling 

Transmission



Radio resource management



Mobility management



Communication management



Operation, administration and maintenance

5.6.3 Radio link aspects The International Telecommunication Union (ITU) which manages Allocation of radio spectrum has allocated the bands 890-915MHz for the uplink (MS to BS) and 960MHz for the downlink (BS to MS) for mobile networks. 5.6.4 Multiple access and channel structure Due to the scarcity of radio spectrum, a method must be devised to divide bandwidth among as many users as possible. GSM uses a combination of FDMA TDMA. FDMA part involves the division by frequency of the 25M1-lz bandwidth into carrier frequencies of 200 KHz bandwidth. One or more carrier frequencies is then divided in time using TDMA scheme. 5.6.5 Traffic channels This is also called physical channel. This is used to carry speech and data traffic: They are of three kinds 

TCH/F (full rate): Transmits the speech code of 13 KBPS or Three data mode 12, 6 and 3.6 1KBPS.



TCIH/H(half rate):Transmits the speech code of 7 1KBPS or Two data modes 6 3.6 1KBPS



TCI-118(1/8th rate): Used for low rate signaling channels, Common channels and channels. They are also called Stand Alone Dedicated Control Channel(SDCCH)

5.6.6 Cell selection Using the best cell from an MS depends on three factors 

The level of signal received by the MS.



The maximum transmission power of the MS.



Two parameters P1 and P2 specified by the cell

C1

=

A-max (B, 0)

A

=

received level average-P 1

B

=

P2-Max RF power of the MS. P a g e 51 | 92

P1

=

A value between —110 and —48dBm

P2

=

A value between 13 and 43dBm

Call selection algorithm is as follows 

The SIM must be inserted



The strongest Cl is chosen by obtaining Cl from the candidate cells. All cells must not be barred from service

P a g e 52 | 92

CHAPTER (6) SERVO MOTOR 6.1 Introduction A servomotor is a rotary actuator that allows for precise control of angular position. It consists of a motor coupled to a sensor for position feedback, through a reduction gearbox. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servomotors.

Figure no-6.1(a) block diagram of servo motor

The electric motor and the servomechanism both serve as fundamental building blocks for modern mechanical equipment’s and advance technological instruments. An electric motor is a device that uses electrical energy to produce mechanical energy. A servomechanism, or servo, differs from a motor in that it automatically corrects its performance using error-sensing feedback. A servo is typically implemented with an electric motor as the source of mechanical force.

Image no-6.1 block diagram of BSC

Servomotors are designed to operate control surfaces. So they do not rotate continuously. Rather they are designed to rotate through 180 degrees with precise position control. If you want to use them as the main drive motor for a mobile robot you need to modify them so that they will rotate continuously. They do not simply run on a DC voltage like a standard DC motor. They have 3 wires. Red is power (generally 3V – 12V max), black is ground and then there is another wire, usually white or yellow that is the “input signal wire”. P a g e 53 | 92

6.2 Commercial application Electric motors are inexpensive, easy-to-use, and most importantly, a convenient source of mechanical force. They also allow delicate and precise movements, which grant them to play a part in applications involving systems and controls. Electric motors can be found in household appliances such as fans, refrigerators, washing machines, floor vacuums, hair dryers, and electric heaters. Depending on the power output and the size of a particular motor, the cost ranges from a few to several thousand US dollars. Due to the simplicity of their construction and their generic nature, production of electric motors is inclusive to almost any electrical manufacturer. Servos, on the other hand, can be a bit more expensive because they incorporate performance adjustment capabilities on top of providing mechanical force. The automatic correction feature requires feedback circuits to actively monitoring the performance parameters such as speed, in cruise control, and position, in navigation systems. In complex cases, software manipulation of the mechanism is needed. Some of the highly advanced applications of servomechanism include: automatic machine tools, satellite-tracking antennas, and automatic security systems.

6.3 Types Servo motors are special category of motors, designed for applications involving position control, velocity control and torque control. These motors are special in the following ways: 1. Lower mechanical time constant. 2. Lower electrical time constant. 3. Permanent magnet of high flux density to generate the field. 4. Fail-safe electro-mechanical brakes. For applications where the load is to be rapidly accelerated or decelerated frequently, the electrical and mechanical time constants of the motor plays an important role. The mechanical time constants in these motors are reduced by reducing the rotor inertia. Hence the rotors of these motors have an elongated structure.

6.4 Principle of operation Servo motors are used in closed loop control systems in which work is the control variable. Servo motors feature a motion profile, which is a set of instructions programmed into the controller that defines the servo motor operation in terms of time, position, and velocity. P a g e 54 | 92

Figure no-6.4(a) principle of operation of servo motor

The servo motor controller directs operation of the motor by sending velocity command signals to the amplifier that drives the servo motor. The servo compares its position and velocity feedbacks to its programmed motion profiles and adjusts the motor velocity accordingly. A servomotor is controlled by sending a pulse signal that is HIGH for a brief time, generally 1 – 2 ms. If you just connect a battery to power and ground, nothing will happen. You must have a timer circuit that generates this pulsed signal and by varying the pulse ON time (or the pulse width) the motor will move to a certain position over its range of motion and then stop as long as the input pulse width is the same. Depending on the pulse width, you’ll get a different position. This diagram shows some control signal pulses for a typical servo and the position to which it will rotate in response to the pulse width.

Figure no-6.4(b) principle of operation sending of high pulse at every 20 ms

There is another element to the signal that also requires timing accuracy. The frequency of the signal or its rate of refresh. Not only do you have to send the pulse, you have to keep sending them as long as you want the motor to be in that position (or to keep rotating for modified servos). Generally a frequency of 50 Hz is good. This means that you send the high pulse 50 times every second. A servo will only rotate through 180 degrees unless you modify it for continuous rotation. One P a g e 55 | 92

interesting thing that comes out this modification is that you get a speed control function out of it, though somewhat coarse. When you make the modification you replace the circuitry in the motor that tells the motor what position it is in. The modes you make tell the motor that it is always in the center position. So if you feed a 1.75 ms pulse, it rotates to the 180 degree position, checks the feedback which tells it that “hey, you haven’t moved yet. You’re still in the center position, keep going” so it does, checks and sees that it hasn’t moved yet and keeps doing it. Since it thinks that it is in center position and it has to move to its right most position it will move at its fastest rate. Now suppose you send it a signal that says to rotate to 95 degrees, 5 degrees right of center. The internal control system knows that it is now to move a very short distance. It also knows that if it rotates at its fastest speed that it may overshoot this and has to come back, and overshoot again in the other direction and try again, and so forth. This is called oscillation and is not a good thing. The advantage that you get out of this is that the motor will move slower when you feed a signal that is close to the center position. So you feed it a “go to 95 degree” signal and it will rotate CW at a slow rate. Give it “go to 180 degrees” and it will rotate CW at its fastest rate and the same for CCW.

6.5 Application 

Used in RC plane design



Fixed angle motion

P a g e 56 | 92

CHAPTER (7) PIR SENSOR 7.1 Introduction The PIR (Passive Infra-Red) Sensor is a pyro electric device that detects motion by measuring changes in the infrared (heat) levels emitted by surrounding objects. When motion is detected the PIR sensor outputs a high signal on its output pin. This logic signal can be read by a microcontroller or used to drive an external load.

Figure no-7.1(a) PIR sensor



Longer detection range, selectable by onboard jumper



Wider supply voltage, from 3 to 6 VDC



Higher output current provides for direct control of an external load



Mounting holes included for permanent projects



All parts SMT

PIR sensors allow you to sense motion, almost always used to detect whether a human has moved in or out of the sensors range. They are small, inexpensive, low-power, easy to use and don't wear out.

Figure no-7.1(b) Pcb of PIR sensor

They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors.PIRs are basically made of a pyroelectric sensor (which you can see above as the round metal can with a rectangular crystal in the center), which can detect levels of infrared radiation. Everything emits P a g e 57 | 92

some low level radiation, and the hotter something is, the more radiation is emitted. The sensor in a motion detector is actually split in two halves. The reason for that is that we are looking to detect motion (change) not average IR levels. The two halves are wired up so that they cancel each other out. If one half sees more or less IR radiation than the other, the output will swing high or low.

7.2 How it works The PIR sensor itself has two slots in it; each slot is made of a special material that is sensitive to IR. The lens used here is not really doing much and so we see that the two slots can 'see' out past some distance (basically the sensitivity of the sensor). When the sensor is idle, both slots detect the same amount of IR, the ambient amount radiated from the room or walls or outdoors. When warm bodies like a human or animal passes by the sensor, it first intercepts one half of the PIR sensor, which causes a positive differential change between the two halves. When the warm body leaves the sensing area, the reverse happens, whereby the sensor generates a negative differential change. These change pulses are what is detected.

Figure no-7.2 Working of PIR sensor

7.3 Technical data 

Power requirements: 3 to 6 VDC; 12 mA @ 3 V, 23 mA @ 5 V



Communication: Single bit high/low output



Dimensions: 1.41 x 1.0 x 0.8 in (35.8 x 25.4 x 20.3 cm) P a g e 58 | 92



Operating temp range: 32 to 122 °F (0 to 50 °C)

7.4 Application 

Motion-activated nightlight



Alarm systems



Holiday animated props



Motion based security system

P a g e 59 | 92

CHAPTER (8) COMPONENTS 8.1 Capacitor 8.1.1 Introduction The capacitor's function is to store electricity, or electrical energy. The capacitor also functions as a filter, passing alternating current (AC), and blocking direct current (DC). This symbol (

)is

used to indicate a capacitor in a circuit diagram. The capacitor is constructed with two electrode plates facing each other but separated by an insulator. When DC voltage is applied to the capacitor, an electric charge is stored on each electrode. While the capacitor is charging up, current flows. The current will stop flowing when the capacitor has fully charged. 8.1.2 Actual Capacitance This is a measure of a capacitor’s ability to store charge. A large capacitance means that more charge can be stored. It is measured in farad, F. 1F is very large, so prefixes are used to show the smaller values. Three prefixes are used, u (micron), n (Nano), and p (Pico). 1uf=10-6 f 1nf=10-9 f 1pf=10-12 f Sometimes, a three-digit code is used to indicate the value of a capacitor. There are two ways in which the capacitance can be written one uses letters and numbers, the other uses only numbers. In either case, there are only three characters used. [10n] and [103] denote the same value of capacitance. The method used differs depending on the capacitor supplier. In the case that the value is displayed with the three-digit code, the 1st and 2nd digits from the left show the 1st figure and the 2nd figure, and the 3rd digit is a multiplier which determines how many zeros are to be added to the capacitance. Pico farad (pF) units are written this way. For example, when the code is [103], it indicates 10 x 103, or 10,000pF = 10 nano-farad (nF) = 0.01 microfarad (µF). If the code happened to be [224], it would be 22 x 104 = or 220,000pF = 220nF = 0.22µF. Values under 100pF are displayed with 2 digits only. For example, 47 would be 47pF. The capacitor has an insulator (the dielectric) between 2 sheets of electrodes. Different kinds of capacitors use different materials for the dielectric. P a g e 60 | 92

8.1.3 Breakdown voltage When using a capacitor, you must pay attention to the maximum voltage which can be used. This is the "breakdown voltage." The breakdown voltage depends on the kind of capacitor being used. You must be especially careful with electrolytic capacitors because the breakdown voltage is comparatively low. The breakdown voltage of electrolytic capacitors is displayed as Working Voltage. The breakdown voltage is the voltage that when exceeded will cause the dielectric (insulator) inside the capacitor to break down and conduct. When this happens, the failure can be catastrophic. 8.1.4 Types of Capacitors There are various types of capacitors available in the market. Some of them are as follows: 

Mica Capacitor



Paper Capacitor



Ceramic Capacitor



Variable Capacitor



Electrolytic Capacitor



Tantalum Capacitor



Film Capacitor

Here we used only two types of capacitor i.e. ceramic capacitor & electrolytic capacitor. 1. Polarized capacitors 2. Un-polarized capacitors

1. Polarized Capacitors: These are the capacitors having polarity. Basically these are of larger values than 1uf. For example below is the diagram of capacitor of 220 microfarad and having breakdown voltage 25V.

Image no-8.1.4(a) Picture of polarize capacitors

2. Un-polarized Capacitors (small values, up to 1µF) Small value capacitors are un-polarized and may be connected either way round. They are not damaged by heat when soldering, except for one unusual type (polystyrene). They have high P a g e 61 | 92

voltage ratings of at least 50V, usually 250V or so. It can be difficult to find the values of these small capacitors because there are many types of them and several different labeling systems.

Image no-8.1.4(b) Picture of un-polarize capacitors

For example 0.1 means 0.1µF = 100nF. Sometimes the multiplier is used in place of the decimal point: For example: 4n7 means 4.7nF. 8.1.5 Variable Capacitors Variable capacitors are mostly used in radio tuning circuits and they are sometimes called 'tuning capacitors'. They have very small capacitance values, typically between 100pF and 500pF (100pF = 0.0001µF).

Image no-8.1.5 Picture of variable capacitors

8.1.6 Methods of Making Capacitors: One way of making capacitors is to use the two poly-silicon layers in our process. We create a parallel plate capacitor with poly1 and poly2 (“electrode”) forming the two parallel sides. The silicon dioxide between the two poly layers is thin enough to yield good capacitance values per unit area. This is called a poly-poly capacitor. The other way would be to use the gate oxide and actually build a transistor whose gate area (W x L) would actually give us the capacitance. These are called MOS capacitors, and they only work properly when the transistor is strongly inverted or depleted. Otherwise, the capacitance can vary with the voltage across it.

8.2 LCD 8.2.1 Introduction LCD (Liquid Crystal Display) 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. The reasons being: LCDs are economical; easily programmable; P a g e 62 | 92

have no limitation of displaying special & even custom characters (unlike in seven segments), animations and so on. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. Features:

5 x 8 dots with cursor



Built-in controller (KS 066 or Equivalent)



+ 5V power supply (Also available for + 3V)



1/16 duty cycle



B/L to be driven by pin 1, pin 2 or pin 15, pin 16 or A.K (LED)



N.V. optional for + 3V power supply

8.2.2 Pin description:

Table no-8.2.2 Pin description of 16x2 LCD display

8.2.3 Sequence of writing to the LCD 1. The sequence for writing to the LCD is: 2. To begin, E is low 3. Select the register to write to by setting RS high (data) or low (control) 4. Write the eight bits of data to the LCD 5. Set the Enable signal high then low again. P a g e 63 | 92

There are certain minimum timing requirements that must be followed when writing to the LCD, such as data setup times and Enable signal pulse width. These are in the order of tens and hundreds of nanoseconds. LCD displays have a ‘busy’ flag that is set while it is executing a control command. This flag is not accessible because the R/W line has been tied low (write). This is not such a problem because all commands have a maximum execution time. We simply wait for this time to pass before accessing the LCD again, eliminating the need to check the flag and thereby saving on an I/O line. For example: The ‘Clear Display’ command has an execution time of approx. 1.6mS. The amount of RAM available depends on the type of LCD. Let’s us consider a LCD having 80 bytes of RAM. An internal address counter holds the address of the next byte to write to. These 80 bytes are broken up into two blocks of 40 bytes. The address range of the first block is from 00h to 27h and the second block from 40h to 67h. After power up and initialization address 00h is the first character of the top line and address 40h is the first character of the bottom line. The address counter is set to address 00h and is automatically incremented after each byte is written. Only the first 16 bytes of each line are visible. If we now start writing data to the LCD it will be stored from address 00h on but only the first 16 characters will be visible. To display the rest of the characters we need to ‘scroll’ the display. Scrolling simply mean changing the start address of each line. The address ranges of each block are not continuous. There is a gap of 24 bytes between the ends of the first block (27h) and the start of the second (40h). So, if we keep writing characters to the display the first 40 will be stored in addresses 00h to 27h, the next 24 will be ‘lost’ and the next 40 will be stored at addresses 40h to 67h. The internal address counter is directly accessible so we can set the next address to write to. This is how the characters are written to the second line of the LCD. For example, we can send 5 characters to the first line, set the address counter to 40h and then start writing characters to the second line. 8.2.4 LCD interface diagram: Above is the connection diagram of LCD in 4-bit mode, where we only need 6 pins to interface an LCD. D4-D7 is the data pins connection and Enable and Register select are for LCD control pins. We are not using Read/Write (RW) Pin of the LCD, as we are only writing on the LCD so we have made it grounded permanently. Potentiometer RV1 is used to control the LCD contrast. The unwanted data pins of LCD i.e. D0-D3 are connected to ground.

P a g e 64 | 92

Figure no-8.2.4 LCD interfacing diagram

8.3 LED 8.3.1 Introduction When a light-emitting diode is forward-biased (switched on), electrons are able to recombine with electron holes within the device, releasing energy in the form of photons. This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy gap of the semiconductor. A LED is often small in area (less than 1 mm2), and integrated optical components may be used to shape its radiation pattern. LEDs present many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved physical robustness, smaller size, and faster switching.

Image no-8.3.1 Picture of LED

A light-emitting diode (LED) is a semiconductor light source. Appearing as practical electronic components early LEDs emitted low-intensity red light, but modern versions are available across the visible, ultraviolet, and infrared wavelengths, with very high brightness. P a g e 65 | 92

Figure no-8.3.1(a) Schematics diagram of LED

Light-emitting diodes are used in applications as diverse as aviation lighting, automotive lighting, advertising, general lighting, and traffic signals. LEDs have allowed new text, video displays, and sensors to be developed, while their high switching rates are also useful in advanced communications technology. Infrared LEDs are also used in the remote control units of many commercial products including televisions, DVD players and other domestic appliances.

Figure no-8.3.1(b) LED

8.3.2 Applications In general, all the LED products can be divided into two major parts, the public lighting and indoor lighting. LED uses fall into four major categories: 

Visual signals where light goes more or less directly from the source to the human eye, to convey a message or meaning.



Illumination where light is reflected from objects to give visual response of these objects.



Measuring and interacting with processes involving no human vision.



Narrow band light sensors where LEDs operate in a reverse-bias mode and respond to incident light, instead of emitting light.

8.3.3 LED specifications

Table no-8.3.3 Specification of LED P a g e 66 | 92

The terminal identification of the LED can be done by the three methods:

Image no-8.3.3 Identification of LED terminals

1. Check the biasing through multi-meter. In forward bias the Led will glow that is positive connected to the positive (anode) and negative connected o the negative that is (cathode) 2. The big terminal is anode (+) and the small leg is cathode (-). 3. Third way is to check the upper surface of the LED the flat surface is always cathode and the spherical surface is cylindrical.

P a g e 67 | 92

CHAPTER (9) ACCESSORIES 9.1 Adapters The adapters are the device that has inbuilt circuitry for converting the 230V AC in to desired DC like +5V adapter, +12V adapter, +9V adapter and many more. This consists of inbuilt circuit for HIGH AC to low voltage DC conversion.

9.2 Dip Bases The case outlines of the plastic and ceramic Dual In-line Packages (DIPs) are nearly identical. The lead configuration consists of two rows of leads, both with 100 mil pitch. The plastic DIP is shown in Figure. If the DIP base is of 18 pin then 9 lines will be in one side and 9 on other side. The IC bases of have round cut from the left of which the pin 1 of base is considered similar is the case with integrated chips. Basically IC is sensitive to short circuit or voltage so in place of that we first install the bases of the IC with same number of pins and before placing the IC’s we check all voltage points of the IC then mount the IC once proper configuration is assured. The DIP base depends on number of pins of the IC and ranges from 4pin configuration to 40 pin configuration. They are available in different pin configuration and size depending on IC need.

9.3 Power Jack Power Jack is basically a connector to connect the adapter output to the board directly. It has the proper connection designed to connect with the adapter as well as out connection to connect to the board. It has three terminals output 1 Vcc, 2 GND and 3 No connection.

9.4 Switches In electrical engineering, a switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another. The most familiar form of switch is a manually operated electromechanical device with one or more sets of electrical contacts, which are connected to external circuits. P a g e 68 | 92

Each set of contacts can be in one of two states: either "closed" meaning the contacts are touching and electricity can flow between them, or "open", meaning the contacts are separated and the switch is non-conducting. The mechanism actuating the transition between these two states (open or closed) can be either a "toggle" (flip switch for continuous "on" or "off") or "momentary" (pushfor "on" or push-for "off") type. There are varying types of switches:

Micro-Switch: This is small switch for interconnection. It has 4 terminals with 2 in pair already connected .when you press the switch all four get connected.

Power Switch: This is 6 terminal switches for bidirectional connectivity on press

Toggle Switch: A toggle switch is a class of electrical switches that are manually actuated by a mechanical lever, handle, or rocking mechanism. This is a two state switch that is not connected, and connected. It remains in the state till not forced again to change the state.

DPDT Switch: A DPDT switch is a class of electrical switches that are manually actuated by a mechanical rocking mechanism. This is a three state switch that is not connected, connected to one and connected to second. It remains in the state till forced in that particular state els4e goes to normal state.

DIP Switches: These are combination of multiple small switches in one package to put on/off multiple channels in circuitry. A DIP switch is a manual electric switch that is packaged with others in a group in a standard dual in-line package (DIP). The term may refer to each individual switch, or to the unit as a whole. This type of switch is designed to be used on a printed circuit board along with other electronic components and is commonly used to customize the behavior of an electronic device for specific situations.DIP switches are an alternative to jumper blocks. Their main advantages are that they are quicker to change and there are no parts to lose. These are available in different configuration for example 8 pin configurations, 16 pin configuration and many more. P a g e 69 | 92

9.5 Connectors Connectors are wire connection and interface to connect two different points. It has different configuration like 2- pin connector, 3 -pin connector, 4- pin connector and many more

Male connector: These have metallic rods for the connection

Female connector: These have holes

9.6 Berge Strip Berge strip is also type of connector. It is of two types male or female. This is also used for making electrical connections to mount some components. The come in different packages and dimensions. Depending upon the need they can be purchased. These are used for mounting certain modules, LCD etc.

9.7 DC connectors A DC connector (or DC plug, for one common type of connector) is an electrical connector for supplying direct current (DC) power. Compared to domestic AC power plugs and sockets, DC connectors have many more standard types that are not interchangeable. The dimensions and arrangement of DC connectors can be chosen to prevent accidental interconnection of incompatible sources and loads. Types vary from small coaxial connectors used to power portable electronic devices from AC adapters, to connectors used for automotive accessories and for battery packs in portable equipment.

P a g e 70 | 92

CHAPTER (10) SOURCE CODE #include <Servo.h> #include #include #include #include <EEPROM.h> #define led_pin 13 #define pir1 11 #define pir2 12 #define servoPin 10 const byte ROWS = 4; //four rows const byte COLS = 4; //four columns //define the cymbols on the buttons of the keypads char hexaKeys[ROWS][COLS] = { {'D', '#', '0', '*'}, {'C', '9', '8', '7'}, {'B', '6', '5', '4'}, {'A', '3', '2', '1'} }; byte colPins[COLS] = {2, 3, 4, 5}; //connect to the row pinouts of the keypad byte rowPins[ROWS] = {6, 7, 8, 9}; Servo myservo; Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); LiquidCrystal lcd(14, 15, 16, 17, 18, 19); boolean data = false; char sms[50]; byte sms_length = 0; int user = -1; byte temp_mob[10]; String sms2send = "Your Number has been Registered"; boolean previousState = false; P a g e 71 | 92

void setup() { myservo.attach(servoPin); pinMode(led_pin, OUTPUT); // pin configurations lcd.begin(16, 2); // lcd initialization lcd.print("GSM Based System"); Serial.begin(9600); // serial communication init byte s = search_modem(); // search for modem to be connected. blocking if (s > 0) s = configure_modem(); // configure the modem else { lcd.clear(); lcd.print("Cofiguration Failed"); lcd.setCursor(0, 1); lcd.print("Please Reset"); while (1); }

if (s > 0) { s = del_sms(); // keep the location 1 clear. } else { lcd.clear(); lcd.print("Insert SIM and"); lcd.setCursor(0, 1); lcd.print("Restart"); while (1); } lcd.clear(); P a g e 72 | 92

lcd.print("GSM Based System"); indicate(100); if (EEPROM.read(0) != 0) // if not registered yet then the default number should be... { //Serial.println("Number not registered yet"); EEPROM.write(1, '9'); //default number can be changed to any other number EEPROM.write(2, '6'); EEPROM.write(3, '9'); EEPROM.write(4, '6'); EEPROM.write(5, '3'); EEPROM.write(6, '6'); EEPROM.write(7, '4'); EEPROM.write(8, '9'); EEPROM.write(9, '0'); EEPROM.write(10, '5'); EEPROM.write(50, '0'); // set initial password as 0000 EEPROM.write(51, '0'); EEPROM.write(52, '0'); EEPROM.write(53, '0'); } } char customKey; void loop() { if (Serial.available() > 2) // check for any sms arrival { indicate(1000); int k = check_sms(); if (k == 1) k = read_sms(); if (k == 1) k = del_sms(); // clear the location for next sms to arrive P a g e 73 | 92

} else // other operations { customKey = customKeypad.getKey(); if (customKey) { int v = checkPassword(); if (v) { lcd.clear(); lcd.print("A: change PSW"); lcd.setCursor(0, 1); lcd.print("B: to configure"); while ((customKey != 'A') && (customKey != 'B')) { customKey = customKeypad.getKey(); } if (customKey == 'A') { changePassword(); } if (customKey == 'B') { configure(); } } else { lcd.clear(); lcd.print("Invalid Password"); } } if (EEPROM.read(100) == 1) P a g e 74 | 92

{ if (digitalRead(pir1) == 1) { myservo.write(0); lcd.clear(); lcd.print("Motion in Room1"); delay(1000); sms2send = "Motion in Room 1"; send_sms(); delay(10000); } } if (EEPROM.read(101) == 1) { if (digitalRead(pir2) == 1) { myservo.write(180); lcd.clear(); lcd.print("Motion in Room 2"); delay(1000); sms2send = "Motion in Room 2"; send_sms(); delay(10000); } } lcd.clear(); lcd.print("GSM Based System"); delay(100); } } void configure() { P a g e 75 | 92

lcd.clear(); lcd.print("A/B: ACT/DACT 1"); lcd.setCursor(0, 1); lcd.print("C/D: ACT/DACT 2"); delay(2000); customKey = '0'; while ((customKey != 'A') && (customKey != 'B') && (customKey != 'C') && (customKey != 'D')) { customKey = customKeypad.getKey(); } if (customKey == 'A') { EEPROM.write(100, 1); lcd.clear(); lcd.print("1 activated"); delay(1000); } if (customKey == 'B') { EEPROM.write(100, 0); lcd.clear(); lcd.print("1 dectivated"); delay(1000); } if (customKey == 'C') { EEPROM.write(101, 1); lcd.clear(); lcd.print("2 activated"); delay(1000); } if (customKey == 'D') { EEPROM.write(101, 0); lcd.clear(); P a g e 76 | 92

lcd.print("2 dectivated"); delay(1000); } } int changePassword() { char value[4]; int n = 0; lcd.clear(); lcd.print("Enter new PSW"); lcd.setCursor(0, 1); while (1) { char customKey = customKeypad.getKey(); if (customKey) { value[n] = customKey; lcd.print('*'); n++; if (n == 4) { EEPROM.write(50, value[0]); EEPROM.write(51, value[1]); EEPROM.write(52, value[2]); EEPROM.write(53, value[3]); lcd.print("->"); lcd.print(value[0]); lcd.print(value[1]); lcd.print(value[2]); lcd.print(value[3]); delay(1000); return 1; } P a g e 77 | 92

} } } int checkPassword() // return 1 for master 2 for slave and 0 for none { char value[4]; int n = 0; lcd.clear(); lcd.print("Enter password"); lcd.setCursor(0, 1); while (1) { char customKey = customKeypad.getKey(); if (customKey) { value[n] = customKey; lcd.print(value[n]); //lcd.print('*'); n++; if (n == 4) { if ( (value[0] == EEPROM.read(50)) && (value[1] == EEPROM.read(51)) && (value[2] == EEPROM.read(52)) && (value[3] == EEPROM.read(53))) { lcd.print("matched"); delay(1000); return 1; } else { return 0; } P a g e 78 | 92

} } } } byte search_modem() // will keep on searching for modem unless it is found { //Serial.println("Searching the Modem"); lcd.clear(); lcd.print(" Testing modem...."); lcd.setCursor(0, 1); char ch[50]; int n = 0; Serial.println("AT"); // activate the modem delay(100); Serial.println("AT"); // activate the modem Serial.println("AT"); // activate the modem delay(100); while (1) { if (Serial.available()) { ch[n] = Serial.read(); if ((ch[n - 1] == 'O') && (ch[n] == 'K')) //ok if modem is there { lcd.print("Testing Done..."); return 1; } n++; if (n > 40) n = 0; } else { P a g e 79 | 92

lcd.clear(); lcd.print("Connect Modem"); lcd.setCursor(0, 1); Serial.println("AT"); // activate the modem delay(1000); } } }// search ends byte configure_modem() // initial configuration of modem { char ch[50]; int n = 0; lcd.clear(); lcd.print("Configuring Modem...."); Serial.println("AT"); delay(10); Serial.println("ATE0"); // turn off echo delay(500); Serial.println("ATE0"); // turn off echo delay(500); Serial.println("ATE0"); // turn off echo delay(500); Serial.println("ATE0"); // turn off echo delay(500); Serial.println("AT+CMGF=1"); //set the sms format as text delay(500); Serial.println("AT+CNMI=2,1,0,0,1"); // indicates the arrival of sms delay(1000); Serial.flush(); Serial.println("AT"); while (1) { P a g e 80 | 92

if (Serial.available()) { ch[n] = Serial.read(); if ((ch[n - 1] == 'O') && (ch[n] == 'K')) //ok if modem is there { lcd.clear(); lcd.print("Cofigured....."); return 1; } n++;

if (n > 40) n = 0; } else { n = 0; lcd.clear(); lcd.print("Confi Failed.."); lcd.setCursor(0, 1); lcd.print("Please Reset"); } } } int check_sms() { char ch[20]; int n = 0; byte flag = 0; // indicates the arrival of sms if (Serial.available()) { delay(1000);// wait for all serial data to arrive. P a g e 81 | 92

while (Serial.available()) // read all serial data. { ch[n] = Serial.read(); if ((ch[n - 3] == 'C') && (ch[n - 2] == 'M') && (ch[n - 1] == 'T') && (ch[n] == 'I')) { flag = 1; lcd.clear(); lcd.print("SMS Arrived"); } n++; if (n > 19) n = 0; } if (flag == 1) return 1; else { Serial.flush(); // clear unuseful data return 0; } } } byte read_sms() { char ch[100]; int n = 0; int m = 0; int digit = 0; byte temp = 0; // to read the sms byte temp1 = 0; // to read the mobile number lcd.clear(); lcd.print("Reading SMS...."); P a g e 82 | 92

lcd.setCursor(0, 1); Serial.println("AT+CMGR=1"); // command to read the sms at loction 1 while (1) { if (Serial.available()) { ch[n] = Serial.read(); // //Serial.print(ch[n]); if ((ch[n - 1] == 'O') && (ch[n] == 'K')) // successful reading of SMS { for (int i = 0; i <= n; i++) // extract sms part { if (temp1 == 2) // + sign arrives with second + sign { temp_mob[digit] = ch[i + 2]; // digits after +91 digit++; if (digit == 10) temp1 = 0; // reading of mobile number finished } if (ch[i] == '*') // terminating character stop reading { temp = 0; sms_length = m - 1; } if (temp == 1) // store sms part in sms variable { sms[m] = ch[i]; m++; } if (ch[i] == '#') //starting character start reading temp = 1;

P a g e 83 | 92

if (ch[i] == '+') // mobile number starts with +91 temp1++; }// end of for loop //Serial.print("mobile number "); for (int i = 0; i <= 9; i++) { //Serial.print(char(temp_mob[i])); } register_user(); //function to register the user. lcd.print("Reading Successful.."); return 1; } n++; if (n >= 100) n = 0; } } } byte del_sms() { char ch[20]; int n = 0; lcd.clear(); lcd.print("Removing SMS.."); lcd.setCursor(0, 1); Serial.println("AT+CMGD=1"); // command to delete the sms at loction 1 while (1) { if (Serial.available()) { delay(1000); while (Serial.available()) P a g e 84 | 92

{ ch[n] = Serial.read(); if ((ch[n - 1] == 'O') && (ch[n] == 'K')) { lcd.print("SMS Deleted.."); return 1; } n++; if (n > 19) n = 0; } lcd.print("Error..."); return 0; } } }

void indicate(int d) // indicate with led and buzzer { digitalWrite(led_pin, HIGH); delay(d); digitalWrite(led_pin, LOW); } int register_user() // register user/ save number in EEPROM { //Serial.print("sms"); //Serial.println(sms); if ((sms[0] == 'A') && (sms[1] == 'B') && (sms[2] == 'C')) { lcd.clear(); lcd.println("Registration...."); EEPROM.write(0, 0); // to indicate that the user has been registered P a g e 85 | 92

delay(100); EEPROM.write(1, sms[3]); delay(100); EEPROM.write(2, sms[4]); delay(100); EEPROM.write(3, sms[5]); delay(100); EEPROM.write(4, sms[6]); delay(100); EEPROM.write(5, sms[7]); delay(100); EEPROM.write(6, sms[8]); delay(100); EEPROM.write(7, sms[9]); delay(100); EEPROM.write(8, sms[10]); delay(100); EEPROM.write(9, sms[11]); delay(100); EEPROM.write(10, sms[12]); delay(100); sms2send = "This number is registered"; send_sms(); } } byte send_sms() { char ch[20]; int n = 0; byte number = 0; lcd.clear(); lcd.print("Sending SMS.."); P a g e 86 | 92

lcd.setCursor(0, 1); Serial.print("AT+CMGS="); delay(100); number = EEPROM.read(1); // first digit of the mobile number lcd.print(char(number)); Serial.print('"'); Serial.print(char(number)); number = EEPROM.read(2); // second digit of the mobile number lcd.print(char(number));// DISPLAY THIS DATA IN LCD Serial.print(char(number)); number = EEPROM.read(3); lcd.print(char(number)); Serial.print(char(number)); number = EEPROM.read(4); lcd.print(char(number)); Serial.print(char(number)); number = EEPROM.read(5); lcd.print(char(number)); Serial.print(char(number)); number = EEPROM.read(6); lcd.print(char(number)); Serial.print(char(number)); number = EEPROM.read(7); lcd.print(char(number)); Serial.print(char(number)); number = EEPROM.read(8); lcd.print(char(number)); Serial.print(char(number)); number = EEPROM.read(9); lcd.print(char(number)); Serial.print(char(number)); number = EEPROM.read(10); // 10th digit of the mobile number P a g e 87 | 92

lcd.print(char(number)); Serial.print(char(number)); Serial.println('"'); delay(1000); Serial.println(sms2send); delay(100); Serial.print(char(26)); // ascii code for ctrl^z while (1) { if (Serial.available()) { ch[n] = Serial.read(); //Serial.print(char(ch[n])); if ((ch[n - 3] == 'C') && (ch[n - 2] == 'M') && (ch[n - 1] == 'G') && (ch[n] == 'S')) { lcd.print("Sent"); delay(1000); Serial.flush();// clear all other data return 1; } if ((ch[n - 3] == 'E') && (ch[n - 2] == 'R') && (ch[n - 1] == 'R') && (ch[n] == 'O')) { lcd.print("Error"); delay(1000); Serial.flush();// clear all other data return 0; } n++; if (n >= 20) n = 0; } } P a g e 88 | 92

CHAPTER (11) RESULTS AND DISCUSSIONS 11.1 Results and Conclusions Over the years, Arduino has went out to become a huge success and a common name among students. With google deploying it, people’s imagination has went out to much higher level than before. A developer in the annual GOOGLE IO conference said “when Arduino and Android coming together, this really proves “INFINITY EXISTS” in the future” I think a study on arduino and practical experiments on arduino must be added for UG courses of engineering, to help students to leverage their talents, and imagination. Before Arduino, the largest players in the design/hobbyist market segment were the PIC microcontroller family (made by Microchip) and the BASIC Stamp (made by Parallax). Since the introduction of the Arduino, other large companies have tried to enter the hobbyist market, including Texas Instruments, and even Microsoft. However, the open-sourced tools of the Arduino and the size of its community are large barriers for new platforms to overcome.

Figure no-11.1 GOOGLE trends comparing ARDUINO with its biggest competitors P a g e 89 | 92

11.2 Uses and further scope Arduino was basically designed to make the process of using electronics in multidisciplinary projects more accessible. It is intended for artists, designers, hobbyists ,and anyone interested in creating interactive objects or environments. Arduino is used by all class of people in a different way. Some students use it in their projects,some using arduino for fun some went out to become entreupreuners. This only shows how useful is this tiny device. Arduino is spreading rapidly across the globe. Arduino is actually an open source hardware project that can be programmed to read temperatures, control a motor, and sense touch. The Arduino board is for anyone who wants to build a basic level of intelligence into an object. Once programmed, it can read sensors, make simple decisions, and control myriad devices in the real world. Using it is a snap: first, hook up a few sensors and output devices to the Arduino, then program it using the free developer’s software. Next, debug your code and disconnect the Arduino.Then,the little blue Arduino becomes a standalone computer. Thousands of projects have been done worldwide using this tiny little device. Some of which to mention are: 

Simple room temperature readout



Interactive real-time auditory feedback system



GPS receiver Module



Ultrasonic Sensor



Infrared detectors



SONAR



Various sensor projects like





Keypad security code



Sensor tube for heart monitor



Pulse rate monitor

Various light projects like 

Multicolor light display



Seven-segment LED display



Double seven-segment LED dice



LED array P a g e 90 | 92









LCD module

Various sound projects like 

Oscilloscope



Light harp



VU meter

Various power projects like 

LCD Thermostat



Computer controlled fan



The hypnotizer

Miscellaneous Projects like 

Lie detector



Magnetic door lock



Infrared remote

P a g e 91 | 92

CHAPTER (12) REFERENCES 1. http://www.arduino.cc

-Arduino Official webpage

2. http://www.google.co.in 3. http://forum.arduino.cc/index.php?topic=146315.0 4. http://www.circuitstoday.com/interfacing-hex-keypad-to-arduino 5. http://read.pudn.com - steve heath 6. hackveda-VMDD Technologies 7. Research paper published by Abhishek S. Parab et al, / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 6 (3) , 2015, 2950-2953

P a g e 92 | 92

More Documents from "Warrior Prince"