Sie sind auf Seite 1von 62

ROBOT MOVEMENT CONTROL BY USING ANDRIOD

CHAPTER 1

INTRODUCTION

A robot is an electromechanical machine that is controlled by computer program to perform


various operations. Industrial robots have designed to reduce human effort and time to improve
productivity and to reduce manufacturing cost. Today human-machine interaction is moving away
from mouse and pen and becoming much more pervasive and much more compatible with the
physical world. Android app can control the robot motion from a long distance using Bluetooth
communication to interface controller and android. Microcontroller ATMEGA328P-PU can be to the
Bluetooth module though UART protocol and code is written in embedded C language. robot motion
can be controlled. The output motion of arobotic vehicle is accurate and repeatable. Pick and Place
robots can be reprogrammable and tool can be interchanged to provide for multiple applications. The
purpose of this work is to design and implement an Android Controlled Bluetooth Robot which is
used for Surveillance, home automation, wheelchairs, military and hostages Rescue.

1.1 Research background


Exponential growth in the mobile device market over the last several years changed devices
from telephone conversations into small pocket personal computers with operating system. They
also expanded from touch driven devices to voice command devices. They are not only using
GSM/UMTS cellular phone networks, but also Bluetooth and Wi-Fi wireless technology standard for
exchanging data with another an electronic device. All this possibilities created another ecosystem and
manufacturers of various construction kits are using mobile devices as remote control. Construction kits
contain servo motors, touch, distance or light sensors. Many kinds of real-life embedded systems,
from elevator controllers to industrial robots, may be modeled using these construction kits. Design and
realization of the mobile application for the Android operating system and mobile robot was realized for
the purpose of engineering education. Mobile application for Android operating system was developed in
Eclipse integrated Mind storms construction kit was used
1.2 Problem statement
A robot is usually an electro-mechanical machine that is guided by computer and electronic
programming Many robots have been built for manufacturing purpose and can be found in factories
around the world. Designing of the latest inverted ROBOT which can be controlling using an APP for
android mobile. We are developing the remote buttons in the android app by which we can control the
robot motion with them. And in which we use Bluetooth communication to interface controller and
android. Controller can be interfaced to the Bluetooth module though UART protocol. According to
commands received from android the robot motion can be controlled. The consistent output of a robotic
system along with quality and repeatability are un matched. Pick and Place robots can be
reprogrammable and tooling can be interchanged to provide for multiple applications.

1.3 Project objective

Aim of this work is to design and control the motion of robot using Bluetooth device of an Android
phone

 An android device to design and implement cost effective robot movement controlled system yet
an efficient one.
 To design a user friendly and a safe system to control robot movements.

1.4 Project scope

In order to fulfill the stated objectives several steps must be taken. These steps involve both software
programming and hardware implementation. These steps are as follows:

 Establishing a wireless network communication between the android and the robot, using a
microcontroller(AT89S52).
 Create a simple yet reliable robot movement controlled system using a microcontroller that will
be the medium between the android and the robot movements.
 To find a suitable app that will work efficiently with the board in order to control the robot
movements.
 Program the microcontroller board in a way that will let it interact with the android app.
1.5 Project significance

Robot is a re-programmable, multi functional device which is primarily designed to do work like human
such as pick and place, loading and unloading, surveillance, health care, industrial, aerospace application.
Robots can perform dangerous and accurate work to increase the productivity as they can work 24 hours
without rest. This paper deals with the design and control of automated vehicle type robot which can move in
desired direction and captures pictures and videos of required location. An android application has developed
using MIT App inventor and a bluetooth communication is made with robot which interfaces with
microcontroller to control its speed and direction. Aim of this work is to design and control the motion of robot
using bluetooth device of an Android phone.

A low cost embedded system was implemented to remotely control a robotic arm. The system
includes an Android app, which was developed using a visual tool released by Massachusetts Institute of
Technology people. Hardware part of the system makes possible remote connection between app and
robotic arm. The hardware is formed by a Bluetooth module, a microcontroller and motor drivers. The
microcontroller receives instructions from Bluetooth module, and it interprets them; for next, it sends correct
signals to motor drivers. Finally, the robotic part of system is a 5 degree of freedom robotic arm. Five motors
are in charge of arm movements, and motor drivers supply them necessary current for their action. Taking in
account every component, the cost for complete system was less than 100 USD, demonstrating that robotics
is not as expensive as most people think.

Fig 1.1 Robot movement controlled by using mobile phone


CHAPTER 2

LITERATURE REVIEW

2.1 Introduction

The objective behind making this robot was to bring the functionalities of a robot service in a
cheap and onto a mobile device which almost everybody is having. So while surveying as to on which
platform or rather operating system the project has to be implemented ,we selected android for the
following reasons:

 Android is an open source platform

 Supports multifunction

 Provides rich tools to make interactive application

 Downloading the software’s required for making the application are absolutely free Along with
this we surveyed the popularity of the operating system. Market share of android which was mere 2.8%
in 2009(initial stage), boosted to 48% till August, 2011 which is almost half the share of the total market.
Our basic aim is to make the application reach as many people as possible and this goal is achieved by
implementing the application on android. Share of worldwide 2011 Q2 Smartphone sales to end users by
O.S, according to Gartner. Therefore if we become successful in making a robot which is controlled by
an Android then almost half of this world can control their home appliances or small robots without
expending any much of their fortune.

2.2 Bluetooth

Most wireless technologies such as Bluetooth and IrDA standard provide the ability to strengthen
the local wireless network. Bluetooth technology was created by Ericsson in 1994 and is used to replace
the cables in the office, in laboratories or at home as in [11]. Bluetooth is a radio frequency cable with a
short 2012 International Conference on System Engineering and Modeling (ICSEM 2012) IPCSIT vol.
34 (2012) © (2012) IACSIT Press, Singapore 7 distance to replace the unlicensed technology with
2.4GHz bandwidth in the scientific industry. Typically, Bluetooth devices have a range of approximately
10 meters and it can support both voice and data communications with broadband 1 MB per second as in
[12]. Because of the advantages of Bluetooth, such as low costs and low power and nature can be pointed
to different directions, parts of Bluetooth has been integrated into various types of mobile devices such as
mobile phones, PDAs and other wireless set. Research from In-Stat / MDR and Frost & Sullivan has
estimated the use of Bluetooth will be sold around 200 million units in 2001 and will increase to one
billion in 2006. Therefore, currently the usage of Bluetooth technology was developed for mobile robot
controller. With Bluetooth, mobile robots then can be easily handled with a push of button from our
common electronics gadgets such as hand phones or PDA. Fig. 1 shows the architecture for a Bluetooth
enabled autonomous mobile robot as in [9]. In this project, a Bluetooth device in the server connected to
the serial port of the PC. Then, for the mobile robot, a Bluetooth device is connected to the RS232 of the
Handy Board. During the navigation of the mobile robot, all the sensor readings can be viewed from
server (PC). At the same time, PC can send direction command to the mobile robot.

2.3 Discussion

Although there are many wireless technologies that are used to control the mobile robot, but each
technology have the advantages and disadvantages. For Bluetooth, mobile robots can be easily handled
with a push button from any electronic gadget such as mobile phone and can used to control many other
Bluetooth enabled devices such as printers, personal computer etc. This scenario makes the mobile robot
useful and marketable for real time applications. Besides, the cost of implementation on small scale is
relatively cheap. But developer for this application face a bound rate problem which is both micro
controller and Bluetooth devices are running at different bound rate. Vice versa with Bluetooth, Wi-Fi
uses of existing IEEE 802.11 infrastructure. So this is one of the advantages in reducing cost. However, a
reduced performance is noticed in multi-floor and dense indoor environments because signal reflections
and dynamic network conditions can result in undependable signal readings. In indoor communications,
the path loss is also dependent upon the size and the geometry of the room, materials used, and the
distance from transmitter. Meanwhile, 3G is used for long range supervises and control of mobile robot.
This generation combines wireless communication and multimedia technology. In addition, 3G have high
speed transmission, fast connection, the expenses is cheap etc.. The 3G module effectively solved the
bottleneck problem that the control and the transmission in rescue robot adoption with wired or wireless.
Make the great deal of data deliver possible and make the function of the rescue robot stronger. Table 1
summarizes the comparison between wireless technologies for mobile robot controller. Fig. 6 shows the
comparison of wireless technologies in detailed as in [17]

