coal mine detection robot

99
1. INTRODUCTION What is a robot? A robot is a mechanical or virtual intelligent agent that can perform tasks automatically or with guidance, typically by remote control. In practice a robot is usually an electro- mechanical machine that is guided by computer and electronic programming Robots can be autonomous , semi-autonomous or remotely controlled. Autonomous robots are robots that can perform desired tasks in unstructured environments without continuous human guidance. By using sensors and predefined programming. Semi autonomous robots are nothing but remote controlled robots .they may controlled by wired or wireless. Why robots required? Robots are required because Industry has benefited drastically from the expanse of a robotic work force. Automated machines have taken over the duties of dangerous and mundane jobs from humans, allowing greater productivity. Because robots never tire, extra shifts have been added to factories. Farmers have taken advantage of new technology with automated harvesters, the waste disposal industry has implemented robots in some of its dirtier jobs, and the medical industry benefits from advancements in assisted surgical robotics. The idea of a factory with no human workers has come to fruition. IBM runs a "lights off" factory in Texas completely staffed by fully autonomous robots making keyboards. The military has launched various programs in robotic 1

Upload: anand-cool

Post on 29-Oct-2014

125 views

Category:

Documents


6 download

DESCRIPTION

AT89C52

TRANSCRIPT

Page 1: Coal mine detection robot

1. INTRODUCTION

What is a robot?

A robot is a mechanical or virtual intelligent agent that can perform tasks automatically or with guidance, typically by remote control. In practice a robot is usually an electro-mechanical machine that is guided by computer and electronic programming Robots can be autonomous, semi-autonomous or remotely controlled.

Autonomous robots are robots that can perform desired tasks in unstructured environments without continuous human guidance. By using sensors and predefined programming.

Semi autonomous robots are nothing but remote controlled robots .they may controlled by wired or wireless.

Why robots required?

Robots are required because Industry has benefited drastically from the expanse of a robotic work force. Automated machines have taken over the duties of dangerous and mundane jobs from humans, allowing greater productivity. Because robots never tire, extra shifts have been added to factories. Farmers have taken advantage of new technology with automated harvesters, the waste disposal industry has implemented robots in some of its dirtier jobs, and the medical industry benefits from advancements in assisted surgical robotics. The idea of a factory with no human workers has come to fruition. IBM runs a "lights off" factory in Texas completely staffed by fully autonomous robots making keyboards.The military has launched various programs in robotic technology, most successfully the Predator and Reaper unmanned aerial reconnaissance vehicles that allow a pilot to control the robot from vast distances. The vehicles can do high-altitude surveillance for long periods without having to support a live pilot, and when needed, the planes can launch small strikes on targets in zones that normal aircraft cannot operate.

What is coal mine rescue robot?

Coal mine robot is autonomous robot i.e. which works without human control comes under embedded system. The robot was controlled by software i.e. robot operates as per the microcontroller programmed. Coal mine rescue robot is robot which is used to find the condition i.e. whether inside the coal mine. It sends the information about situation inside the mine i.e. is the temperature above the predefined value or below the value. It also makes use of LDR and GAS sensor. Gas sensor is used to detect the CO gas present inside coal mine.

1

Page 2: Coal mine detection robot

Embedded Control System Design for Coal Mine Detect and Rescue Robot:

Coal mine detect and rescue robot is robot which detects the gas, light and temperature. It sends the collected results to human interface through ZIGBEE. Coal mine rescue robot also consist a microcontroller for functioning and movement of robot also predefined in programming a pair of IR sensor pairs are used to detect the path and obstacles . Collected results sent to the microcontroller as per microcontroller programming it gives the instructions to the motors for movement. It sends the information throughout its path i.e. detected gas, light and temperature values through the zigbee transmitter, and a receiver is used at receiving end and the received data displayed on the monitor.

This robot also works as obstacle detector, and not only in coal mines but also useful at situation where human entrance is not possible.

2

Page 3: Coal mine detection robot

2. BLOCK DIAGRAM

2.1BLOCK DIAGRAM OF TRANSMITTER:

FIG 2.1 BLOCK DIAGRAM OF ROBOT i.e. TRANSMITTER

2.2BLOCK DIAGRAM OF RECIEVER:

FIG: 2.2 BLOCK DIAGRAM OF RECEIVER

3

Microcontroller

AT89S52

GAS SENSOR

TEMPERATURE SENSOR

LDRPOWER SUPPLY

IR SENSORSZIGBEE TRANSMITTER

DRIVER IC

L293D

DC MOTORS

ZIGBEE RECIEVER

RS 232 CABLE

COMPUTER (MONITOR)

POWER SUPPLY

Page 4: Coal mine detection robot

2.3POWER SUPPLY:

The input to the total circuit is applied is +5V except to the motors( that’s why motor driver is used).this +5V supply can be achieved in two ways one is regulated power supply and the second is using battery.

Regulated Power Supply:

The block diagram of regulated power as follows

Transformer (step down) is used to provide the AC supply to the circuit. AC supply is applied to the rectifier. Rectifier converts ac signal to poor DC signal output of rectifier is applied to the filter so that pulsating DC is obtained which contain very small amount of ripples. And this signal is applied to the regulator so that regulated pure DC signal is obtained i.e. +5V.

Using Battery:

This is most widely used method in preparation of autonomous robots. A +12V battery is used as supply. And regulator is used to obtain the required power supply(+5V)

4

DC SUPPLY (+12V BATTERY)

REGULATOR

LOAD

Page 5: Coal mine detection robot

Gas Sensor:

Gas sensor is used to detect the dangerous gases such as CO. in this circuit gas sensor is used to determine whether the CO is present or absent i.e. is it CO gas concentration normal or abnormal inside the mine.gas sensor works on the principle of electrolytic reaction.

Light dependent resistor:

LDR i.e. light dependent resistor is photoconductive device .here LDR is used to detect the light amount inside the coal mine.

Temperature Sensor:

Temperature sensor is used here to know temperature inside the mine i.e. is the temperature inside the mine is normal or abnormal.

IR SENSORS:

IR sensors are used here to detect the obstacles on its way. As per the response of IR sensors, microcontroller decides the motors rotation.

ZIGBEE TRANSMITTER:

ZIGBEE transmitter is used to send the collected data to the receiver.

Motor Driver:

As we know the total circuit runs on the voltage of +5Vexcept the motor. To run a motor +12V supply is required. So that to clamp the +5V signal to +12V motor driver is used.

DC motors:

DC motors are used for movement of the robot.

