Cell to Gsm Based Appliances Control System
-
Upload
quardcosandeep -
Category
Documents
-
view
1.859 -
download
2
Transcript of Cell to Gsm Based Appliances Control System
1. INTROUDUCTION
The advances in the technologies related to wireless communication has
led to the emergence of several engineering designs to aid the human
requirements. Thus with the creeping interests in the wireless and GSM based
projects, we came up with this idea of developing a simpler, multipurpose,
cost-effective design to control the on-off mechanism of various devices in the
field via short message service (sms).
There is a growing interest in intelligent home network as a way to offer a
comfortable, convenient and safe environment for occupants [1]. In order to
enhance the occupants’ convenience and safety, home security system is
indispensable in the field of intelligent home network. The requirements of a
home security system include low cost, low power consumption, easy
installation and rapid response to alarm incidents. According to connecting
mode, home network can be divided into two kinds: wireless network and non-
wireless network. The wireless technology has some remarkable benefits
comparing with non-wireless technology. For example, it makes the
installation and maintenance easier and reduces the system cost. Bluetooth,
Zigbee, and wireless USB are the most popular technologies in the field of
home wireless network Introduces a method to form a home network which
provides flexible and dynamic services via Bluetooth. However, the system
mentioned in is high power consumption and high cost so that it is not
convenient to use in security system.
How to inform user in real time when alarm incidents occur has become a
crucial feature of home security system. This can be done via internet or
GSM/GPRS. GSM/GPRS is more convenient than internet. The main reason
is that the GSM/GPRS network has wide spread coverage making the whole
system available for almost all the time. Furthermore, GSM/GPRS network
has high security infrastructure which makes sure that the information sent or
received cannot be monitored. The network examples mentioned in and send
1
the information to remote users via internet. And are examples of home
systems using GSM/GPRS network for remote controlling. However, only
illustrates that GSM is communication method between remote user and
home network server but doesn’t apply it to home security system. The
system in [9] only applies GSM/GPRS technology to intrusion detecting and its
communication is non-wireless.
2
USERMOBILE
Gsm/gprsModem
DB 9 connecter Max 232
Micro ControllerAt89c51
LCD Display
Load 1
Load 2
2. BLOCK DIAGRAM
3
3. CIRCUIT DIAGRAM
4
4. CIRCUIT DISCRIPTION
This project consists of GSM modem, microcontroller, Motor, led, and
display. If the user wants to control some devices in his house he/she have to
send the SMS indicating the operation of the device and then the system
password, while the MODEM embedded with the system microcontroller
receives SMS. The microcontroller will read SMS and check for the password
the user had sent with the SMS.
The DB 9 connecter is used to interface between the gsm modem and
micro controller. Gsm modem is a follows the USART protocol means it
follows the serial communication protocol.
The output of the DB 9 connecter is given to the max 232 IC to drive the
micro controller and to convert the signal levels, the data received from the
modem is converted to digital voltage levels is converted by using max 232 ic.
The output of the max 232 is given to the port 1 of the micro controller,
according to the message retrieved from the gsm modem next function will be
performed. Commands given to the gsm modem are through the sms, which
is sent by the user or any gsm subscriber.
AT commands are sent to gsm modem to operate the devices and switch
on and switch off on loads, devices etc,
According to the commands received from the modem to micro controller,
micro controller will read the sms(message) which is in the memory of the
micro controller, it follows the commands like switch on and switch off the
devices which are connected to the micro controller.
Port o of the micro controller is connected to Lcd display, port 0 is
connected to pull up resisters, the out put of port 0 is open drain configured so
the value of 10K is connected to port 0. Read, write, enable pins of micro
controller are connected to the write, read, EA pins of the LCD display.
In this project dc motor, led is used as a peripherals. These two devices
are switched on and switched off, according to the message received from
5
the user the modem will sends that signals to micro controller. Micro controller
will drive all the peripherals which are connected to the micro controller.
Commands which are used in gsm modem are called as AT commands.
To switch on the led .........................................#LON!
To switch off the led...........................................#LOF!
To switch on the dc motor................................ #FON!
To switch off the dc motor..................................#FOF!
6
5. LIST OF COMPONENTS
RESISTORS:
1 KΩ-----------------1 no.
8.2 kΩ----------------1 no.
CAPACITORS:
22 µf----------------2 no.
10 µf----------------3 no.
30 pf----------------2 no.
Semiconductors:
Max 232 ------------------IC 1 no.
89c51 -----------------------IC 1 no.
Crystal---------------------1 no.
Diodes (1n4007) ----------1 no.
Regulator (7805) ----------1 no.
Miscellaneous:
Dc motor(5v)---------------1 no.
Db 9 connecter pin--------2 no.
2x16 LCD display----------1 no.
Gsm modem----------------1 no.
5.1 Global System for Mobile Communication (GSM) :
7
Definition:
GSM, which stands for Global System for Mobile communications,
reigns (important) as the world’s most widely used cell phone technology. Cell
phones use a cell phone service carrier’s GSM network by searching for cell
phone towers in the nearby area. Global system for mobile communication
(GSM) is a globally accepted standard for digital cellular communication.
GSM is the name of a standardization group
established in 1982 to create a common European mobile telephone standard
that would formulate specifications for a pan-European mobile cellular radio
system operating at 900 MHz. It is estimated that many countries outside of
Europe will join the GSM partnership.
Need of GSM:
The GSM study group aimed to provide the followings through the GSM:
Improved spectrum efficiency.
International roaming.
Low-cost mobile sets and base stations (BS)
High-quality speech
Compatibility with Integrated Services Digital Network (ISDN) and other
telephone company services.
Support for new services.
8
GSM Brief History:
Following table shows many of the important events in the
rollout of the GSM system; other events were introduced, but had less
significant impact on the overall systems.
Years Events
1982CEPT establishes a GSM group in order to develop the standards
for a pan-European cellular mobile system.
1985A list of recommendations to be generated by the group is
accepted.
1986Field tests are performed to test the different radio techniques
proposed for the air interface.
1987
Time Division Multiple Access (TDMA) is chosen as the access
method (with Frequency Division Multiple Access [FDMA]). The initial
Memorandum of Understanding (MoU) is signed by telecommunication
operators representing 12 countries.
1988 GSM system is validated.
1989The responsibility of the GSM specifications is passed to the
European Telecommunications Standards Institute (ETSI).
1990 Phase 1 of the GSM specifications is delivered.
1991Commercial launch of the GSM service occurs. The DCS1800
specifications are finalized.
1992
The addition of the countries that signed the GSM Memorandum of
Understanding takes place. Coverage spreads to larger cities and
airports.
1993 Coverage of main roads' GSM services starts outside Europe.
1994 Data transmission capabilities launched. The number of networks
9
raises to 69 in 43 countries by the end of 1994.
1995Phase 2 of the GSM specifications occurs. Coverage is extended to
rural areas.
1996 June: 133 network in 81 countries operational.
1997July: 200 network in 109 countries operational, around 44 million
subscribers worldwide.
1999Wireless Application Protocol came into existence and 130
countries operational with 260 million subscribers
2000 General Packet Radio Service (GPRS) came into existence.
2001As of May 2001, over 550 million people were subscribers to mobile
telecommunications
The GSM Specifications:
Specifications for different Personal Communication Services
(PCS) systems vary among the different PCS networks. The GSM
specification is listed below with important characteristics.
Modulation:
Modulation is a form of change process where we change the input
information into a suitable format for the transmission medium. We also
changed the information by demodulating the signal at the receiving end.
The GSM uses Gaussian Minimum Shift Keying (GMSK) modulation
method.
Access Methods:
Because radio spectrum is a limited resource shared by all users,
a method must be devised to divide up the bandwidth among as many users
as possible.
10
GSM chose a combination of TDMA/FDMA as its method. The
FDMA part involves the division by frequency of the total 25 MHz bandwidth
into 124 carrier frequencies of 200 kHz bandwidth.
One or more carrier frequencies are then assigned to each BS.
Each of these carrier frequencies is then divided in time, using a TDMA
scheme, into eight time slots. One time slot is used for transmission by the
mobile and one for reception. They are separated in time so that the mobile
unit does not receive and transmit at the same time.
Transmission Rate:
The total symbol rate for GSM at 1 bit per symbol in GMSK produces
270.833 K symbols/second. The gross transmission rate of the time slot is
22.8 Kbps.
GSM is a digital system with an over-the-air bit rate of 270 kbps.
Frequency Band:
The uplink frequency range specified for GSM is 933 - 960 MHz
(basic 900 MHz band only). The downlink frequency band 890 - 915 MHz
(basic 900 MHz band only).
Channel Spacing:
This indicates separation between adjacent carrier frequencies. In
GSM, this is 200 kHz.
Speech Coding:
GSM uses linear predictive coding (LPC). The purpose of LPC is to
reduce the bit rate. The LPC provides parameters for a filter that mimics the
vocal tract. The signal passes through this filter, leaving behind a residual
signal. Speech is encoded at 13 kbps.
Duplex Distance:
The duplex distance is 80 MHz. Duplex distance is the distance
between the uplink and downlink frequencies. A channel has two frequencies,
80 MHz apart.
Misc:
Frame duration: 4.615 ms
11
Duplex Technique: Frequency Division Duplexing (FDD) access mode
previously known as WCDMA.
Speech channels per RF channel: 8.
Send SMS using AT commandsSome advanced GSM modems like WaveCom and Multitech, support the SMS text mode. This mode allows you to send SMS messages using AT commands, without the need to encode the binairy PDU field of the SMS first. This is done by the GSM modem
Check if your GSM phone or modem supports SMS text mode:To check if your modem supports this text mode, you can try the following command:
AT+CMGF=1 <ENTER>
If the modem reponds with "OK" this mode is supported. Please note that using this mode it is onluy possible to send simple text messages. It is not possible to send multipart, Unicode, data and other types of messages.
Setting up the modemIf the modem contains a SIM card with is secured with a PIN code, we
have to enter this pin code first:
AT+CPIN="0000" <ENTER> (replace 0000 with your PIN code).
Please not that in most cases you have only 3 attemps to set the correct PIN
code. After setting the PIN code, wait some seconds before issueing the next
command to give the modem some time to register with the GSM network.
In order to send a SMS, the modem has to be put in SMS text mode first using
the following command:
AT+CMGF=1<ENTER>
In text mode there are some additional parameters that can be set.
Using the following command we can read the current values:
12
AT+CSMP?<ENTER>
The modem will response with a string like this:
+CSMP: 1, 169, 0, 0
OK
To send a message with a validity period of 1 day, the parameters have to be
set like this:
Bit 0 and 4 of the first field has to be set, so the first value will become 1 + 16
= 17.
Send the following command to the modem to set this parameters:
AT+CSMP=17,167,0,16 <ENTER>
If the modem responds with "OK" ,the modem is ready to send (flash) text
messages with a validity period of 1 day.
Sending the message
To send the SMS message, type the following command:
AT+CMGS="+31638740161" <ENTER>
Replace the above phone number with your own cell phone number. The
modem will respond with:
>
You can now type the message text and send the message using the
<CTRL>-<Z> key combination:
Hello World ! <CTRL-Z>
13
After some seconds the modem will respond with the message ID of the
message, indicating that the message was sent correctly:
+CMGS: 62
The message will arrive on the mobile phone shortly.
Sending an Unicode SMS message
Some modems also have the capability to send Unicode or UCS2
messages without encoding a PDU.
You can send Unicode messages by only converting the Unicode data to a
HEX string and send this string to the modem.
To check whether your modem supports this mode, just type the following
command:
AT+CSCS=?
This commands displays the codepages supported by the modem. The
modem will respond like this:
+CSCS: ("GSM","PCCP437","CUSTOM","HEX")
If this string contains "HEX" or "UCS2", Unicode seems to be supported.
To specify that you will use an HEX string to send the message, set the
codepage to "HEX" or "UCS2" depending on the modem response.
In our example we will set the modem to "HEX" :
AT+CSCS="HEX" <ENTER>
Next, we have to specify the correct DCS (Data Coding Scheme) for
Unicode messages, which is 0x08. We can set this value by changing the
fourth parameter of the AT+CSMP command to '8':
AT+CSMP=1,167,0,8 <ENTER>
14
The modem is now ready to send messages as Unicode. Now is the time
to send the actual message:
AT+CMGS="+31638740161" <ENTER>
Replace the above phone number with your own cell phone number. The
modem will respond with:
>
The only thing you have to program by yourself, is a simple routine which
converts the Unicode string to an hexadecimal string like this:
Which is 'Hello' in Arabic will be converted like this:
"06450631062D06280627"
You can send this hexidecimal string to the modem:
06450631062D06280627 <CTRL-Z>
after some seconds the modem will respond with the message ID of the
message, indicating that the message was sent correctly:
+CMGS: 63
The message will arrive on the mobile phone shortly.
15
MICRO CONTROLLERS:
The first microprocessor introduced in 1981/1971, was made possible by
high levels of integration of digital circuits. Continued integration of peripherals
and memory on the same integrated circuit as the microprocessor core led to
the creation of micro controllers.
A micro controller is an integrated circuit composed of a CPU, various
peripheral devices, and typically memory, all in one chip. Using one chip that
contains all the necessary functions in place of a microprocessor and multiple
peripheral chips has reduced the size and the power consumption of control
oriented applications. A micro controller is different from a microprocessor
both in hardware and software. In hardware it includes peripherals such as
I/O, memory, and analog and digital interface. Micro controllers are more
suited for small applications with specific control functions requiring
specialized peripherals and interfaces. They are designed for process control
and are required to interface to the real world processes.
Many of the peripheral devices integrated on a micro controller are for that
specific purpose. Analog to digital converters perform the task of converting
an analog signal to digital for use by the CPU, and digital to analog converters
perform the task of converting digital data into analog value and waveforms to
control analog functions.
In addition to the analog interface, micro controllers contain peripheral
devices that enable them to communicate to other digital components within a
system or to monitor and control digital functions. Communication interfaces,
digital I/O and interrupt controllers fall into this category of peripheral devices.
Other peripheral devices often included on the same chip include clocks and
timers.
In terms of the software, micro controllers have a more compact set of
instructions with commands more suited to process control such as input and
output from. Single bit operations such as set and reset, bit-wise logical
functions or branching instructions that depend on a single bit are commonly
16
available as part of the instruction set to allow for reading input switch status
or on/off control of an external event. Since in a given application the micro
controller is programmed for one task, it only has one control program.
In a microprocessor based system various programs are stored in a mass
storage device and then loaded into the RAM for execution. In contrast the
micro controller program is typically stored in a ROM or PROM and RAM is
used for temporary storage of data.Compared with discrete implementation of
a system, the micro controller based approach provides shorter system
development time, reduced implementation cost, lower power consumption,
and higher reliability.
The only drawback, which is often not important, is the lower speed of
execution. For example, for a micro controller system to perform a logical
operation, several clock cycles are needed to read the inputs, perform the
function and output the results. The same operation when implemented with
discrete components will provide the results as soon as the signals have
propagated through the logic gates.
Micro-controllers are used in a variety of process control applications,
replacing complex digital circuits and sometimes-analog functions while
providing more flexibility due to their programmability. Portable electronic
devices such as personal audio devices (CD players, MP3 players), mobile
telephones, digital cameras and video camcorders rely heavily on the reduced
size and low power consumption of micro controller based electronics.
These features are crucial to applications like implantable medical devices
such as pacemakers, or personal medical monitoring devices like gluco
meters (electronic devices used for the measurement of blood glucose).
In other applications such as appliances, home audio and video,
automotive, power management, and temperature control, using a micro
controller results in reduced board level circuit complexity and consequently
reduced cost. With the growing number of applications using micro controllers,
it is not surprising that there are such a wide variety of these components. In
17
addition to those commonly available, many manufacturers custom-design a
micro controller to suit a specific application.
Architecture
Architecturally all micro controllers share certain features. They all contain
a CPU, memory and I/O on the same chip. Another common feature is the
interrupt handling capability. What sets them apart from one another is the
choice of CPU, the structure of memory, and choice of peripheral devices, I/O
and interrupt handling hardware. The major distinguishing architectural
characteristic of micro controllers is the word size. Micro-controllers are
available in 4, 8, 16, or 32 bit wide words. The width of the data path impacts
several features of the micro controller. The complexity of the instruction set
(number of available instructions and addressing modes), program efficiency
(code generation and storage space), execution speed, as well as chip
implementation and interfacing complexity are all influenced by the width of
the data path.
For simple control tasks 4-bit, and for a vast number of control and
measurement applications 8-bit micro controllers would be sufficient. For
higher precision and speed applications like speech and video processing, or
complex instrumentation, 16-bit and 32-bit micro controllers are more
appropriate.
Another distinction between micro controllers is the instruction set. Micro-
controllers with complex instruction set (CISC) provide capability to perform
complex computations rapidly. The extensive set of instructions, allow
complex operations to be performed with few instructions. On the other hand
reduced instruction set computers (RISC) decrease program execution time
by having fewer less complex instructions. Fewer available instructions results
18
in faster execution due to smaller size of the op-code and less decoding time
needed for each instruction.
The trade-off depends on the complexity of operations needed for a
specific application. In simple control applications a RISC based micro
controller is more suitable because of its lower overhead for each instruction.
In more complex applications, the availability of a more diverse instruction set
results in a more efficient and faster executing code because fewer
instructions are needed to accomplish a complicated task. For micro controller
applications the instruction set should include common computational
instructions plus instructions optimized for the specific application at hand.
Just as in microprocessors, micro controllers are also differentiated
according to their memory structure. Von Neumann architecture maps the
data and program to same memory address space. In the Harvard
architecture the instructions are stored in a separate memory space than that
used for data storage. Another memory related architectural characteristic of a
processor is the addressing scheme. In linear addressing there is a one to one
correspondence between an address and a memory location. So with an 8-bit
address register, 28 distinct address locations can be accessed.
In segmented addressing a separate register is used to point to a segment
in memory, and the address register is used to point to an offset from that
segment’s start point. This way if all of the program or data are in the same
segment, in order to access them, only the address register need to be used
and the segment register can remain pointing to the start point of that
segment.
Widely used group of micro controllers is Intel’s MCS51 family. These
micro controllers are also 8-bit processors, but with a separate 64Kbyte of
data and 64Kbyte of program memory space. As implied by this statement,
devices in the MCS51 utilize Harvard architecture. All of I/O addresses as well
as CPU registers and various peripheral devices’ registers are mapped in the
same space as the data.
19
The 8051, which is one of the options in this family, has 5 interrupt
sources, 2 external, two timer interrupts and one serial port interrupt. Interrupt
priority is resolved through a priority scheme and ranking in the polling
sequence. The priority scheme allows each interrupt to be programmed to one
of two priority levels.
Furthermore if two interrupts with the same priority occur simultaneously,
they are serviced based on their rank in the polling sequence. Other
manufacturers such as AMD, Dallas Semiconductor, Fujitsu and Philips also
supply micro controllers in the MCS51 family. Dallas Semiconductor’s
DC87C550 provides increased performance over Intel’s 8051 while
maintaining instruction set compatibility. Many instructions that execute in 12
CPU clock cycles in an 8051, will execute in only 4 clocks for the DC87C550
therefore resulting in increased execution speeds of up to three times.
Additionally, the DC87C550 has a power management mode that allows
slowing of the processor in order to reduce power consumption. This mode
can be utilized in battery operated or otherwise low power applications. The
architecture of the instruction set varies greatly from one micro controller to
another. The choices made in designing the instruction set impact program
memory space usage, code execution speed, and ease of programming.
5.2. Micro controller (at 89c51):
Features
Compatible with MCS-51™ Products
4K Bytes of In-System Reprogrammable Flash Memory
Endurance: 1,000 Write/Erase Cycles
Fully Static Operation: 0 Hz to 24 MHz
Three-level Program Memory Lock
128 x 8-bit Internal RAM
32 Programmable I/O Lines
Two 16-bit Timer/Counters
20
Six Interrupt Sources
Programmable Serial Channel
Low-power Idle and Power-down Modes
Description
The AT89C51 is a low-power, high-performance CMOS 8-bit
microcomputer with 4K
Bytes of Flash programmable and erasable read only memory (PEROM).
The device
Is manufactured using Atmel’s high-density non-volatile memory
technology and is
Compatible with the industry-standard MCS-51 instruction set and pin out.
The on-chip Flash allows the program memory to be reprogrammed in-system
or by a conventional non-volatile memory programmer. By combining a
versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a
powerful microcomputer which provides a highly-flexible and cost-effective
solution to many embedded control applications.
The AT89C51 provides the following standard features: 4K bytes of Flash,
128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, five vector two-level
interrupt architecture, a full duplex serial port, on-chip oscillator and clock
circuitry. In addition, the AT89C51 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 hardware reset.
21
Fig: pin diagram:
Pin Description:
VCC:
Supply voltage.
GND:
Ground.
Port 0:
Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each
pin can sink eight TTL inputs. When 1sare written to port 0 pins, the pins can
be used as high impedance inputs. Port 0 may 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
22
program verification. External pull-ups are required during program
verification.
Port 1:
Port 1 is an 8-bit bi-directional 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. Port 1 also receives the low-order
address bytes during Flash programming and verification.
Port 2:
Port 2 is an 8-bit bi-directional 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 memories that use 16-bit addresses (MOVX @DPTR). In this application,
it uses strong internal pull-ups when emitting 1s. During accesses to external
data memories that use 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 bi-directional I/O port with internal pullups.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 AT89C51
as listed below:
23
Port 3 also receives some control signals for Flash programming and
verification
Tab 6.2.1 Port pins and their alternate functions
RST:
Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device.
ALE/PROG:
Address Latch Enable 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/6the 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 is the read strobe to external program memory.
When the AT89C51 is executing code from external program memory, PSEN
24
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, for parts that require 12-volt VPP.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
XTAL2:
Output from the inverting oscillator amplifier.
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier which can be configured for use as an on-chip oscillator, as shown in
Figs 6.2.3. 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 6.2.4.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.
25
Fig: Oscillator Connections Fig: External Clock Drive Configuration
Notes:
1. Under steady state (non-transient) conditions, IOL must be externally
limited as follows:
Maximum IOL per port pin: 10 mA
Maximum IOL per 8-bit port: Port 0: 26 mA
Ports 1, 2, 3: 15 mA
Maximum total IOL for all output pins: 71 mA
If IOL exceeds the test condition, VOL may exceed the related
specification. Pins are not guaranteed to sink current greater than the listed
test conditions.
2. Minimum VCC for Power-down is 2V.
26
5.3. DC MOTOR
DC motors are configured in many types and sizes, including brush less,
servo, and gear motor types. A motor consists of a rotor and a permanent
magnetic field stator. The magnetic field is maintained using either permanent
magnets or electromagnetic windings. DC motors are most commonly used in
variable speed and torque.
Motion and controls cover a wide range of components that in some way
are used to generate and/or control motion. Areas within this category include
bearings and bushings, clutches and brakes, controls and drives, drive
components, encoders and resolves, Integrated motion control, limit switches,
linear actuators, linear and rotary motion components, linear position sensing,
motors (both AC and DC motors), orientation position sensing, pneumatics
and pneumatic components, positioning stages, slides and guides, power
transmission (mechanical), seals, slip rings, solenoids, springs.
Motors are the devices that provide the actual speed and torque in a
drive system. This family includes AC motor types (single and multiphase
motors, universal, servo motors, induction, synchronous, and gear motor) and
DC motors (brush less, servo motor, and gear motor) as well as linear,
stepper and air motors, and motor contactors and starters.
In any electric motor, operation is based on simple electromagnetism. A
current-carrying conductor generates a magnetic field; when this is then
placed in an external magnetic field, it will experience a force proportional to
the current in the conductor, and to the strength of the external magnetic field.
As you are well aware of from playing with magnets as a kid, opposite (North
and South) polarities attract, while like polarities (North and North, South and
South) repel. The internal configuration of a DC motor is designed to harness
the magnetic interaction between a current-carrying conductor and an external
magnetic field to generate rotational motion.
27
Let's start by looking at a simple 2-pole DC electric motor (here red
represents a magnet or winding with a "North" polarization, while green
represents a magnet or winding with a "South" polarization).
Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator,
commutator, field magnet(s), and brushes. In most common DC motors (and
all that Beamers will see), the external magnetic field is produced by high-
strength permanent magnets1. The stator is the stationary part of the motor --
this includes the motor casing, as well as two or more permanent magnet pole
pieces. The rotor (together with the axle and attached commutator) rotates
with respect to the stator. The rotor consists of windings (generally on a core),
the windings being electrically connected to the commutator. The above
diagram shows a common motor layout -- with the rotor inside the stator (field)
magnets.
The geometry of the brushes, commutator contacts, and rotor windings are
such that when power is applied, the polarities of the energized winding and
the stator magnet(s) are misaligned, and the rotor will rotate until it is almost
aligned with the stator's field magnets. As the rotor reaches alignment, the
brushes move to the next commutator contacts, and energize the next
winding. Given our example two-pole motor, the rotation reverses the direction
of current through the rotor winding, leading to a "flip" of the rotor's magnetic
field, and driving it to continue rotating.
In real life, though, DC motors will always have more than two poles (three
is a very common number). In particular, this avoids "dead spots" in the
commutator. You can imagine how with our example two-pole motor, if the
28
rotor is exactly at the middle of its rotation (perfectly aligned with the field
magnets), it will get "stuck" there. Meanwhile, with a two-pole motor, there is a
moment where the commutator shorts out the power supply (i.e., both brushes
touch both commutator contacts simultaneously). This would be bad for the
power supply, waste energy, and damage motor components as well. Yet
another disadvantage of such a simple motor is that it would exhibit a high
amount of torque” ripple" (the amount of torque it could produce is cyclic with
the position of the rotor).
So since most small DC motors are of a three-pole design, let's tinker with
the workings of one via an interactive animation (JavaScript required):
You'll notice a few things from this -- namely, one pole is fully energized at
a time (but two others are "partially" energized). As each brush transitions
from one commutator contact to the next, one coil's field will rapidly collapse,
as the next coil's field will rapidly charge up (this occurs within a few
microsecond). We'll see more about the effects of this later, but in the
meantime you can see that this is a direct result of the coil windings' series
wiring:
29
There's probably no better way to see how an average dc motor is put
together, than by just opening one up. Unfortunately this is tedious work, as
well as requiring the destruction of a perfectly good motor.
This is a basic 3-pole dc motor, with 2 brushes and three commutator
contacts.
5.4. SERIAL COMMUNICATION
BASICS OF SERIAL COMMUNICATION
Computer transfers data in two ways these are
1. Parallel: Often 8 or more lines (wire conductors) are used to transfer
data to a device that is only few feet away.
2. Serial: To transfer to a device located many meters away, the serial
method is used. The data is sent one bit at a time.
30
Fig: Mode of Communication
At the transmitting end, the byte of data must be converted to serial bits using
parallel-in-serial-out shift register. At the receiving end, there is a serial-in-
parallel-out shift register to receive the serial data and pack them into byte.
When the distance is short, the digital signal can be transferred as it is on a
simple wire and requires no modulation. If data is to be transferred on the
telephone line, it must be converted from 0s and 1s to audio tones. This
conversion is performed by a device called a modem,
Modulator/demodulator”.
Serial data communication uses two methods. First are synchronous
method transfers a block of data at a time. Second is an asynchronous
method transfer a single byte at a time.
It is possible to write software to use either of these methods, but the
programs can be tedious and long. There are special IC chips made by many
manufacturers for serial communications namely UART (universal
asynchronous Receiver-transmitter) & USART (universal synchronous-
asynchronous Receiver-transmitter).
31
Fig: Diagrammatic Simplex & Duplex Transmission
A protocol is a set of rules agreed by both the sender and receiver.
Asynchronous serial data communication is widely used for character-oriented
transmissions where each character is placed in between start and stop bits,
this is called framing and block-oriented data transfers use the synchronous
method. The start bit is always one bit, but the stop bit can be one or two bits
the start bit is always a 0 (low) and the stop bit(s) is 1 (high).
Fig: Transmissions of Data
Due to the extended ASCII characters, 8-bit ASCII data is common in
modern PCs the use of one stop bit is standard. Assuming that we are
transferring a text file of ASCII characters using 1 stop bit, we have a total of
32
10 bits for each character. In some systems in order to maintain data integrity,
the parity bit of the character byte is included in the data frame. The rate of
data transfer in serial data communication is stated in bps (bits per second).
Another widely used terminology for bps is baud rate. As far as the
conductor wire is concerned, the baud rate and bps are the same, and we use
the terms interchangeably. The data transfer rate of given computer system
depends on communication ports incorporated into that system.
An interfacing standard RS232 was set by the Electronics Industries
Association (EIA) in 1960. The standard was set long before the advent of the
TTL logic family, its input and output voltage levels is not TTL compatible
where a 1 is represented by -3 ~ -25 V, while a 0 bit is +3 ~ +25 V, making -3
to +3 undefined.
8051 has two pins that are used specifically for transferring and receiving data
serially. These two pins are called TxD and RxD and are part of the port 3
group (P3.0 and P3.1).These pins are TTL compatible; therefore, they require
a line driver to make them RS232 compatible. To allow data transfer between
the PC and an 8051 system without any error, we must make sure that the
baud rate of 8051 system matches the baud rate of the PC’s COM port.
5.5 MAX 232:
The MAX232 is an integrated circuit that converts signals from an RS-
232 serial port to signals suitable for use in TTL compatible digital logic
circuits. The MAX232 is a dual driver/receiver and typically converts the RX,
TX, CTS and RTS signals. The drivers provide RS-232 voltage level outputs
(approx. ± 7.5 V) from a single + 5 V supply via on-chip charge pumps and
external capacitors. This makes it useful for implementing RS-232 in devices
that otherwise do not need any voltages outside the 0 V to + 5 V range,
as power supply design does not need to be made more complicated just for
driving the RS-232 in this case.
33
The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to
standard 5 V TTL levels. These receivers have a typical threshold of 1.3 V,
and a typical hysteresis of 0.5 V.The later MAX232A is backwards compatible
with the original MAX232 but may operate at higher baud rates and can use
smaller external capacitors – 0.1 μF in place of the 1.0 μF capacitors used
with the original device. The newer MAX3232 is also backwards compatible,
but operates at a broader voltage range, from 3 to 5.5V. Voltage levels It is
helpful to understand what occurs to the voltage levels. When a MAX232 IC
receives a TTL level to convert, it changes a TTL Logic 0 to between +3 and
+15V, and changes TTL Logic 1 to between -3 to -15V, and vice versa for
converting from RS232 to TTL.
This can be confusing when you realize that the RS232 Data Transmission
voltages at a certain logic state are opposite from the RS232 Control Line
voltages at the same logic state. To clarify the matter, see the table below. For
more information seeRS-232 Voltage Levels
RS232 Line Type & Logic LevelRS232
Voltage
TTL Voltage
to/from MAX232
Data Transmission (Rx/Tx) Logic
0
+3V to
+15V0V
Data Transmission (Rx/Tx) Logic
1-3V to -15V 5V
Control Signals
(RTS/CTS/DTR/DSR) Logic 0-3V to -15V 5V
Control Signals
(RTS/CTS/DTR/DSR) Logic 1
+3V to
+15V0V
SCHEMATIC OF MAX 232
34
DB9 CONNECTOR:
The DB9 (originally DE-9) connector is an analog 9-pin plug of the D-
Subminiature connector family (D-Sub or Sub-D).
The DB9 connector is mainly used for serial connections, allowing for the
asynchronous transmission of
data as provided for by standard
RS-232 (RS- 232C).
Note that there are DB9-DB25
adapters for easily converting
a DB9 plug into a DB25, and vice
versa.
35
Pin
number Name
1 CD - Carrier Detect
2 RXD - Receive Data
3 TXD - Transmit Data
4 DTR - Data Terminal Ready
5 GND - Signal Ground
6 DSR - Data Set Ready
7 RTS - Request To Send
8 CTS - Clear To Send
9 RI - Ring Indicator Shield
6. REGULATED POWER SUPPLY
DESCRIPTION
A variable regulated power supply, also called a variable bench power
supply, is one where you can continuously adjust the output voltage to your
requirements. Varying the output of the power supply is the recommended
way to test a project after having double checked parts placement against
circuit drawings and the parts placement guide.
This type of regulation is ideal for having a simple variable bench power
supply. Actually this is quite important because one of the first projects a
hobbyist should undertake is the construction of a variable regulated power
supply. While a dedicated supply is quite handy e.g. 5V or 12V, it's much
handier to have a variable supply on hand, especially for testing.
Most digital logic circuits and processors need a 5-volt power supply. To
use these parts we need to build a regulated 5-volt source. Usually you start
with an unregulated power supply ranging from 9 volts to 24 volts DC (A 12
volt power supply is included with the Beginner Kit and the Microcontroller
36
Beginner Kit.). To make a 5 volt power supply, we use a LM7805 voltage
regulator IC (Integrated Circuit). The IC is shown below.
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.
CIRCUIT FEATURES:
Brief description of operation: Gives out well regulated +5V output, output
current capability of 100 mA
Circuit protection: Built-in overheating protection shuts down output when
regulator IC gets too hot
Circuit complexity: Very simple and easy to build
Circuit performance: Very stable +5V output voltage, reliable operation
Availability of components: Easy to get, uses only very common basic
components
Design testing: Based on datasheet example circuit, I have used this circuit
successfully as part of many electronics projects
37
Applications: Part of electronics devices, small laboratory power supply
Power supply voltage: Unregulated DC 8-18V power supply
Power supply current: Needed output current + 5 mA
Component costs: Few dollars for the electronics components + the input
transformer cost.
BLOCK DIAGRAM:
38
Fig : Power Supply Circuit Diagram
This 5V dc acts as Vcc to the microcontroller. The excess voltage is dissipated
as heat via an Aluminum heat sink attached to the voltage regulator.
Bridge Rectifier:
A diode bridge is an arrangement of four diodes connected in a bridge circuit
as shown below, that provides the same polarity of output voltage for any
polarity of the input voltage. When used in its most common application, for
conversion of alternating current (AC) input into direct current (DC) output, it is
known as a bridge rectifier. The diagram describes a diode-bridge design
known as a full-wave rectifier. This design can be used to rectify single phase
AC when no transformer center tap is available. 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.
39
Typical Bridge Rectifier
For both positive and negative swings of the transformer, there is a Forward
path through the diode bridge. Both conduction paths cause Current to flow in
the same direction through the load resistor, accomplishing full-wave
rectification. While one set of diodes is forward biased, the other set is
reverse biased and effectively eliminated from the circuit.
Current Flow in the Bridge Rectifier
Current in Bridge Rectifier for +ve half cycle
Current in Bridge Rectifier for -ve half cycle
40
LM7805
3-Terminal 1A Positive Voltage Regulator
Features
• Output Current up to 1A
• Thermal Overload Protection
• Short Circuit Protection
• Output Transistor Safe Operating Area Protection
Description
The MC7805 three terminal positive regulators are available in the TO-220/D-
PAK package and with several fixed output voltages, making them useful in a
wide range of applications. Each type employs internal current limiting,
thermal shut down and safe operating area protection, making it essentially
indestructible. If adequate heat sinking is provided, they can deliver over 1A
output current. Although designed primarily as fixed voltage regulators, these
devices can be used with external components to obtain adjustable voltages
and currents.
41
Fig Different Packages
Internal Block Diagram
Electrical Characteristics of MC7805/LM7805
Note:
42
Load and line regulation are specified at constant junction temperature.
Changes in Vo due to heating effects must be taken into account separately.
Pulse testing with low duty is used.
Note:
Load and line regulation are specified at constant junction temperature.
Change in VO due to heating effects must be taken into account separately.
Pulse testing with low duty is used.
43
Quiescent Current Peak Output Current
Output Voltage Quiescent Current
codingvoid CheckForFile()
int j,i,count;char c;double elapsed_time;time_t start,finish;
if (_dos_findfirst("*.spt",_A_NORMAL,&c_file) == 0)
44
printf("FILE:%s of %ld bytes\n",c_file.name,c_file.size);process_sms_command();
while (_dos_findnext(&c_file) == 0)
printf("FILE %s of %ld bytes\n",c_file.name,c_file.size);
process_sms_command();
oneloop++;else
printf("no files to process\n");time(&start);elapsed_time = 0.0;printf("WAITING 3 seconds\n");
while (elapsed_time < 3.0)
time(&finish);elapsed_time = difftime(finish,start);
This is part of the procedure which translates the message to X10 command command void process_sms_command()
double elapsed_time;time_t start,finish;FILE *fd;char spbuf[256];int i, numread,cmdcode;
if(validate()) // validates that user is authorized by checking users.txt
if ((fd = fopen(c_file.name,"r")) != NULL)
numread = fread(spbuf, sizeof(char), c_file.size, fd);fclose(fd);remove(c_file.name);cmd = spbuf[35];dev = spbuf[37] - '0';house = spbuf[36];printf("COMMAND WAS %c for house %c device %d\
n",cmd,house,dev);cmdcode = -1;
switch (cmd) case 'ON':
cmdcode =19; break;
case 'OFF': cmdcode =27; break;
45
default: break;
printf("cmdcode = %d\n",cmdcode);
if (cmdcode > -1) PutX10(house,dev);PutX10(house,cmdcode);
time(&start);elapsed_time = 0.0;printf("WAITING 3 seconds\n");
while (elapsed_time < 3.0)
time(&finish);elapsed_time = difftime(finish,start);
else
printf("invalid command\n");
else
printf("Unauthorized access");
This procedure calls TW523GS with appropriate arpgument void PutX10 (char House, int Key) int Result; Result = TW523GS(0x8000 + (((int)(House) & 0x1F) << 8) + Key);
Actual function which sends the X10 command int TW523GS(int DataIn) int temp; _asm MOV AX,DataIn INT SoftwareInterrupt MOV temp,AX return temp;
7. BIBLIOGRAPHY
1. HAND BOOK OF ELECTRONICS BY Ramakanth Gaikwada.
2. 101science.com
46
3. Datasheets4u.com
4. Wikipedia.com
5. Scribd.com
6. www.seminarprojects.com
47