This has been a brief review of several wireless technology usages that might be used to control
mobile robots. It is important to compare this technology and the bandwidth, frequency, data rate to
transfer data among the devices for better development for mobile robot controller. All we need to do is
to focus on how to bring the different characteristics of all the wireless technologies together in one
portable application. Selection of wireless technologies depends on the type of application to be
developed considering the following; range, frequency and data rate.
CHAPTER 3
EXISTING METHODS
3.1 WI-FI or Wireless LAN
WLAN (Wireless Local Area Networks) is a wireless network based on a series of specifications
from the Institute of Electrical and Electronics Engineers (IEEE) called 802.11. Wi-Fi uses unlicensed
radio frequency, mostly in the 2.4GHz band. It enables a person with a wireless-enabled computer or
PDA to connect to the Internet via a wireless access point. The geographical region covered by one or
several access points is called a hot spot. Wi-Fi was intended to be used for mobile devices and local area
networks, but it is now often used for Internet access outdoors. There are several types of Wi-Fi: 802.11a
(offering transmission speeds of 24mbps to 54mbps) • 802.11b (6mbps to 11mbps) and 802.11g (24mbps
to 54 mbps) • 802.11n (50mbps to 100mbps) is a proposed specification that will become a Wi-Fi
standard once it’s finalized by the IEEE, and the Wi-Fi Alliance completes its interoperability testing.
WLAN has changed the interaction manner through wire line between operators and robots in the past.
The work area of robots has not been influenced by the availability of lineate pavement anymore.
Reference has shown a development of robot communication system. In this development, antenna used
to operate in the control link of a mobile robot. The link will carry control signals for the robot
movements and image frames taken from an infrared camera mounted in the robot. The link is set by
means of commercial Wi-Fi boards, an Access Point placed on the robot and another PCI board inserted
on the desktop computer. Mobile robot moved according to the commands sent through the wireless
channel by a desktop computer. Characteristic Wi-Fi systems used in this development are wideband is
around 100MHz, with a center frequency of 2.45GHz.

Other wireless technology usage is developed teleportation robots repairing the leaky chemical
container as in [14]. This project used WLAN for transmitting every movement of the virtual robot to the
real robot. This WLAN responsible for transmitting operators’ commands, the position information of the
robot and the leak, remote video from the real robot, and so on. On the spot, control center is far from the
real robot, and several buildings are among them. Through using a high gain antenna and an amplifier
communication distance of WLAN can extend to over 30km. Fig. 3 shows the WLAN of Bridge
Connection Pattern used in this project.
3.2 3G (THIRD GENERATION)

Third Generation (3G) mobile devices and services will transform wireless communications into
online, real-time connectivity. 3G wireless technologies will allow an individual to have immediate
access to location-specific services that offer information on demand. The concept of 3G wireless
technologies represents a shift from voice-centric services to multimedia-oriented (voice, data, video,
fax) services.

They proposed remote control system based on 3G technology and GPS (Global Positioning System)
for rescue robots. The system modules contain the terminal, the monitor system and network for data
transfer. It includes the correspondence technique, GIS (Geography Information System) technique, data
processing technique, 3G technique; satellite fixed position, the robot control technique and a Streaming
media application technique. Fig. 4 shows the structure of the system. The workflow of processor is i)
The processor passes the plank of GPS OEM to deal with the GPS satellite signal and get the position
current and some other information, such as the speed and the direction etc., and hand over ARM to
process. Then send back the Monitor center though the 3G correspondence. ii) The processor accept
Monitor center control orders, open the camera, implement to collect the video frequency information,
after the data processing, send back the information to Monitor center though the 3G correspondence,
implement the video frequency contact between the terminal and the backstage. iii)The monitor center
send out various control orders to the robot processor, the processor controls the servo organization after
processing the information, iv) finally, the robot takes the long range control orders, and complete
various rescue missions Other examples as in [16] are developed and present the performance analysis of
an end-to-end mObile Tele-Echography using an ultra-Light rObot (OTELO), over the third-generation
(3G) mobile communications network. Fig. 5 shows the OTELO Mobile Robotic System. In this system,
various network protocols are used mainly for sending streaming data. The transport protocol family for
media streaming includes User Datagram Protocol (UDP), Transmission Control Protocol (TCP), Real-
Time Protocol (RTP), and Real-Time Transport Control Protocol (RTCP). Since TCP retransmission
introduces delays that are not acceptable for real-time streaming applications with stringent delay
requirements, especially for transmission over fading wireless links, UDP is typically employed as the
transport protocol for video streams over such fading channels. RTP is an Internet standard protocol
designed to provide end-to-end transport functions for supporting real-time applications. RTCP is a
companion control protocol with RTP and is designed to provide QoS feedback to the participants of an
RTP session; therefore, the RTP/UDP/IP protocol is applied in our work. The UDP/IP protocol is used
for the robot data that is transmitted in both directions.

3.3 Hand gesture controlled robot

In order to understand the principle of operation of Hand Gesture Controlled Robot, let us divide the
project into three parts.

The first part is getting data from the MPU6050 Accelerometer Gyro Sensor by the Arduino. The
Arduino continuously acquires data from the MPU6050 and based on the predefined parameters, it sends
a data to the RF Transmitter.

The second part of the project is the Wireless Communication between the RF Transmitter and RF
Receiver. The RF Transmitter, upon receiving data from Arduino (through the Encoder IC), transmits it
through the RF Communication to the RF Receiver.

Finally, the third part of the project is decoding the Data received by the RF Receiver and sending
appropriate signals to the Motor Driver IC, which will activate the Wheel Motors of the Robot.

3.4 IR controlled robot

In this system mainly a robotic vehicle is controlled by the TV remote. Infrared (IR) sensor is
interfaced to the robot control unit for sensing the remote signal. This information is passed on to the
control unit which moves the robot as per the requirement. A microcontroller is utilized as a control
system. In this IR remote goes about as a transmitter. The point when button is pressed in the remote, the
signal will be passes and gained by the IR receiver. This sign is sent to the microcontroller which decodes
the signal and performs the relating movement as per the button pressed in the remote. For instance, if
number 1 is pressed in the remote the robot will be turned left as per our requirement. The other
undertakings test (forward, backward and right) will be performed in the comparative way utilizing IR.
At the receiving end the development is attained by two motors that are interfaced to the microcontroller.
CHAPTER 4

PROPOSED METHODS

Android controlled robot project make use of an Android mobile phone for robotic control with the help
of Bluetooth technology. This is a simple robotics projects using microcontroller. We have already
seen Mobile Controlled Robot using DTMF technology which uses call based method to control robot.
Also many wireless-controlled robots use RF modules. The control commands available are more than
RF modules. Smartphone controlled robot is superior than all these robots.

This project is a Bluetooth controlled robot. For this the android mobile user has to install an application
on her/his mobile. Then user needs to turn on the Bluetooth in the mobile. The wireless communication
techniques used to control the robot is Bluetooth technology. User can use various commands like move
forward, reverse, stop move left, move right. These commands are sent from the Android mobile to the
Bluetooth receiver. Android based robot has Bluetooth receiver units which receives the commands and
give it to the microcontroller circuit to control the motors. The microcontroller then transmits the signal
to the motor driver IC’s to operate the motors.