Microcontroller:

8052 microcontroller is used in this circuit which belongs to 8051 family. it is used to control the all sensors ,control the movement of the robot and also to send the collected data through ZIGBEE. Simply to control all hardware parts using software microcontroller is used.

ZIGBEE Receiver:

ZIGBEE receiver is used to receive the data which is transmitted by the transmitter.

RS 232:

5

Page 6: Coal mine detection robot

RS232 is used to interface the ZIGBEE receiver to the computer.

3. CIRCUIT DIAGRAM

Fig: circuit diagram of transmitter i.e. robot

6

Page 7: Coal mine detection robot

Fig: circuit diagram of receiver.

3.1.POWER SUPPLY:

3.1.1 Battery:

As it is an autonomous robot a battery (+12V) is used on the robot. Required voltages are obtained by using regulators.

Power supply is source of power in circuit. Normally two types of supplies are available those are one AC supply and another is DC supply.

Here in this project we are using a DC power supply to avoid the regulator circuit and as this is a autonomous robot no external wire connections are expectable so that we are using DC power supply . a +12v battery is use d as power supply in this project. And used voltage levels derived from this supply only and it is placed on base . as battery is heavy device it may cause speed drop in motor speed.

3.1.2. REGULATOR (7805):

7

Page 8: Coal mine detection robot

7805

PIN DIAGRAM:

Features

• Output Current up to 1A

• Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V

• Thermal Overload Protection

• Short Circuit Protection

• Output Transistor Safe Operating Area Protection

Description

The LM78XX/LM78XXA series of 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 shutdown 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.

Absolute Maximum Ratings

8

Page 9: Coal mine detection robot

Internal Block Diagram

BLOCK DIAGRAM OF VOLTAGE REGULATOR 7805

9

Page 10: Coal mine detection robot

3.2. INPUT SECTION:

3.2.1. GAS SENSOR:

GAS SENSOR:

INTRODUCTION:

A CO gas sensor according to the present invention includes a gas collecting container for collecting a measured gas therein; a detecting section provided within the gas collecting container and having at least a pair of electrodes positioned through electrolyte; and a voltage applying apparatus for applying voltage to the detecting section. One of the electrodes of the detecting section is a detection electrode having the capability of adsorbing at least one of hydrogenous gas and CO gas when a voltage is applied and then oxidizing it. By introducing a measured gas into a gas collecting container of the CO gas sensor and carrying out electrolysis according to a potential sweep method or a pulse method with the measured gas being in contact with the detecting section, a CO gas concentration in the measured gas can be measured based on an electrical current value obtained at the detecting section and changes of the electrical current with elapse of time. According to the CO gas sensor of the present invention, it is possible to accurately carry out detection and measurement of the concentration of CO gas when CO gas is to be detected or measured even in a gaseous atmosphere containing a relatively large amount of hydrogen gas and CO2 gas.

DESCRIPTION:

10

Page 11: Coal mine detection robot

The present invention relates to a CO gas sensor for measuring the concentration of CO gas contained in a gaseous phase and to a method of measuring the concentration of CO gas, and in particular relates to a CO gas sensor for measuring the concentration of CO gas in a gaseous atmosphere containing relatively high concentrations of hydrogen gas and carbon dioxide gas, a fuel cell power generating apparatus equipped with such CO gas sensor, and a method of measuring the concentration of CO gas.

BACKGROUND

In many cases, hydrogen gas is used as a fuel gas for fuel cells. As such hydrogen gas, a hydrogen gas rich reforming gas which is obtained by reforming methanol or the like is used. When manufacturing such a reforming gas, a tiny amount of carbon monoxide (CO), namely several tens ppm to several hundred ppm, is present as impurities. For this reason, when such a reforming gas is used as a fuel gas for a fuel cell, the CO gas is adsorbed on the surface of the platinum catalyst of the fuel cell electrodes, thus hindering ionization of the hydrogen gas and lowering the output of the fuel cell. In order to take appropriate measures to counter such a problem caused by the CO gas, it is necessary to continuously monitor the concentration of CO gas in the reforming gas used in the fuel cell.

Conventionally, as for the most commonly used CO gas sensor, there are known a controlled potential analysis type CO gas sensor and a semiconductor type CO gas sensor. However, for the reasons given below, neither of these CO gas sensors is appropriate for detecting CO gas in a reforming gas.

Namely, the reforming gas contains hydrogen gas used as a fuel in the fuel cell for the amount of about 75% thereof. In comparison with this, the reforming gas contains a relatively tiny amount of CO gas as described above. Therefore, it becomes necessary to detect or measure CO gas in a hydrogen gas atmosphere containing a relatively large amount of hydrogen gas. However, in the case where the concentration of CO gas is measured in such a hydrogen gas rich atmosphere using these CO gas sensors, there is a problem that it is difficult to accurately detect (qualitative analysis) or measure (quantitative analysis) such CO gas with either type of CO gas sensor due to influence of the hydrogen gas rich atmosphere in which interference by hydrogen gas occurs.

In view of the problem mentioned above, it is an object of the present invention to provide a CO gas sensor which can accurately carry out detection (qualitative analysis) and

11

Page 12: Coal mine detection robot

measurement (quantitative analysis) of the concentration of CO gas when CO gas is detected or measured in a gaseous atmosphere containing a relatively large amount of hydrogen gas and carbon dioxide gas, a fuel cell power generating apparatus equipped with such a CO gas sensor, and a method of measuring the concentration of CO gas.

3.2.2 TEMPERATURE SENSOR:

LM335

THERMISTOR (TEMPERATURE SENSOR):

A thermistor is a type of resistor whose resistance varies significantly with temperature, more so than in standard resistors. The word is a portmanteau of thermal and resistor. Thermistors are widely used as inrush current limiters, temperature sensors, self-resetting overcurrent protectors, and self-regulating heating elements.

Thermistors differ from resistance temperature detectors (RTD) in that the material used in a thermistor is generally a ceramic or polymer, while RTDs use pure metals. The temperature response is also different; RTDs are useful over larger temperature ranges, while thermistors typically achieve a higher precision within a limited temperature range, typically −90 °C to 130 °C.

Assuming, as a first-order approximation, that the relationship between resistance and temperature is linear, then:

where

= change in resistance

= change in temperature

12

Page 13: Coal mine detection robot

= first-order temperature coefficient of resistance