4.1 Embedded based robot movement control


An embedded system is a special-purpose system in which the computer is completely encapsulated
by or dedicated to the device or system it controls. Unlike a general-purpose computer, such as a personal
computer, an embedded system performs one or a few predefined tasks, usually with very specific
requirements. Since the system is dedicated to specific tasks, design engineers can optimize it, reducing
the size and cost of the product. Embedded systems are often mass-produced, benefiting from economies
of scale.

Personal digital assistants (PDAs) or handheld computers are generally considered embedded
devices because of the nature of their hardware design, even though they are more expandable in
software terms. This line of definition continues to blur as devices expand. With the introduction of the
OQO Model 2 with the Windows XP operating system and ports such as a USB port — both features
usually belong to "general purpose computers", — the line of nomenclature blurs even more.
Physically, embedded systems ranges from portable devices such as digital watches and MP3
players, to large stationary installations like traffic lights, factory controllers, or the systems controlling
nuclear power plants.

In terms of complexity embedded systems can range from very simple with a single
microcontroller chi multiple units, peripherals and networks mounted inside large chassis or enclose

Fig 4.1.1 Embedded chip


CHAPTER 5

BLOCK DIAGRAM

LCD DISPLAY
BATTERY
(16 X 2 LINES)
MICRO
CONTROLLER

(AT89S52)
BLUETOOTH MOTOR ROBOT
DRIVER MOTORS

5.1 BLOCK DIAGRAM EXPLANATION:

Power Supply Section: This section is meant for supplying Power to all the sections mentioned
above. It basically consists of a Transformer to step down the 230V ac to 9V ac followed by diodes. Here
diodes are used to rectify the ac to dc. After rectification the obtained rippled dc is filtered using a
capacitor Filter. A positive voltage regulator is used to regulate the obtained dc voltage.

Microcontroller Section: This section forms the control unit of the whole project. This section
basically consists of a Microcontroller with its associated circuitry like Crystal with capacitors, Reset
circuitry, Pull up resistors (if needed) and so on. The Microcontroller forms the heart of the project
because it controls the devices being interfaced and communicates with the devices according to the
program being written.

LCD Display Section: This section is basically meant to show up the status of the project. This
project makes use of Liquid Crystal Display to display / prompt for necessary information.
Bluetooth: AUBTM-22 is a Bluetooth v1.2 module with SPP profiles. The module is intended to be
integrated into another host system which requires Bluetooth functions. The HOST system could send
commands to AUBTM-22 through a UART. AUBTM-22 will parse the commands and execute proper
functions, e.g. set the maximum transmit power, change the name of the module. And next the module
can transmit the data receive from the UART with SPP profiles.

Driver circuit: L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as
current amplifiers since they take a low-current control signal and provide a higher-current signal. This
higher current signal is used to drive the motors.

Gear Motor: Motor is an output for this project. And motor is connected to microcontroller. And this
motor controlled by the microcontroller with the respective inputs given by us. Its speed will be varied
according to the speed set by the switches.

5.1 SCHEMATIC EXPLANATION:

Firstly, the required operating voltage for Microcontroller AT89S52 is 5V. Hence the 5V D.C.
power supply is needed by the same. This regulated 5V is generated by first stepping down the 230V to
18V by the step down transformer.

In the both the Power supplies the step downed A.c. voltage is being rectified by the Bridge
Rectifier. The diodes used are 1N4007. The rectified A.c voltage is now filtered using a ‘C’ filter. Now
the rectified, filtered D.C. voltage is fed to the Voltage Regulator. This voltage regulator allows us to
have a Regulated Voltage. In Power supply given to Microcontroller 5V is generated using 7805 and in
other two power supply 12V is generated using 7812. The rectified; filtered and regulated voltage is
again filtered for ripples using an electrolytic capacitor 100μF. Now the output from the first section is
fed to 40th pin of AT89S52 microcontroller to supply operating voltage and from other power supply to
circuitry.

The microcontroller AT89S52 with Pull up resistors at Port0 and crystal oscillator of 11.0592
MHz crystal in conjunction with couple of capacitors of is placed at 18th & 19th pins of AT89S52 to
make it work (execute) properly.
Fig 5.1.1 schematic diagram
CHAPTER 6
HARDWARE DESCRIPTION
6.1 MICRO CONTROLLER:

Fig 6.1.1 AT89S52 Micro controller

Description
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system
programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile
memory technology and is compatible with the industry- standard 80C51 instruction set and pin out. The
on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional
nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable
Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-
flexible and cost-effective solution to many embedded control application.

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of
RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-
level interrupt architecture, a full duplex serial port, on-chip oscillator,and clock circuitry. In addition, the
AT89S52 is designed with static logic for operation down to zero frequency and supports two software
selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters,
serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents
but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.

6.1.1 Pin configuration

Fig 6.1.1.1 pin diagram

6.1.2 Pin Description:

VCC

Supply voltage.

GND

Ground.
Port 0:

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs.
When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 can also be
configured to be the multiplexed low order address/data bus during accesses to external program and data
memory.

In this mode, P0 has internal pull ups. Port 0 also receives the code bytes during Flash programming
and outputs the code bytes during program verification. External pull-ups are required during program
verification.

Port 1:

Port 1 is an 8-bit bidirectional I/O port with internal pull ups. The Port 1 output buffers can sink/source
four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull ups and can
be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL)
because of the internal pull ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2
external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown
in the following table.

Port 1 also receives the low-order address bytes during Flash programming and verification.

Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pull ups. The Port 2 output buffers can sink/source
four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull ups and can
be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL)
because of the internal pull ups.

Port 2 emits the high-order address byte during fetches from external program memory and
during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this
application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data
memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function
Register. Port 2 also receives the high-order address bits and some control signals during Flash
programming and verification.

Port 3:

Port 3 is an 8-bit bidirectional I/O port with internal pull ups. The Port 3 output buffers can sink/source
four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can
be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL)
because of the pull ups. Port 3 also serves the functions of various special features of the AT89S52, as
shown in the following table. Port 3 also receives some control signals for Flash programming and
verification.
RST:

Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.
This pin drives High for 96 oscillator periods after the Watchdog times out. The DISRTO bit in SFR
AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET
HIGH out feature is enabled.

ALE/PROG:

Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses
to external memory. This pin is also the program pulse input (PROG) during Flash programming. In
normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for
external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to
external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH.
With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly
pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution
mode.

PSEN:

Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is
executing code from external program memory, PSEN is activated twice each machine cycle, except that
two PSEN activations are skipped during each access to external data memory.

EA/VPP:

External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from
external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is
programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program
executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash
programming.
XTAL1:

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2:

Output from the inverting oscillator amplifier.

Table 1. AT89S52 SFR Map and Reset Values

Special Function Registers:

A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table
1.Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on
the chip. Read accesses to these addresses will in general return random data, and write accesses will
have an indeterminate effect. User software should not write 1s to these unlisted locations, since they
may be used in future products to invoke new features. In that case, the reset or inactive values of the
new bits will always be 0.

Timer 2 Registers: Control and status bits are contained in registers T2CON (shown in Table 2)
and T2MOD (shown in Table 3) for Timer 2. The register pair (RCAP2H, RCAP2L) are the
Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.

Interrupt Registers:

The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the six
interrupt sources in the IP register.
Dual Data Pointer Registers: To facilitate accessing both internal and external data memory, two banks
of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H-
85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user should always
initialize the DPS bit to the appropriate value before accessing the respective Data Pointer Register.

Power Off Flag: The Power Off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR. POF is set
to “1” during power up. It can be set and rest under software control and is not affected by reset.

Memory Organization:
MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of
external Program and Data Memory can be addressed

Program Memory:

If the EA pin is connected to GND, all program fetches are directed to external memory. On the
AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed
to internal memory and fetches to addresses 2000H through FFFFH are to external memory.

Data Memory:

The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address
space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as
the SFR space but are physically separate from SFR space. When an instruction accesses an internal
location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses
the upper 128 bytes of RAM or the SFR space. Instructions which use direct addressing access of the
SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H
(which is P2).

MOV 0A0H, #data:

Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following
indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather
than P2 (whose address is 0A0H).

MOV @R0, #data:

Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are
available as stack space.

Watchdog Timer:

(One-time Enabled with Reset-out)

The WDT is intended as a recovery method in situations where the CPU may be subjected to software
upsets. The WDT consists of a 13-bit counter and the Watchdog Timer Reset (WDTRST) SFR. The
WDT is defaulted to disable from exiting reset. To enable the WDT, a user must write 01EH and 0E1H in
sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, it will increment
every machine cycle while the oscillator is running. The WDT timeout period is dependent on the
external clock frequency. There is no way to disable the WDT except through reset (either hardware reset
or WDT overflow reset). When WDT overflows, it will drive an output RESET HIGH pulse at the RST
pin.

Using the WDT:

To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR
location 0A6H). When the WDT is enabled, the user needs to service it by writing 01EH and 0E1H to
WDTRST to avoid a WDT overflow. The 13-bit counter overflows when it reaches 8191 (1FFFH), and
this will reset the device. When the WDT is enabled, it will increment every machine cycle while the
oscillator is running. This means the user must reset the WDT at least every 8191 machine cycles. To
reset the WDT the user must write 01EH and 0E1H to WDTRST. WDTRST is a write-only register. The
WDT counter cannot be read or written. When WDT overflows, it will generate an output RESET pulse
at the RST pin. The RESET pulse duration is 96xTOSC, where TOSC=1/FOSC. To make the best use of
the WDT, it should be serviced in those sections of code that will periodically be executed within the
time required to prevent a WDT reset.

WDT during Power-down and Idle:

In Power-down mode the oscillator stops, which means the WDT also stops. While in Power-down
mode, the user does not need to service the WDT. There are two methods of exiting Power-down mode:
by a hardware reset or via a level-activated external interrupt which is enabled prior to entering Power-
down mode. When Power-down is exited with hardware reset, servicing the WDT should occur as it
normally does whenever the AT89S52 is reset. Exiting Power-down with an interrupt is significantly
different.

The interrupt is held low long enough for the oscillator to stabilize. When the interrupt
is brought high, the interrupt is serviced. To prevent the WDT from resetting the device while the
interrupt pin is held low, the WDT is not started until the interrupt is pulled high. It is suggested that the
WDT be reset during the interrupt service for the interrupt used to exit Power-down mode.
To ensure that the WDT does not overflow within a few states of exiting Power-down, it is best
to reset the WDT just before entering Power-down mode. Before going into the IDLE mode, the
WDIDLE bit in SFR AUXR is used to determine whether the WDT continues to count if enabled. The
WDT keeps counting during IDLE (WDIDLE bit = 0) as the default state. To prevent the WDT from
resetting the AT89S52 while in IDLE mode, the user should always set up a timer that will periodically
exit IDLE, service the WDT, and reenter IDLE mode. With WDIDLE bit enabled, the WDT will stop to
count in IDLE mode and resumes the count upon exit from IDLE.

UART:

The UART in the AT89S52 operates the same way as the UART in the AT89C51 and AT89C52. Timer
Timer 0 and 1:

Timer 0 and Timer 1 in the AT89S52 operate the same way as Timer 0 and Timer 1 in the AT89C51 and
AT89C52

Timer 2:

Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. The type of
operation is selected by bit C/T2 in the SFR T2CON (shown in Table 2). Timer 2 has three operating
modes: capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by
bits in T2CON, as shown in Table 3. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer
function, the TL2 register is incremented every machine cycle. Since a machine cycle consists of 12
oscillator periods, the count rate is 1/12 of the oscillator frequency.

In the Counter function, the register is incremented in response to a 1-to-0 transition at its corresponding
external input pin, T2. In this function, the external input is sampled during S5P2 of every machine cycle.
When the samples show a high in one cycle and a low in the next cycle, the count is incremented. The
new count value appears in the register during S3P1 of the cycle following the one in which the transition
was detected. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0
transition, the maximum count rate is 1/24 of the oscillator frequency. To ensure that a given level is
sampled at least once before it changes, the level should be held for at least one full machine cycle.

Capture Mode:

In the capture mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 is a 16-
bit timer or counter which upon overflow sets bit TF2 in T2CON. This bit can then be used to generate an
interrupt. If EXEN2 = 1, Timer 2 performs the same operation, but a 1- to-0 transition at external input
T2EX also causes the current value in TH2 and TL2 to be captured into RCAP2H and RCAP2L,
respectively. In addition, the transition at T2EX causes bit EXF2 in T2CON to be set. The EXF2 bit, like
TF2, can generate an interrupt. The capture mode is illustrated in Figure 5.

Auto-reload (Up or Down Counter):

Timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload mode. This
feature is invoked by the DCEN (Down Counter Enable) bit located in the SFR T2MOD (see Table 4).
Upon reset, the DCEN bit is set to 0 so that timer 2 will default to count up. When DCEN is set, Timer 2
can count up or down, depending on the value of the T2EX pin.

Figure 6 shows Timer 2 automatically counting up when DCEN=0. In this mode, two options are selected
by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts up to 0FFFFH and then sets the TF2 bit upon
overflow. The overflow also causes the timer registers to be reloaded with the 16-bit value in RCAP2H
and RCAP2L. The values in Timer in Capture ModeRCAP2H and RCAP2L are preset by software. If
EXEN2 = 1, a 16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at external
input T2EX. This transition also sets the EXF2 bit. Both the TF2 and EXF2 bits can generate an interrupt
if enabled.

Setting the DCEN bit enables Timer 2 to count up or down, as shown in Figure 6. In this mode, the T2EX
pin controls the direction of the count.

A logic 1 at T2EX makes Timer 2 count up. The timer will overflow at 0FFFFH and set the
TF2 bit. This overflow also causes the 16-bit value in RCAP2H and RCAP2L to be reloaded into the
timer registers, TH2 and TL2, respectively. Logic 0 at T2EX makes Timer 2 count down. The timer
underflows when TH2 and TL2 equal the values stored in RCAP2H and RCAP2L. The underflow sets
the TF2 bit and causes 0FFFFH to be reloaded into the timer registers. The EXF2 bit toggles whenever
Timer 2 overflows or underflows and can be used as a 17th bit of resolution. In this operating mode,
EXF2 does not flag an interrupt.
Baud Rate Generator:

Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON (Table 2). Note
that the baud rates for transmit and receive can be different if Timer 2 is used for the receiver or
transmitter and Timer 1 is used for the other function. Setting RCLK and/or TCLK puts Timer 2 into its
baud rate generator mode, as shown in Figure 8. The baud rate generator mode is similar to the auto-
reload mode, in that a rollover in TH2 causes the Timer 2 registers to be reloaded with the 16-bit value
in registers RCAP2H and RCAP2L, which are preset by software. The baud rates in Modes 1 and 3 are
determined by Timer 2’s overflow rate according to the following equation.