Thermistors can be classified into two types, depending on the sign of . If is positive, the resistance increases with increasing temperature, and the device is called a positive temperature coefficient (PTC) thermistor, or posistor. If is negative, the resistance decreases with increasing temperature, and the device is called a negative temperature coefficient (NTC) thermistor. Resistors that are not thermistors are designed to have a as close to zero as possible, so that their resistance remains nearly constant over a wide temperature range.

Instead of the temperature coefficient k, sometimes the temperature coefficient of resistance (alpha sub T) is used. It is defined as[2]

This coefficient should not be confused with the parameter below.

3.2.3.LDR:

Light dependent resistors or LDRs are often used in circuits where it is necessary to detect the presence or the level of light. They can be described by a variety of names from light dependent resistor, LDR, photoresistor, or even photo cell (photocell) or photoconductor.

Although other devices such as photodiodes or photo-transistor can also be used, LDRs are a particularly convenient electronics component to use. They provide large change in resistance for changes in light level.

In view of their low cost, ease of manufacture, and ease of use LDRs have been used in a variety of different applications. At one time LDRs were used in photographic light meters, and even now they are still used in a variety of applications where it is necessary to detect light levels.

13

Page 14: Coal mine detection robot

A photoresistor or light dependent resistor is a component that is sensitive to light. When light falls upon it then the resistance changes. Values of the resistance of the LDR may change over many orders of magnitude the value of the resistance falling as the level of light increases.

It is not uncommon for the values of resistance of an LDR or photoresistor to be several megohms in darkness and then to fall to a few hundred ohms in bright light. With such a wide variation in resistance, LDRs are easy to use and there are many LDR circuits available.

LDRs are made from semiconductor materials to enable them to have their light sensitive properties. Many materials can be used, but one popular material for these photoresistors is cadmium sulphide (CdS).

It is relatively easy to understand the basics of how an LDR works without delving into complicated explanations. It is first necessary to understand that an electrical current consists of the movement of electrons within a material. Good conductors have a large number of free electrons that can drift in a given direction under the action of a potential difference. Insulators with a high resistance have very few free electrons, and therefore it is hard to make the them move and hence a current to flow.

An LDR or photo resistor is made any semiconductor material with a high resistance. It has a high resistance because there are very few electrons that are free and able to move - the vast majority of the electrons are locked into the crystal lattice and unable to move. Therefore in this state there is a high LDR resistance.

As light falls on the semiconductor, the light photons are absorbed by the semiconductor lattice and some of their energy is transferred to the electrons. This gives some of them sufficient energy to break free from the crystal lattice so that they can then conduct electricity. This results in a lowering of the resistance of the semiconductor and hence the overall LDR resistance.

The process is progressive, and as more light shines on the LDR semiconductor, so more electrons are released to conduct electricity and the resistance falls further.

3.2.4.IR SENSORS:

14

Page 15: Coal mine detection robot

IR SENSOR is used to detect the obstacles In its way working of sensors as follows

3.3 PROCESSING SECTION

3.3.1 AT89S32:

Features

• Compatible with MCS®-51 Products

• 8K Bytes of In-System Programmable (ISP) Flash Memory

– Endurance: 10,000 Write/Erase Cycles

• 4.0V to 5.5V Operating Range

15

Page 16: Coal mine detection robot

• Fully Static Operation: 0 Hz to 33 MHz

• Three-level Program Memory Lock

• 256 x 8-bit Internal RAM

• 32 Programmable I/O Lines

• Three 16-bit Timer/Counters

• Eight Interrupt Sources

• Full Duplex UART Serial Channel

• Low-power Idle and Power-down Modes

• Interrupt Recovery from Power-down Mode

• Watchdog Timer • Dual Data Pointer

• Power-off Flag • Fast Programming Time

• Flexible ISP Programming (Byte and Page Mode)

• Green (Pb/Halide-free) Packaging Option

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 pinout. The on-chip Flash allows the program memory to be

reprogrammed in-system or by a conventional nonvolatile memory pro-grammer. 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 applications. The AT89S52 provides the

following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog

16

Page 17: Coal mine detection robot

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 con-tents but freezes the oscillator, disabling all other chip

functions until the next interrupt or hardware reset.

Block Diagram

17

Page 18: Coal mine detection robot

PIN CONFIGURATIONSPIN CONFIGURATIONS

18

Page 19: Coal mine detection robot

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

19

Page 20: Coal mine detection robot

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 dur-ing

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 follow-ing 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

inter-nal 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 dur-ing accesses to

external data memory that use 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

use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function

20

Page 21: Coal mine detection robot

Register. Port 2 also receives the high-order address bits and some control signals during

Flash program-ming and verification.

Port Pin Alternate Functions

P1.0 T2 (external count input to Timer/Counter 2), clock-out P1.1 T2EX (Timer/Counter 2

capture/reload trigger and direction control) P1.5 MOSI (used for In-System Programming)

P1.6 MISO (used for In-System Programming) P1.7 SCK (used for In-System

Programming)5 1919D–MICRO–6/

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

inter-nal 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 receives some control

signals for Flash programming and verification. Port 3 also serves the functions of various

special features of the AT89S52, as shown in the fol-lowing table.

RST:

21

Page 22: Coal mine detection robot

Reset input. A high on this pin for two machine cycles while the oscillator is running resets

the device. This pin drives high for 98 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 dur-ing 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 exter-nal

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.

22

Page 23: Coal mine detection robot

XTAL2:

Output from the inverting oscillator amplifier.

Special Function Registers:

A map of the on-chip memory area called the Special Function Register (SFR) space is

shown in Table 5-1. Note that not all of the addresses are occupied, and unoccupied

addresses may not be imple-mented 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 5- 2) and T2MOD

(shown in Table 10-2) 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.

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.

23

Page 24: Coal mine detection robot

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 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 14-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 over-flows, it will drive an output RESET HIGH pulse at the RST pin.

UART :

The UART in the AT89S52 operates the same way as the UART in the AT89S52 and

AT89C52.

Timer 0 and 1:

24

Page 25: Coal mine detection robot

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

AT89S52 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 5-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 10-1. 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 oscil-lator frequency.

In the Counter function, the register is incremented in response to a 1-to-0 transition at its

corre-sponding 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:

25

Page 26: Coal mine detection robot

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 transi-tion 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 illus-trated in Figure 10-1.

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 10-2). 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.

Baud Rate Generator:

Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON

(Table 5-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 11-1. 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 fol-lowing equation. The Timer can be configured for either

timer or counter operation. In most applications, it is con-figured 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 11-1. This figure is valid only if RCLK or TCLK = 1 in

26

Page 27: Coal mine detection robot

T2CON. Note that a rollover in TH2 does not set TF2 and will not generate an inter-rupt.

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 12-1.

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 (for 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

27

Page 28: Coal mine detection robot

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 gen-erator 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 13-1. 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 13-1 shows that bit

position IE.6 is unimplemented. User software should not write a 1 to this bit position, since

it may be used in future AT89 products. Timer 2 interrupt is generated by the logical OR of

28

Page 29: Coal mine detection robot

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 16-1. 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 16-2. There

are no requirements on the duty cycle of the external clock signal, since the input to the

internal clock-ing circuitry is through a divide-by-two flip-flop, but minimum and maximum

voltage high and low time specifications must be observed.

29

Page 30: Coal mine detection robot

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 regis-ters 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 pro-gram 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.

Oscillator Connections

30

Page 31: Coal mine detection robot

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 Modes” (Table 22-1) and Figure 22-1 and Figure 22-2.

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

31

Page 32: Coal mine detection robot

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.

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 a 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.

3.3.2.LM324:

32

Page 33: Coal mine detection robot

Features:

Internally frequency compensated for unity gain

large DC gain: 100 dB

wide operating voltage that is 3v to 32v

input common mode voltage will include ground

large output swing that is from 0 to Vcc-1.5v

power drain is suitable for battery operation

LM324 is a 14pin IC consisting of four independent operational amplifiers (op-amps)

compensated in a single package. Op-amps are high gain electronic voltage amplifier with

differential input and, usually, a single-ended output. The output voltage is many times

higher than the voltage difference between input terminals of an op-amp.

These op-amps are operated by a single power supply LM324 and need for a dual supply is eliminated. They can be used as amplifiers, comparators, oscillators, rectifiers etc. The conventional op-amp applications can be more easily implemented with LM324.

The name implies it is an operational amplifier. It performs mathematical operations like

addition, subtraction, log, antilog etc. The main reason for OPAMPS used over transistors is

that transistor can only amplify AC while OPAMPS can amplify AC and DC. You can get

33

Page 34: Coal mine detection robot

good amplifier gain in OPAMPS. The most commonly used OPAMPS are 741 and 324.

IC741 is used in close loop configuration and LM324 in open loop configuration. i.e LM324

mainly used as comparator while 741 for amplification, addition etc... COMPARATOR

(LM324) Comparator is a digital IC. The difference between the analog IC and digital IC is

that in digital IC the output has only two states, while in analog IC it has more than two

states. IC7404, it has two states LOGIC HIGH and LOGIC LOW,IC555 is also digital IC.

IC741 is an analog IC because it has output voltage vary from -12v to 12V. Comparator has

only two states +vcc or -vcc But LM324 we normally apply Vcc=5V and -vcc=0. So output

will have only 5V and 0V. But LM324 output LOGIC HIGH will be aroundVcc-1.5V and

LOGIC LOW around .2V. So if you use Vcc=5V then LOGIC HIGH=3.5V and LOGIC

LOW=0V. But LOGIC HIGH for a digital circuit is a voltage greater than 2.4V and LOGIC

LOW is less than .8V Above figure shows the general circuit diagram of a general

comparator. If V1>V2 then Vout=+Vcc and if V1<V2 then Vout=-Vcc. Suppose if V1=V2,

then output will be +vcc or -vcc theoretically. But practically no such condition exist,

because an operational amplifier has a gain of 10^6, so there is no condition exist. Here you

can use 1Kpot or 10Kpot instead of 470ohm potentiometer. Connect this circuit and start

testing comparator LM324. 1. Insert IC properly into the breadboard. 2. Apply Vcc=+5v and

-Vcc=0V 3. This circuit is used to test 324 the four operational amplifiers before using in the

circuit. 4. Vary V1 and V2 to see the Vout. 5. Use multimeter or LED to see Vout and test

the conditions of a comparator. This circuit is used to turn ON light or any equipment if the

light intensity is below a level. This level is set by 470ohm pot (i.e, V2 is the reference). You

can make the same circuit using power transistor, but difference between two. When Vcc=5V

and I apply v+=10v and v-=4.5 then output is 3.84 when Vcc=12V same input o/p 11.45 so

be careful of vcc of Lm324 TIPS: 1. When u connect Vcc of Lm324 to gnd, then it will

easily get heated. 2. The input cannot be greater than Vcc 3. You should remember that when

using multiple voltages, Vcc should be greater than maximum voltage. Otherwise you will

get wrong results. Why Comparator is preferred over Power Transistor? In robotics we

require only two levels, active HIGH or active LOW that exist in comparator, but in power

transistor there is regions between cut off and saturation, so that output varies with the input

voltage at the base. Second thing is that power transistor is a current controlled device. But

34

Page 35: Coal mine detection robot

we always require voltage comparison, so we prefer comparator. But comparator outputs

cannot be connected directly to the relay or motors.

3.4 COMMUNICATION SECTION(ZIGBEE):

ZIGBEE:

ZigBee is a low-cost, low-power, wireless mesh networking proprietary standard. The low

cost allows the technology to be widely deployed in wireless control and monitoring

applications, the low power-usage allows longer life with smaller batteries, and the mesh

networking provides high reliability and larger range.

The ZigBee Alliance, the standards body that defines ZigBee, also publishes application

profiles that allow multiple OEM vendors to create interoperable products. The current list of

application profiles either published or in the works are:

•Home Automation

•ZigBee Smart Energy

•Commercial Building Automation

•Telecommunication Applications

35

Page 36: Coal mine detection robot

•Personal, Home, and Hospital Care

•Toys

ZigBee coordinator(ZC): The most capable device, the coordinator forms the root of the

network tree and might bridge to other networks. There is exactly one ZigBee coordinator in

each network since it is the device that started the network originally. It is able to store

information about the network, including acting as the Trust Centre & repository for security

keys.

ZigBee Router (ZR): As well as running an application function a router can act as an

intermediate router, passing data from other devices.

ZigBee End Device (ZED): Contains just enough functionality to talk to the parent node

(either the coordinator or a router); it cannot relay data from other devices. This relationship

allows the node to be asleep a significant amount of the time thereby giving long battery life.

A ZED requires the least amount of memory, and therefore can be less expensive to

manufacture than a ZR or ZC.

Protocols

The protocols build on recent algorithmic research (Ad-hoc On-demand Distance Vector,

neuRFon) to automatically construct a low-speed ad-hoc network of nodes. In most large

network instances, the network will be a cluster of clusters. It can also form a mesh or a

single cluster. The current profiles derived from the ZigBee protocols support beacon and

non-beacon enabled networks.

In non-beacon-enabled networks (those whose beacon order is 15), an unslotted CSMA/CA

channel access mechanism is used. In this type of network, ZigBee Routers typically have

their receivers continuously active, requiring a more robust power supply. However, this

allows for heterogeneous networks in which some devices receive continuously, while others

only transmit when an external stimulus is detected. The typical example of a heterogeneous

network is a wireless light switch: the ZigBee node at the lamp may receive constantly, since

36

Page 37: Coal mine detection robot

it is connected to the mains supply, while a battery-powered light switch would remain

asleep until the switch is thrown. The switch then wakes up, sends a command to the lamp,

receives an acknowledgment, and returns to sleep. In such a network the lamp node will be at

least a ZigBee Router, if not the ZigBee Coordinator; the switch node is typically a ZigBee

End Device.

In beacon-enabled networks, the special network nodes called ZigBee Routers transmit

periodic beacons to confirm their presence to other network nodes. Nodes may sleep between

beacons, thus lowering their duty cycle and extending their battery life. Beacon intervals may

range from 15.36 milliseconds to 15.36 ms * 214 = 251.65824 seconds at 250 kbit/s, from 24

milliseconds to 24 ms * 214 = 393.216 seconds at 40 kbit/s and from 48 milliseconds to 48

ms * 214 = 786.432 seconds at 20 kbit/s. However, low duty cycle operation with long

beacon intervals requires precise timing, which can conflict with the need for low product

cost.

In general, the ZigBee protocols minimize the time the radio is on so as to reduce power use.

In beaconing networks, nodes only need to be active while a beacon is being transmitted. In

non-beacon-enabled networks, power consumption is decidedly asymmetrical: some devices

are always active, while others spend most of their time sleeping.

ZigBee devices are required to conform to the IEEE 802.15.4-2003 Low-Rate Wireless

Personal Area Network (WPAN) standard. The standard specifies the lower protocol layers

—the physical layer (PHY), and the medium access control (MAC) portion of the data link

layer (DLL). This standard specifies operation in the unlicensed 2.4 GHz, 915 MHz and 868

MHz ISM bands. In the 2.4 GHz band there are 16 ZigBee channels, with each channel

requiring 5 MHz of bandwidth. The center frequency for each channel can be calculated as,

FC = (2405 + 5 * (ch - 11)) MHz, where ch = 11, 12, ..., 26.

The radios use direct-sequence spread spectrum coding, which is managed by the digital

stream into the modulator. BPSK is used in the 868 and 915 MHz bands, and orthogonal

QPSK that transmits two bits per symbol is used in the 2.4 GHz band. The raw, over-the-air

data rate is 250 kbit/s per channel in the 2.4 GHz band, 40 kbit/s per channel in the 915 MHz

band, and 20 kbit/s in the 868 MHz band. Transmission range is between 10 and 75(up to

37

Page 38: Coal mine detection robot

1500meteres for zigbee pro.)meters (33 and 246 feet), although it is heavily dependent on the

particular environment. The maximum output power of the radios is generally 0 dBm (1

mW).

The basic channel access mode is "carrier sense, multiple access/collision avoidance"

(CSMA/CA). That is, the nodes talk in the same way that people converse; they briefly check

to see that no one is talking before they start. There are three notable exceptions to the use of

CSMA. Beacons are sent on a fixed timing schedule, and do not use CSMA. Message

acknowledgments also do not use CSMA. Finally, devices in Beacon Oriented networks that

have low latency real-time requirements may also use Guaranteed Time Slots (GTS), which

by definition do not use CSMA.

Software and hardware

The software is designed to be easy to develop on small, inexpensive microprocessors. The

radio design used by ZigBee has been carefully optimized for low cost in large scale

production. It has few analog stages and uses digital circuits wherever possible.

Even though the radios themselves are inexpensive, the ZigBee Qualification Process

involves a full validation of the requirements of the physical layer. This amount of concern

about the Physical Layer has multiple benefits, since all radios derived from that

semiconductor mask set would enjoy the same RF characteristics. On the other hand, an

uncertified physical layer that malfunctions could cripple the battery lifespan of other devices

on a ZigBee network. Where other protocols can mask poor sensitivity or other esoteric

problems in a fade compensation response, ZigBee radios have very tight engineering

constraints: they are both power and bandwidth constrained. Thus, radios are tested to the

ISO 17025 standard with guidance given by Clause 6 of the 802.15.4-2006 Standard. Most

vendors plan to integrate the radio and microcontroller onto a single chip.

Controversy

An academic research group has examined the Zigbee address formation algorithm in the

2006 specification, and argues[6] that the network will isolate many units that could be

38

Page 39: Coal mine detection robot

connected. The group proposed an alternative algorithm with similar complexity in time and

space.

A white paper published by a European manufacturing group (associated with the

development of a competing standard, Z-Wave) claims that wireless technologies such as

ZigBee, which operate in the 2.4 GHz RF band, are subject to significant interference -

enough to make them unusable.[7] It claims that this is due to the presence of other wireless

technologies like Wireless LAN in the same RF band. The ZigBee Alliance released a white

paper refuting these claims.[8] After a technical analysis, this paper concludes that ZigBee

devices continue to communicate effectively and robustly even in the presence of large

amounts of interference.

3.5.OUTPUT SECTION

3.5.1.L293D&DC MOTORS:

Principles of operation

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.

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).

39

Page 40: Coal mine detection robot

Every DC motor has six basic parts -- axle, rotor (a.k.a., AVRature), 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

40

Page 41: Coal mine detection robot

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, 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 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:

41

Page 42: Coal mine detection robot

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.

Luckily for you, I've gone ahead and done this in your stead. The guts of a disassembled

Mabuchi FF-030-PN motor (the same model that Solarbotics sells) are available for you to

see here (on 10 lines / cm graph paper). This is a basic 3-pole DC motor, with 2 brushes and

three commutator contacts.

The use of an iron core AVRature (as in the Mabuchi, above) is quite common, and has a

number of advantages2. First off, the iron core provides a strong, rigid support for the

windings -- a particularly important consideration for high-torque motors. The core also

conducts heat away from the rotor windings, allowing the motor to be driven harder than

might otherwise be the case. Iron core construction is also relatively inexpensive compared

with other construction types.

But iron core construction also has several disadvantages. The iron AVRature has a relatively

high inertia which limits motor acceleration. This construction also results in high winding

inductances which limit brush and commutator life.

42

Page 43: Coal mine detection robot

In small motors, an alternative design is often used which features a 'coreless' AVRature

winding. This design depends upon the coil wire itself for structural integrity. As a result, the

AVRature is hollow, and the permanent magnet can be mounted inside the rotor coil.

Coreless DC motors have much lower AVRature inductance than iron-core motors of

comparable size, extending brush and commutator life.

Diagram courtesy of MicroMotor

The coreless design also allows manufacturers to build smaller motors; meanwhile, due to the

lack of iron in their rotors, coreless motors are somewhat prone to overheating. As a result,

this design is generally used just in small, low-power motors. BEAMers will most often see

coreless DC motors in the form of pager motors.

43

Page 44: Coal mine detection robot

Again, disassembling a coreless motor can be instructive --

in this case, my hapless victim was a cheap pager vibrator

motor. The guts of this disassembled motor are available

for you to see here (on 10 lines / cm graph paper). This is

(or more accurately, was) a 3-pole coreless DC motor.

I disembowel 'em so you don't have to...

To get the best from DC motors in BEAMbots, we'll need to take a closer look at DC motor

behaviors -- both obvious and not.

DRIVER IC:

WORKING THEORY OF H-BRIDGE:

The name H-bridge is derived from the actual shape of the switching circuit which

controls the motion of the motor. It is also known as “ Full Bridge”. Basically there are four

switching elements in the H-bridge as shown in the figure below.

44

Page 45: Coal mine detection robot

As shown in the above figure there are four switching elements named as “High side left”,

“high side right”, “low side left”, “low side right”. When these switches are turned on in

pairs motor changes its direction accordingly. Like if we switch on high side left and low

side right then the motor rotates in forward direction., as the current flows from P\power

supply through the motor coil goes to the ground via switch low side right. This is the figure

shown below.

Similarly if we switch on the low side left and high side right the current flows in opposite

direction and motor runs in forward direction. This is the basic working of H-Bridge Motor.

L293D Dual H-Bridge Motor Driver:

45

Page 46: Coal mine detection robot

L293D is a dual H-Bridge motor Driver, so with one IC we can interface two DC motors

which can be controlled in both clock wise and anti clock wise directions when we have

motor with fixed direction of motion. We can also make use of all the four I/o’s to connect

up to four DC motors.

L293D has an output current of 600mA and peak output current of 1.2A per channel.

Moreover the protection of the circuit from back EMF output diodes are included within the

IC. The output supply (VCC2) has a wide range from 4.5 V to 36V, which has made L293D

as the best choice for DC motor Driver.

46

Page 47: Coal mine detection robot

As we see in the circuit three pins are needed for interfacing DC motor (A, B, Enable). If we

want the output to be enabled completely then we can connect the enable to VCC and only

two pins needed from the micro controller . As per the truth mentioned in the image above

its fairly simple program to the micro controller. It is also clear from the BJT circuit and

L293D the programming will be same for both of them, just keep in mind of the allowed

combinations of the A and B.

3.5.2.RS232:

RS232 (serial port).

RS-232 (Recommended Standard - 232) is a telecommunications standard for binary serial

communications between devices. It supplies the roadmap for the way devices speak to each

other using serial ports. The devices are commonly referred to as a DTE (data terminal

equipment) and DCE (data communications equipment); for example, a computer and

modem, respectively.

47

Page 48: Coal mine detection robot

RS232 is the most known serial port used in transmitting the data in communication and

interface. Even though serial port is harder to program than the parallel port, this is the most

effective method in which the data transmission requires less wires that yields to the less

cost. The RS232 is the communication line which enables the data transmission by only

using three wire links. The three links provides ‘transmit’, ‘receive’ and common ground...

 The ‘transmit’ and ‘receive’ line on this connecter send and receive data between the

computers. As the name indicates, the data is transmitted serially. The two pins are TXD &

RXD. There are other lines on this port as RTS, CTS, DSR, DTR, and RTS, RI. The ‘1’ and

‘0’ are the data which defines a voltage level of 3V to 25V and -3V to -25V respectively.

he electrical characteristics of the serial port as per the EIA (Electronics Industry

Association) RS232C Standard specifies a maximum baud rate of 20,000bps, which is slow

compared to today’s standard speed. For this reason, we have chosen the new RS-232D

Standard, which was recently released.

     The RS-232D has existed in two types. i.e., D-TYPE 25 pin connector and D-TYPE 9 pin

connector, which are male connectors on the back of the PC. You need a female connector on

your communication from Host to Guest computer. The pin outs of both D-9 & D-25 are

show below.

D-Type-9 pin

no.

D-Type-25 pin no. Pin outs Function

3 2 RD Receive Data (Serial data input)

2 3 TD Transmit Data (Serial data output)

7 4 RTS Request to send (acknowledge to modem that UART is

ready to exchange data

8 5 CTS Clear to send (i.e.; modem is ready to exchange data)

6 6 DSR Data ready state (UART establishes a link)

5 7 SG Signal ground

48

Page 49: Coal mine detection robot

1 8 DCD Data Carrier detect (This line is active when modem

detects a carrier

4 20 DTR Data Terminal Ready.

9 22 RI Ring Indicator (Becomes active when modem detects

ringing signal from PSTN

 

Rs232

When communicating with various micro processors one needs to convert the RS232 levels

down to lower levels, typically 3.3 or 5.0 Volts. Here is a cheap and simple way to do that.

Serial RS-232 (V.24) communication works with voltages -15V to +15V for  high and low.

On the other hand, TTL  logic operates between 0V and +5V . Modern low power

consumption logic operates in the range of 0V and +3.3V or even lower.

RS-232 TTL Logic

49

Page 50: Coal mine detection robot

-15V …  -3V +2V … +5V High

+3V … +15V 0V … +0.8V  Low

Thus the RS-232 signal levels are far too high TTL electronics, and the negative RS-232

voltage for high can’t be handled at all by computer logic. To receive serial data from an RS-

232 interface the voltage has to be reduced.  Also the low and high voltage level has to be

inverted. This level converter uses a Max232 and five capacitors. The max232 is

quite cheap (less than 5 dollars) or if youre lucky you can get a free sample from Maxim.

The MAX232 from Maxim was the first IC which in one package contains the necessary

drivers and receivers to adapt the RS-232 signal voltage levels to TTL logic. It became

popular, because it just needs one voltage (+5V or +3.3V) and generates the necessary RS-

232 voltage levels.

MAX 232 PIN DIAGRAM

RS232 INTERFACED TO MAX 232

50

Page 51: Coal mine detection robot

J 2

12345

6789

P 3 . 0

5V

C 4

0 . 1 u f

C 7

0 . 1 u f

TXD

C 6

0 . 1 u f

P 3 . 1

T1O U T

C 11u f

T1O U T

U 3

MAX3232 1516

1 38

1 011

1345

26

129

147

GND

VCCR 1 IN

R 2 IN

T2 INT1 IN

C 1+C 1 -C 2+C 2 -

V +V -

R 1O U TR 2O U T

T1O U TT2O U T

C 5

0 . 1 u f

R XD

Rs232 is 9 pin db connector, only three pins of this are used ie 2,3,5 the transmit pin of rs232

is connected to rx pin of microcontroller

Max232 interfaced to microcontroller

51

Page 52: Coal mine detection robot

MAX232 is connected to the microcontroller as shown in the figure above 11, 12 pin are

connected to the 10 and 11 pin ie transmit and receive pin of microcontroller

3.5.3 COMPUTER:

Personal computer is used to display the values.

3.6. INTERFACING WITH MICROCONTROLLER:

Interfacing ZIGBEE to the AT89S52 micro controller:

Zigbee consumes very less power between 2v to 3.6v and it transfers the data

securely which is a wireless serial communication device acts as both transmitter and

receiver called as trans-receiver. Zigbee can be either directly interfaced to the micro

controller without serial communication cable to transfer or with serial communication cable

the data serially through wireless communication. Zigbee is interfaced to the serial port of

8051 controller. The serial pot contains TXD and RXD pins. Here TXD pin is used to

transmit data and RXD pins to receive data. The serial communication in 8051 controller is

half duplex communication. The TXD (pin-11) pin of 8051 is connected to RXD pin of

Zigbee and RXD (pin-10) pin of 8051 is connect to the TXD pin of Zigbee. Here zigbee

module is interfaced serially with the micro controller to either transmit or to receive data.

52

Page 53: Coal mine detection robot

Interfacing RS-232 & MAX-232 to the AT89S52 Micro controller:

The RS232 is the most widely used serial I/O interfacing standard. This is used in

most PC’s and numerous types of equipment. Since this standard was introduced long before

the advent of TTL logic family, its input and output voltage levels are not TTL compatible.

In RS232, a ‘1’ is represented by -3v to -25v, while a ‘0’ bit is +3v to +25v and also

making -3v to +3v is undefined. For this reason, to connect any RS232 to a micro controller

system we must use voltage converts such as MAX232 to convert the TTL logic levels to the

RS232 voltage levels, and vice versa. MAX232 chips are commonly referred to as line

drivers. So to interface any GSM or GPS or RFID or FPRS modules RS232 and MAX232

are the used to interface to the micro controller for serial communication. The line drivers

used for transmitting TXD in MAX232 are T1 (T1-in and T1-out) and T2 (T2-in and T2-out).

The line drivers used for receiving the data is R1 (R1-in and R1-out) and R2 (R2-in and R2-

out).

For transmitting the data to the other device the TXD pin of UART is connected to

the T1-in pin-11 of MAX-232 and the T1-out pin14 of MAX232 is connected to RXD pin-2

of RS232 and from there data is transmitted to the device through the pin TXD pin-3 of

RS232 cable.

For receiving the data from the device the TXD pin-2 of RS232 is connected to the R1-

in pin-13 of MAX232 and the R1-out pin-12 is connected to the RXD pin of UART of the

controller hence the data is received by the controller.

53

Page 54: Coal mine detection robot

4. WORKING

The coal miners rescue robot means this robot can be used in coal mines.

Since, it is attached with different sensors which are used to monitor different conditions in

coal mines before sending workers in coal mines first robot is send to monitor the

atmosphere conditions in it and then they will allow them to send.

The different sensors we use is fire sensor which is used to sense the fire and also to sense

the atmospheric conditions also which can be used as a security system to detect fire or

increase in temperature in coal mines, Gas sensor used to detect dangerous gases in

atmosphere like carbon monoxide etc evolved in coal mines. The sensed information can be

sending to control room continuously through zigbee wireless technology. This is a free

running robot which automatically changes its direction whenever it finds and obstacle the

obstacle detection can be find using IR transmitter and receiver. Only IR receiver is

connected to controller. This robot can also be used to control it from PC through zigbee.

The IR transmitter continuously transmits infrared rays at a certain range whenever any

obstacle interferes these rays gets reflected and reflected rays are observed by using IR

receiver once it gets activated it is indication to controller the obstacle is present in that

direction so it moved away from the obstacle by changing the motor direction.

The motors used here are DC motors. Motors cannot be interfaced directly to controllers

since these do not support logic states. Since if sudden high state is applied to motor gets

struck so the motor is interfaced to controller for smooth direction changing the name of that

IC is L293D (line driver). To this single IC two DC motor can be connected. Totally four

pins of controller is used to connect to this IC. By giving different logic values to these the

motor directions can be changed as shown in truth table below.

54

Page 55: Coal mine detection robot

The input devices are sensors which are interfaced to the controller through comparator. First

sensor sensed values are send to comparator in comparator sensor values are already

predefined by using potentiometer and these values are compared with these predefined

values and send to controller then controller sends these values to PC through zigbee and

these values are displayed on PC .

When ever the gas sensor finds the dangerous gas evolution inside the coal mines it

sends the data to comparator and compares with predefined values and then sends to

controller and the controller automatically sends data to control room to give indication that

dangerous gas was evolved in coal mines. The controller sends the information to the control

55

Page 56: Coal mine detection robot

room through the zigbee wireless technology and the data can be viewed on the PC

connected to zigbee through serial communication cable RS-232.

56

Page 57: Coal mine detection robot

5. SOFTWARE

Keil software

1. Click on the Keil uVision Icon on DeskTop

2. The following fig will appear

3. Click on the Project menu from the title bar

4. Then Click on New Project

57

Page 58: Coal mine detection robot

5. Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\

6. Then Click on Save button above.

58

Page 59: Coal mine detection robot

7. Select the component for u r project. i.e. Philips……

8. Click on the + Symbol beside of Philips

9. Select AT89C51 as shown below

59

Page 60: Coal mine detection robot

10. Then Click on “OK”

11. The Following fig will appear

12. Then Click either YES or NO………mostly “NO”

13. Now your project is ready to USE

14. Now double click on the Target1, you would get another option “Source group 1”

as shown in next page.

60

Page 61: Coal mine detection robot

15. Click on the file option from menu bar and select “new”

61

Page 62: Coal mine detection robot

16. The next screen will be as shown in next page, and just maximize it by double

clicking on its blue boarder.

17. Now start writing program in either in “C” or “ASM”

18. For a program written in Assembly, then save it with extension “. asm” and for

“C” based program save it with extension “ .C”

62

Page 63: Coal mine detection robot

19. Now right click on Source group 1 and click on “Add files to Group Source”

20. Now you will get another window, on which by default “C” files will appear.

63

Page 64: Coal mine detection robot

21. Now select as per your file extension given while saving the file

22. Click only one time on option “ADD”

23. Now Press function key F7 to compile. Any error will appear if so happen.

24. If the file contains no error, then press Control+F5 simultaneously.

64

Page 65: Coal mine detection robot

25. The new window is as follows

26. Then Click “OK”

27. Now Click on the Peripherals from menu bar, and check your required port as

shown in fig below

28. Drag the port a side and click in the program file.

65

Page 66: Coal mine detection robot

29. Now keep Pressing function key “F11” slowly and observe.

30. You are running your program successfully

66

Page 67: Coal mine detection robot

6. APPLICATIONS

The major application of this robot coal mine,

As many types of sensors are used we can use this robot as obstacle detector,

CO(gas) detector, temperature detector, light detector also.

robots in industries where it is impossible to the human beings.

APPLICATIONS OF ZIGBEE :

Home Automation

ZigBee Smart Energy

Telecommunication Applications

Personal Home

Hospital Care.

67

Page 68: Coal mine detection robot

7. Advantages and Disadvantages

ADVANTAGES:

Low cost,

easy to use for rural areas

automated operation

Low Power consumption.

ADVANTAGES OF ZIGBEE:

low cost allows the technology to be widely deployed in wireless control and

monitoring applications.

low power-usage allows longer life with smaller batteries,.

mesh networking provides high reliability and larger range.

DISADVANTAGE:

Step by step analysis is not possible. It just gives information about ok or not ok

situation

ZIGBEE transmission distance lower than requirement so that mesh networking is

required for higher distances.

68

Page 69: Coal mine detection robot

8. CONCLUSION AND FUTURE SCOPE

The project “EMBEDDED CONTROL SYSTEM DESIGN FOR COAL MINE

DETECT AND RESCUE ROBOT” has been successfully designed and tested. It has been

developed by integrating features of all the hardware components used. Presence of every

module has been reasoned out and placed carefully thus contributing to the best working of

the unit.

Secondly, using highly advanced IC’s and with the help of growing technology the

project has been successfully implemented.

69

Page 70: Coal mine detection robot

Appendices:

# include <8052.h>

# define M1 P2_0# define M11 P2_1# define M2 P2_2# define M21 P2_3

# define Gas P1_0# define Ldr P1_1# define Fire P1_2

# define Ir P1_4

void SerialPutc(unsigned char ucCh);void SendPc(unsigned char *ucpStr,unsigned char ucLen);

void main(void)

{

unsigned int i = 0, j = 0, m = 0;

SCON = 0x50; /* mode 1, 8-bit uart, enable receiver */ TMOD = 0x20; /* timer 1, mode 2, 8-bit reload */ TH1 = 0xFD; /* reload value for 2400 baud */

70

Page 71: Coal mine detection robot

SendPc("EMBEDDED CONTROL SYSTEM DESIGN FOR COAL MINE DETECT ROBOT",57);

M1 = 1;M11 = 0;M2 = 1; M21 = 0;

while(1){

if(Ir == 0){

if(m == 0){M1 = 0;M11 = 0;M2 = 0; M21 = 0;

for(i = 0; i< 2; i++)for(j = 0; j < 40000; j++);

M1 = 0;M11 = 1;M2 = 0; M21 = 1;

while(!Ir);

M1 = 0;

71

Page 72: Coal mine detection robot

M11 = 0; M2 = 0; M21 = 0;

for(i = 0; i< 2; i++)for(j = 0; j < 40000; j++);

M1 = 1;M11 = 0;M2 = 0;M21 = 0;

for(i = 0; i< 2; i++)for(j = 0; j < 40000; j++);

M1 = 1;M11 = 0;M2 = 1; M21 = 0;

m = 1;}else{m = 0;

M1 = 0;M11 = 0;M2 = 0; M21 = 0;

for(i = 0; i< 2; i++)for(j = 0; j < 40000; j++);

72

Page 73: Coal mine detection robot

M1 = 0;M11 = 1;M2 = 0; M21 = 1;

while(!Ir);

M1 = 0;M11 = 0; M2 = 0; M21 = 0;

for(i = 0; i< 2; i++)for(j = 0; j < 40000; j++);

M1 = 0;M11 = 0;M2 = 1;M21 = 0;

for(i = 0; i< 2; i++)for(j = 0; j < 40000; j++);

M1 = 1;M11 = 0;M2 = 1; M21 = 0;}}else

73

Page 74: Coal mine detection robot

{if(Gas == 1){SendPc("GAS : DETECTED",16);}else{SendPc("GAS : NOT DETECTED",20);}

if(Fire == 1){SendPc("FIRE : DETECTED ",18);}else{SendPc("FIRE : NOT DETECTED ",22);}if(Ldr == 0){SendPc("LIGHT : INTENSITY LOW ",24);}else{SendPc("LIGHT : INTENSITY NORMAL",24);}

}

}}

void SendPc(unsigned char *ucpStr,unsigned char ucLen){

unsigned int ucIndex = 0, i= 0, j= 0;

74

Page 75: Coal mine detection robot

for(i = 0; i < ucLen; i++)SerialPutc(*(ucpStr+i));

}

void SerialPutc(unsigned char ucCh){

SBUF = ucCh;while(TI == 0);TI = 0;

}

REFERENCES:The 8051 Micro controller and Embedded Systems -Muhammad Ali Mazidi -Janice Gillispie Mazidi

The 8051 Micro controller Architecture, Programming & Applications -Kenneth J.Ayala

Fundamentals Of Micro processors and Micro computers -B.Ram

Micro processor Architecture, Programming & Applications -Ramesh S.Gaonkar

Electronic Components -D.V.Prasad

Wireless Communications - Theodore S. Rappaport

Mobile Tele Communications - William C.Y. Lee

75

Page 76: Coal mine detection robot

-Domenic SYMES

-Chris WRIGHT

References on the Web:

www.national.com

www.nxp.com

www.8052.com

www.microsoftsearch.com

www.geocities.com

www.keil.com

76