The Timer can be configured for either timer or counter operation. In most applications, it is configured
for timer operation (CP/T2 = 0). The timer operation is different for Timer 2 when it is used as a baud
rate generator. Normally, as a timer, it increments every machine cycle (at 1/12 the oscillator frequency).
As a baud rate generator, however, it increments every state time (at 1/2 the oscillator frequency). The
baud rate formula is given below.
where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit unsigned integer.
Timer 2 as a baud rate generator is shown in Figure 8. This figure is valid only if RCLK or TCLK = 1 in
T2CON. Note that a rollover in TH2 does not set TF2 and will not generate an interrupt. Note too, that if
EXEN2 is set, a 1-to-0 transition in T2EX will set EXF2 but will not cause a reload from (RCAP2H,
RCAP2L) to (TH2, TL2). Thus, when Timer 2 is in use as a baud rate generator, T2EX can be used as an
extra external interrupt.

Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate generator mode, TH2 or
TL2 should not be read from or written to. Under these conditions, the Timer is incremented every state
time, and the results of a read or write may not be accurate. The RCAP2 registers may be read but should
not be written to, because a write might overlap a reload and cause write and/or reload errors. The timer
should be turned off (clear TR2) before accessing the Timer 2 or RCAP2 registers.

Programmable Clock Out:

A 50% duty cycle clock can be programmed to come out on P1.0, as shown in Figure 9. This pin, besides
being a regular I/O pin, has two alternate functions. It can be programmed to input the external clock for
Timer/Counter 2 or to output a 50% duty cycle clock ranging from 61 Hz to 4 MHz at a 16 MHz
operating frequency. To configure the Timer/Counter 2 as a clock generator, bit C/T2 (T2CON.1) must
be cleared and bit T2OE (T2MOD.1) must be set. Bit TR2 (T2CON.2) starts and stops the timer. The
clock-out frequency depends on the oscillator frequency and the reload value of Timer 2 capture registers
(RCAP2H, RCAP2L), as shown in the following equation.

In the clock-out mode, Timer 2 roll-overs will not generate an interrupt. This behavior is similar to when
Timer 2 is used as a baud-rate generator. It is possible to use Timer 2 as a baud-rate generator and a clock
generator simultaneously. Note, however, that the baud-rate and clock-out frequencies cannot be
determined independently from one another since they both use RCAP2H and RCAP2L.

Interrupts:

The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1), three timer
interrupts (Timers 0, 1, and 2), and the serial port interrupt. These interrupts are all shown in Figure 10.
Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in
Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at
once. Note that Table 5 shows that bit position IE.6 is unimplemented. In the AT89S52, bit position IE.5
is also unimplemented. User software should not write 1s to these bit positions, since they may be used in
future AT89 products.

Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON.
Neither of these flags is cleared by hardware when the service routine is vectored to. In fact, the service
routine may have to determine whether it was TF2 or EXF2 that generated the interrupt, and that bit will
have to be cleared in software. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle
in which the timers overflow. The values are then polled by the circuitry in the next cycle. However, the
Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer overflows.
Oscillator Characteristics:

XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be
configured for use as an on-chip oscillator, as shown in Figure 11. Either a quartz crystal or ceramic
resonator may be used. To drive the device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven, as shown in Figure 12. There are no requirements on the duty cycle
of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two
flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

Idle Mode:

In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active. The mode is
invoked by software. The content of the on-chip RAM and all the special functions registers remain
unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware
reset. Note that when idle mode is terminated by a hardware reset, the device normally resumes program
execution from where it left off, up to two machine cycles before the internal reset algorithm takes
control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not
inhibited. To eliminate the possibility of an unexpected write to a port pin when idle mode is terminated
by a reset, the instruction following the one that invokes idle mode should not write to a port pin or to
external memory.

Power-down Mode:

In the Power-down mode, the oscillator is stopped, and the instruction that invokes Power-down is the
last instruction executed. The on-chip RAM and Special Function Registers retain their values until the
Power-down mode is terminated. Exit from Power-down mode can be initiated either by a hardware reset
or by an enabled external interrupt. Reset redefines the SFRs but does not change the on-chip RAM. The
reset should not be activated before VCC is restored to its normal operating level and must be held active
long enough to allow the oscillator to restart and stabilize.

Figure 11. Oscillator Connections


Program Memory Lock Bits:

The AT89S52 has three lock bits that can be left un programmed (U) or can be programmed (P) to obtain
the additional features listed in the following table.
When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the
device is powered up without a reset, the latch initializes to a random value and holds that value until
reset is activated. The latched value of EA must agree with the current logic level at that pin in order for
the device to function properly.

Programming the Flash – Parallel Mode:

The AT89S52 is shipped with the on-chip Flash memory array ready to be programmed. The
programming interface needs a high-voltage (12-volt) program enable signal and is compatible with
conventional third-party Flash or EPROM programmers. The AT89S52 code memory array is
programmed byte-by byte.

Programming Algorithm:

Before programming the AT89S52, the address, data, and control signals should be set up according to
the Flash programming mode table and Figures 13 and 14. To program the AT89S52, take the following

STEPS:

1. Input the desired memory location on the address lines.

2. Input the appropriate data byte on the data lines.

3. Activate the correct combination of control signals.


4. Raise EA/VPP to 12V.

5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte-write cycle is
self-timed and typically takes no more than 50 μs. Repeat steps 1 through 5, changing the address and
data for the entire array or until the end of the object file is reached.

Data Polling: The AT89S52 features Data Polling to indicate the end of a byte write cycle. During a
write cycle, an attempted read of the last byte written will result in the complement of the written data on
P0.7. Once the write cycle has been completed, true data is valid on all outputs, and the next cycle may
begin. Data Polling may begin any time after a write cycle has been initiated.

Ready/Busy: The progress of byte programming can also be monitored by the RDY/BSY output signal.
P3.0 is pulled low after ALE goes high during programming to indicate BUSY. P3.0 is pulled high again
when programming is done to indicate READY.

Program Verify: If lock bits LB1 and LB2 have not been programmed, the programmed code data can
be read back via the address and data lines for verification. The status of the individual lock bits can be
verified directly by reading them back.

Reading the Signature Bytes: The signature bytes are read by the same procedure as a normal
verification of locations 000H, 100H, and 200H, except that P3.6 and P3.7 must be pulled to a logic low.
The values returned are as follows.

(000H) = 1EH indicates manufactured by Atmel

(100H) = 52H indicates 89S52

(200H) = 06H

Chip Erase: In the parallel programming mode, a chip erase operation is initiated by using the proper
combination of control signals and by pulsing ALE/PROG low for duration of 200 ns - 500 ns. In the
serial programming mode, a chip erase operation is initiated by issuing the Chip Erase instruction. In this
mode, chip erase is self-timed and takes about 500 ms. During chip erase, a serial read from any address
location will return 00H at the data output.
Programming the Flash – Serial Mode:

The Code memory array can be programmed using the serial ISP interface while RST is pulled to VCC.
The serial interface consists of pins SCK, MOSI (input) and MISO (output). After RST is set high, the
Programming Enable instruction needs to be executed first before other operations can be executed.
Before a reprogramming sequence can occur, a Chip Erase operation is required. The Chip Erase
operation turns the content of every memory location in the Code array into FFH. Either an external
system clock can be supplied at pin XTAL1 or a crystal needs to be connected across pins XTAL1 and
XTAL2. The maximum serial clock (SCK) frequency should be less than 1/16 of the crystal frequency.
With a 33 MHz oscillator clock, the maximum SCK frequency is 2 MHz.

Serial Programming Algorithm:

To program and verify the AT89S52 in the serial programming mode, the following sequence is
recommended:

1. Power-up sequence: Apply power between VCC and GND pins. Set RST pin to “H”.If a crystal is not
connected across pins XTAL1 and XTAL2, apply a 3 MHz to 33 MHz clock to XTAL1 pin and wait for
at least 10 milliseconds.

2. Enable serial programming by sending the Programming Enable serial instruction to pin MOSI/P1.5.
The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the CPU clock at XTAL1
divided by 16.

3. The Code array is programmed one byte at a time by supplying the address and data together with the
appropriate Write instruction. The write cycle is self timed and typically takes less than 1 ms at 5V.

4. Any memory location can be verified by using the Read instruction which returns the content at the
selected address at serial output MISO/P1.6.

5. At the end of a programming session, RST can be set low to commence normal device operation.

Power-off sequence (if needed):

Set XTAL1 to “L” (if a crystal is not used).


Set RST to “L”.

Turn VCC power off.

Data Polling: The Data Polling feature is also available in the serial mode. In this mode, during a write
cycle an attempted read of the last byte written will result in the complement of the MSB of the serial
output byte on MISO.

Serial Programming Instruction Set:

The Instruction Set for Serial Programming follows a 4-byte protocol and is shown in Table
10.Programming Interface – Parallel Mode Every code byte in the Flash array can be programmed by
using the appropriate combination of control signals. The write operation cycle is self-timed and once
initiated, will automatically time itself to completion. All major programming vendors offer worldwide
support for the Atmel microcontroller series. Please contact your local programming vendor for the
appropriate software revision.

6.2 Power Supply


The power supply is designed to convert high voltage AC mains electricity to a suitable low voltage
supply for electronic circuits and other devices. A power supply can by broken down into a series of
blocks, each of which performs a particular function. A D.C. power supply which maintains the output
voltage constant irrespective of a.c mains fluctuations or load variations is known as “Regulated D.C
Power Supply”
For example a 5V regulated power supply system as shown below:

Fig 6.2.1 : Functional Block Diagram of Power supply

6.3 TRANSFORMER

A transformer is an electrical device which is used to convert electrical power from one electrical
circuit to another without change in frequency.

Transformers convert AC electricity from one voltage to another with little loss of power.
Transformers work only with AC and this is one of the reasons why mains electricity is AC. Step-up
transformers increase in output voltage, step-down transformers decrease in output voltage. Most power
supplies use a step-down transformer to reduce the dangerously high mains voltage to a safer low
voltage. The input coil is called the primary and the output coil is called the secondary. There is no
electrical connection between the two coils; instead they are linked by an alternating magnetic field
created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol
represent the core. Transformers waste very little power so the power out is (almost) equal to the power
in. Note that as voltage is stepped down current is stepped up. The ratio of the number of turns on each
coil, called the turn’s ratio, determines the ratio of the voltages. A step-down transformer has a large
number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a
small number of turns on its secondary (output) coil to give a low output voltage.

Fig 6.3.1: An Electrical Transformer

Turns ratio = Vp/ VS = Np/NS

Power Out= Power In

VS X IS=VP X IP

Vp = primary (input) voltage


Np = number of turns on primary coil
Ip = primary (input) current

6.4 Rectifier:

A circuit, which is used to convert a.c to dc, is known as RECTIFIER. The process of conversion
a.c to d.c is called “rectification”

Bridge Rectifier: A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-
wave rectification. This is a widely used configuration, both with individual diodes wired as shown and
with single component bridges where the diode bridge is wired internally.
A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig(a) to achieve
full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown
and with single component bridges where the diode bridge is wired internally.

Fig 6.4.1: Bridge rectifier

Operation:

During positive half cycle of secondary, the diodes D2 and D3 are in forward biased while D1
and D4 are in reverse biased as shown in the fig(b). The current flow direction is shown in the fig (b)
with dotted arrows.

Fig 6.4.2: positive half cycle in bridge rectifier

During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward biased
while D2 and D3 are in reverse biased as shown in the fig(c). The current flow direction is shown in the
fig (c) with dotted arrows.
Fig 6.4.3: negative half cycle in bridge rectifier

6.5 Filter:

A Filter is a device, which removes the a.c component of rectifier output but allows the d.c
component to reach the load.

Capacitor Filter:

We have seen that the ripple content in the rectified output of half wave rectifier is 121% or that
of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples is not
acceptable for most of the applications. Ripples can be removed by one of the following methods of
filtering:

(a) A capacitor, in parallel to the load, provides an easier by –pass for the ripples voltage though it due to
low impedance. At ripple frequency and leave the d.c.to appears the load.

(b) An inductor, in series with the load, prevents the passage of the ripple current (due to high impedance
at ripple frequency) while allowing the d.c (due to low resistance to d.c)

(c) various combinations of capacitor and inductor, such as L-section filter section filter, multiple
section filter etc. which make use of both the properties mentioned in (a) and (b) above. Two cases of
capacitor filter, one applied on half wave rectifier and another with full wave rectifier.

Filtering is performed by a large value electrolytic capacitor connected across the DC supply to
act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is
falling. The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies
current to the output. Filtering significantly increases the average DC voltage to almost the peak value
(1.4 × RMS value).

To calculate the value of capacitor(C),

C = ¼*√3*f*r*Rl

Where,

f = supply frequency,

r = ripple factor,

Rl = load resistance

Note: In our circuit we are using 1000microfarads.

6.6 Regulator:

Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output voltages.
The maximum current they can pass also rates them. Negative voltage regulators are available, mainly for
use in dual supplies. Most regulators include some automatic protection from excessive current ('overload
protection') and overheating ('thermal protection'). Many of the fixed voltage regulators ICs have 3 leads
and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is
simple to use. You simply connect the positive lead of your unregulated DC power supply (anything from
9VDC to 24VDC) to the Input pin, connect the negative lead to the Common pin and then when you turn
on the power, you get a 5 volt supply from the output pin.

Fig 6.6.1:Three terminal voltage regulator


78XX:

The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The
LM78XX offer several fixed output voltages making them useful in wide range of applications. When
used as a zener diode/resistor combination replacement, the LM78XX usually results in an effective
output impedance improvement of two orders of magnitude, lower quiescent current. The LM78XX is
available in the TO-252, TO-220 & TO-263packages,

Features:

• Output Current of 1.5A

• Output Voltage Tolerance of 5%

• Internal thermal overload protection

• Internal Short-Circuit Limited

• No External Component

• Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V

• Offer in plastic TO-252, TO-220 & TO-263

• Direct Replacement for LM78XX

6.7 LIQUID CRYSTAL DISPLAY

Liquid crystal displays (LCDs) have materials, which combine the properties of both liquids and
crystals. Rather than having a melting point, they have a temperature range within which the molecules
are almost as mobile as they would be in a liquid, but are grouped together in an ordered form similar to a
crystal.
An LCD consists of two glass panels, with the liquid crystal material sand witched in
between them. The inner surface of the glass plates are coated with transparent electrodes which define
the character, symbols or patterns to be displayed polymeric layers are present in between the electrodes
and the liquid crystal, which makes the liquid crystal molecules to maintain a defined orientation angle.

One each polarizer are pasted outside the two glass panels. This polarizer would rotate the light
rays passing through them to a definite angle, in a particular direction.

When the LCD is in the off state, light rays are rotated by the two polarizer and the liquid crystal,
such that the light rays come out of the LCD without any orientation, and hence the LCD appears
transparent.

When sufficient voltage is applied to the electrodes, the liquid crystal molecules would be aligned
in a specific direction. The light rays passing through the LCD would be rotated by the polarizer, which
would result in activating/ highlighting the desired characters.

The LCD’s are lightweight with only a few millimeters thickness. Since the LCD’s consume less
power, they are compatible with low power electronic circuits, and can be powered for long durations.

The LCD’s don’t generate light and so light is needed to read the display. By using backlighting,
reading is possible in the dark. The LCD’s have long life and a wide operating temperature range.

Changing the display size or the layout size is relatively simple which makes the LCD’s more
customers friendly.

The LCDs used exclusively in watches, calculators and measuring instruments are the simple
seven-segment displays, having a limited amount of numeric data. The recent advances in technology
have resulted in better legibility, more information displaying capability and a wider temperature range.
These have resulted in the LCDs being extensively used in telecommunications and entertainment
electronics. The LCDs have even started replacing the cathode ray tubes (CRTs) used for the display of
text and graphics, and also in small TV applications.
This section describes the operation modes of LCD’s then describe how to program and interface
an LCD to 8051 using Assembly and C.

LCD operation:

In recent years the LCD is finding widespread use replacing LEDs(seven-segment LEDs or other
multi segment LEDs).This is due to the following reasons:

1. The declining prices of LCDs.

2. The ability to display numbers, characters and graphics. This is in


contract to LEDs, which are limited to numbers and a few characters.

3. Incorporation of a refreshing controller into the LCD, there by relieving the


CPU of the task of refreshing the LCD. In the contrast, the LED must be refreshed by the CPU to keep
displaying the data.

4. Ease of programming for characters and graphics.

LCD pin description:

The LCD discussed in this section has 14 pins. The function of each pins is given in table.

TABLE 6.7. 1: Pin description for LCD:

Pin symbol I/O Description

1 Vss -- Ground

2 Vcc -- +5V power supply

3 VEE -- Power supply to


control contrast

4 RS I RS=0 to select
command register
RS=1 to select

data register

5 R/W I R/W=0 for write

R/W=1 for read

6 E I/O Enable

7 DB0 I/O The 8-bit data bus

8 DB1 I/O The 8-bit data bus

9 DB2 I/O The 8-bit data bus

10 DB3 I/O The 8-bit data bus

11 DB4 I/O The 8-bit data bus

12 DB5 I/O The 8-bit data bus

13 DB6 I/O The 8-bit data bus

14 DB7 I/O The 8-bit data bus

TABLE 6.7. 2: LCD Command Codes

Code Command to LCD Instruction

(hex) Register

1 Clear display screen

2 Return home

4 Decrement cursor
6 Increment cursor

5 Shift display right

7 Shift display left

8 Display off, cursor off

A Display off, cursor on

C Display on, cursor off

E Display on, cursor on

F Display on, cursor blinking

10 Shift cursor position to left

14 Shift cursor position to right

18 Shift the entire display to the left

1C Shift the entire display to the right

80 Force cursor to beginning of 1st line

C0 Force cursor to beginning of 2nd line

38 2 lines and 5x7 matrix

Uses:

The LCDs used exclusively in watches, calculators and measuring instruments are the
simple seven-segment displays, having a limited amount of numeric data. The recent advances in
technology have resulted in better legibility, more information displaying capability and a wider
temperature range. These have resulted in the LCDs being extensively used in telecommunications and
entertainment electronics. The LCDs have even started replacing the cathode ray tubes (CRTs) used for
the display of text and graphics, and also in small TV applications
LCD INTERFACING:

Sending commands and data to LCDs with a time delay:

Fig: Interfacing of LCD to a micro controller

To send any command from table 2 to the LCD, make pin RS=0. For data, make RS=1.Then send a high
–to-low pulse to the E pin to enable the internal latch of the LCD.

6.8 Bluetooth:
Bluetooth is a wireless technology used to transfer data between different electronic devices. The
distance of data transmission is small in comparison to other modes of wireless communication. This
technology eradicates the use of cords, cables, adapters and permits the electronic devices to
communicate wirelessly among each other.
The key features of Bluetooth technology:
 Less complication
 Less power consumption
 Available at cheaper rates
 Robustness
Bluetooth technology permits hands free headset for incoming voice calls, ability of printing and fax,
and automatic synchronization of PDA. Click to now more about basics of Bluetooth Protocol.
Classification:
Various types of Bluetooth technology are available in the markets which help the consumers to
communicate wirelessly. The different types of Bluetooth devices are PC cards, radios, dongles, and
headsets. Laptops and other Internet enabled equipments use Bluetooth technology such as wireless
mouse and keyboard to communicate wirelessly. Music players like iPods, music phones, or other MP3
players make use of stereo headphones.
Applications:
The first and foremost application of Bluetooth technology would be to eradicate the tangling of cables
that would mess up the room.
 Bluetooth’s biggest contribution is to provide a phone with a headset that works wirelessly. This
is possible by providing the caller with an earpiece and a small microphone attached to the
caller’s shirt. The mobile phone can be located in a bag or anywhere in the body. The caller can
dial a number even without touching a button on the mobile phone. This technology has the
advantage of eliminating the radiation hitting the cerebral region.
 PDA, PC or laptop which has enabled Bluetooth can communicate with each other and update
with its latest information. This technology has helped in synchronizing the data easily.
 It is difficult to send emails while travelling in a flight. On landing of the flight, the Bluetooth
enabled laptop can send the email only when it gets in touch with the user’s phone.
 Wireless mouse and keyboards are introduced.
 One will be alerted on his/her mobile phone when your laptop receives the mail.
 You can try to locate a printer via laptop. You will get the printout of that document once that
printer is located.

Working:
Bluetooth technology was discovered to have wireless protocols to connect several electronic devices and
as a solution to synchronize the data. The Bluetooth standard is maintained by the Bluetooth Special
Interest Group.

At the physical layer, the Bluetooth RF transceiver is positioned. At around 79 Bluetooth channels are
placed with a space of 1MHz. Transmission of data and voice are achievable at short distances and
thereby creating Wireless PANs.

A Bluetooth device is comprised of an adapter. A Bluetooth adapter can be available in the form of a card
to connect the device or integrated into an electronic device

Link Management Protocol (LMP) is responsible for peer – to – peer message exchange when the
electronic devices interfere in each other’s radio range. This layer creates the link and negotiation of
packet size. If required this layer can perform the segmentation and reassembling of the packets.
The Bluetooth device enabled by the Service delivery protocol joins the piconet and enquires with all the
services available. A piconet has a star topology with one master and seven slaves. The concept of Master
and Slave is used in the Bluetooth technology. Only after the master takes the initial action, the devices
can begin to talk. Bluetooth GloballD is exchanged among the electronic devices and a connection is
build up after the profiles are matched. Get in-depth of Bluetooth Protocol Stack here.
Frequency hopping is used in the Bluetooth technology to avoid interfering with other signals. After the
packet is transmitted or received, the Bluetooth signal hops to a new frequency. Each packet can cover
five time slots.
The Bluetooth technology supports asynchronous data channel, or 3 simultaneous synchronous voice
channels, or a channel which supports asynchronous data and synchronous voice.
Bluetooth was selected as our way of communicating PDA/Mobile with a central system. The
reason Bluetooth was selected over Bluetooth for various reasons. First of all, Bluetooth security is less
complex and more stable than that of Wi-Fi. Bluetooth manages a security measure of only permitting
certain selected devices to interact with them; Wi-Fi in the other hand establishes a WEP key that has
been known to be cracked. Another reason that Bluetooth was selected over Wi-Fi is that Bluetooth has a
shorter range of signal emission than Wi-Fi. This is a pro because the shorter the range the less the
amount intruders that will try to infiltrate your home system
Features
 Standard 3V3 operation
 Bluetooth standard Ver. 2.0 + EDR compliant
 Low current consumption
 Hold, Sniff, Park, Deep sleep modes
 Support for up to seven slaves
 Supports UART,USB,PCM,I2C interface to host system interface
 SPP(Serial Port Protocol) firmware
 Class 2 module

6.9 L293
 The L293 is an integrated circuit motor driver that can be used for simultaneous, bi-directional
control of two small motors. Small means small. The L293 is limited to 600 mA, but in reality can
only handle much small currents unless you have done some serious heat sinking to keep the case
temperature down. Unsure about whether the L293 will work with your motor? Hook up the
circuit and run your motor while keeping your finger on the chip. If it gets too hot to touch, you
can't use it with your motor. (Note to ME2011 students: The L293 should be OK for your small
motor but is not OK for your gear motor.)
 The L293 comes in a standard 16-pin, dual-in line integrated circuit package. There is an L293
and an L293D part number. Pick the "D" version because it has built in flyback diodes to
minimize inductive voltage spikes.
 The pinout for the L293 in the 16-pin package is shown below in top view. Pin 1 is at the top left
when the notch in the package faces up. Note that the names for pin functions may be slightly
different than what is shown in the following diagrams.

 The following schematic shows how to connect the L293 to your motor and the Stamp. Each
motor takes 3 Stamp pins. If you are only using one motor, leave pins 9, 10, 11, 12, 13, 14, and 15
empty.

Advantage:

You can control 2 motors in both directions instead of 4 in only one direction.

Disadvantages:

There is a 1.5V voltage drop within the L293D driver chip.

6.10 DC GEARED MOTOR:


High efficiency, high quality low cost DC motor with gearbox for robotics applications. Very easy to use
and available in standard size. Nut and threads on shaft to easily connect and internal threaded shaft for
easily connecting it to wheel.

Features

 45 RPM 12V DC motors with Gearbox


 5kgcm torque
 3000RPM base motor
 6mm shaft diameter with internal hole
 125gm weight
 Same size motor available in various rpm
 No-load current = 60 mA(Max), Load current = 300 mA(Max)

Fig 6.10.1 Gear motor


REFERENCES

[1]. P. D. Minns, Atmega32 for Arduino Microcontroller System. Author House, 2013 [2]. M. Banzi, Getting started
with PIC 16f877a. “O’ Reilly Media, Inc.", 2009 [3]. Arduino Apps, "Arduinouno." Last visited on 06/09/2014 [4]. A.
M. Gibb, New media art, design, and the Arduino microcontroller: A malleable tool. PhD thesis, Pratt Institute,
2010 [5]. M. Margolis, Proteus cookbook. “O’Reilly Media, Inc.", 2011 [6]. D. Mellis, M. Banzi, D. Cuartielles, and
T. Igoe, "Arduino with Proteus: An open electronic prototyping platform, " in Proc. CHI, vol. 2007, 2007 [7]. A. U.
ARDUINO UNO, "Front. arduinouno board implement simulation, " 2012
VI. APPLICATIONS &FUTURE SCOPES APPLICATIONS: • Surveillance Device • Home automation • Wheelchairs •
Military Applications • Hostages Rescue FUTURE SCOPES: • In future we plan to implement our project as follows
It will contain following 3 components: • A Robot Mounted with camera • A headset, with a full-color display • A
mission control center

[1] Arvind Kumar Saini1,Garima Sharma2, Kamal Kishor Choure3, “BluBO: Bluetooth Controlled Robot,”
International Journal of Science and Research (IJSR) National Conference on Knowledge, Innovation in
Technology and Engineering (NCKITE), 10-11 April 2015, pp. 325-328S. [2] Arpit Sharma1, Reetesh Varma2,
Saurabh Gupta3 and Sukhdeep Bhatia4, “Android Phone Controlled Robot Using Bluetooth” IJEEE ISSN 0974-
2174, Volume 7, Number 5 (2014, pp. 443-448) [3] M.Selvam1, “Smart phone based robotic smart phone based
robotic” IJRET Volume: 03 Issue: 03, Mar-2014, pp. 229-232. [4] Ritika Pahuja1, Narender Kumar2, “Android
Mobile Phone Controlled Bluetooth Robot Using 8051
7. APPLICATIONS 

In Domestic Use: This project can be used at homes for many purposes like picking up and placing some
objectsfrom one to other.  In Spying Operations: This robot can help in spying operations. The object
recognition and android control makes it Hi-Fi.  For Handicapped People: This project can help the handicapped
people especially those who had lost their feet unfortunately.  Robo Races: The tilt control of robots can be
used in robo races which will be revolutionary.  Miltary Application and Hostage Rescue 8.

CONCLUSIONS

The operating system of smart phone is android which can develop effective remote control program. At the
same time , this program uses blue-tooth connection to communicate with robot. It has proven to allow for
meaningful two-way communication between the Android phone and the robot which would allow a non-expert
to interact with and adjust the functionality of a system which uses ATmega328 controller, a single board micro-
controller intended to make the application of interactive objects or environments more accessible. The
surveillance is always has been a quite sensitive task. And it includes so many risks. So it’s better to use robot for
this job instead of people. And if you are able to control the robots with efficiency and accuracy then you can
guarantee yourself with good results and success. This system is a good step for secure surveillance using robots.
Wireless control is one of the most important basic needs for all the people all over the world. But unfortunately
the technology is not fully utilized due to a huge amount of data and communication overheads. Generally many
of the wireless-controlled robots use RF modules. But our project for robotic control make use of Android mobile
phone which is very cheap and easily available. The available control commands are more than RF modules. For
this purpose the android mobile user has to install a designed application on her/his mobile. 9. FUTURE SCOPE
Advantages • It is feasible to implement bluetooth communication between smart phone and microcontroller. •
The development of apps for Android in Android SDK is easy and free of cost

VII. CONCLUSION

We select all equipment’s based on data sheets. It is feasible to implement Bluetooth communication between
smartphone and microcontroller. It can be used in various industries for picking various objects where human
intervention is not desired. On a large scale, it can be used to develop robots with military applications. It can be
used to target enemy without any human being crossing the territory. It provides for more development of
applications based on android operating system. Such as, Application based on sensors (accelerometer,
gyroscope) etc.The development of apps for Android in Android SDK is easy and free of cost. With tremendous
smart phone in markets, it is bound to have many more applications in near future. It is robust, sensitive and fast
moving, hence can be applied in rescue operations.

The LPCCA library introduced in this paper is fully functional, enabling developers to write Android applications
that remote control NXT robots. Using the library, the Android may programmatically determine complex control
sequences for the NXT. The LPCCA library has been successfully introduced in our course Distributed Robotic
Systems Modeling at Kassel University this term. It proved to provide simple access to standard LEGO robot
sensors and actuators. Based on the LPCCA library it was easy to build complex Android applications that use
object oriented data models in Java. The LPCCA library may however still be expanded beyond the actual state,
making it more flexible and easier to configure. Fig. 6. WebMoteRobot dispatching Keep in mind that the library
as of the writing of this paper is still a proof of concept and needs project specific adjustments to do more than
basic controlling of the NXT. The following areas have been identified as being the most interesting ones to
develop further: • An Android controlled Segway (inverted pendulum principle). For real world results concerning
the bluetooth induced latency, an Android controlled Segway would be very interesting to develop. The Android
devices come with just the right sensors for a Segway, as it needs exact positioning data of the device, i.e. angle
and orientation data provided by the accelerometer, gyroscope and compass sensors in the Android device. If the
latency induced by Bluetooth prevents the Segway from staying upright, this would again motivate to go for USB
based connections between Android and NXT or for an Arduino based solution. • A configurator providing visual
means of configuring the setup of the NXT, i.e. the usage of ports. This would increase the user experience as any
changes to the wiring of the NXT can be adapted without changing the source code of the program, as long as the
right sensors and motors are connected. The need for hard-coded port usage would be eliminated. This
functionality should be provided by an Activity class in the library itself so it can be reused for all projects utilizing
the library. • USB support has yet to be implemented. Even though there is only a small subset of Android devices
that are capable of this means of connection, it is an enhancement to the library, as some latency-related
problems can be circumvented. • Several NXT controlled by one device. The leJOS API is making heavy use of
singletons in its current implementation, leading to a situation where only one NXT can be controlled at a time.
However it is in general possible to use the bluetooth connection to control multiple NXT at the same time.
Altogether, the new LPCCA library provides a simple means for using Android devices to remote control LEGO
Mindstorms NXT bricks and thus to bring complex computation capabilities to LEGO based robots. In addition,
the Android devices add a lot of new sensors to LEGO robots like GPS, acceleration, and last but not least a
camera and WIFI connectivity. And students love it.

Das könnte Ihnen auch gefallen