Line Follower +ARM (1).doc (Size: 3.19 MB / Downloads: 356)
In this project we use 89S52 controller as a main processor to done all the activity of this project. 89S52 is a 40 pin member of the 8051 family.
In this project we use two slow speed dc motor to run the vehicle on the track. Along with vehicle movement we use two another motor for arm movement .In this project we use four slow speed motor. Working voltage of these motor’s is 6- 9 volt dc. These type of motor’s are slow speed gear motor. These motor’s consumes very low current, so we prefer these type of motor in robot’s
In this project we use ic 89s52 as a main processor to control all the sensor’s and output motor’s. In this project we use total four slow speed dc gear motor for forward, reverse, left and right movement. And for arm movement . In the vehicle When both the motor’s gets a voltage for clock wise then robot move forward. When both the motor’s turn on to anticlock wise then robot moves backward. If one motor is forward and second motor is reverse then robot from left to right position. If we change the sequence of motor then robot turns right to left
In line follower robo, robo moves on the line. When robo moves on the line then ROBO MOTION IS always FORWARD on LINE . If the robo sensor’s detect the line variation’s then robo turn to right or left. For sensing the line we use infra red + photodiode as a senor. We use the sensors at the bottom of the robo In fra red rays continuous send a light rays, which are reflected by the surface ( white). Rays are reflected by the white surface but from black surface lights are not reflected. We sense the change of voltage across the photodiode. When photodiode resistance become high then it means, no light is reflected from the surface. When light reflected from surface then photo-diode resistance become low. So we continuous monitoring the voltage on photo-diode point. When voltage level is change on the photodiode from 0 to 1 or 1 to 0, then processor immediate sense the signal and rotate one motor for clock wise and second motor anti clock wise. By this action robo move left or right. AS the robo moves from left to right or right to left, we again monitoring the sensor voltage . When both the sensor gets a light then it means robo moves forward. If any one sensor is off then robo change its direction to gets a right position
IN the arm position we again use two motor for grip/ ungrip. Left movement or right movement. When we switch on the switch then first of all arm moves to left direction and go to home position. We always remain the arm for left position. For position the arm on right position we use One magnetic sensor. In the start arm moves to left and when arm reach the magnetic sensor then arm take a rest on this point. We use magnetic proximity sensor for the position of arm at the left position.
Now we use one infrared + photodiode module at the front of vehicle for sensing a object. When vehicle sensing a interruption then arm cam back to centre position and gripper grip the object. As gripper motor turn clockwise to grip the object. Now arm move to home position and anticlock wise the motor for un-gripping the object
In this project we use two magnetic sensor for arm positioning. One sensor at the centre point and one sensor at the left point for Home position
We use slow speed gear motor in this project. Working voltage of these motor’s are 9 volt to 12 volt dc. We use two power source in this project. One for the motor’s and second for the controller circuit.
For controlling a dc motor we use H bridge circuit. IN this project we use four transistor circuit to control the movement of dc motor for forward and reverse movement.
Collector of both the transistor is connected to the positive supply 9 volt. This 9 volt supply is for the DC motor. If we use 12 volt motor then we use 12 volt dc supply here. Emitter of both the transistor is connected to the DC motor. Emitter of the PNP transistor is connected to the emitter of NPN transistor. Collector of both the PNP transistor is connected to the ground potential. Base point of both transistor is join together. On this point we give a voltage.
if we give a positive voltage to the base of left junction and negative voltage to the right junction then motor moves to one direction. Because due to positive on base NPN is on and due to negative on base PNP is on. If left side NPN is on and right side PNP is on then motor moves to the one direction. If the voltage is reverse on the base point then motor’s moves to the reverse direction.
motor move to the reverse direction because base voltage is change . Now left NPN and right PNP is on and motor moves to the reverse direction. Now when we attach the H bridge to the logical output of the micro-controller. So to interface the micro-controller with this H bridge we must connect a OPTO-COUPLER with the controller.
Opto-Coupler is a special optically isolated device to interface the input with output using light. Opto-Coupler provide a electrical isolation between the input and output circuit .
Opto-coupler provide a isolation between the two power supply. Microcontroller power supply is 5 volt dc and motor supply is vary from 9volt to 12 volt dc. With the help of the microcontroller we provide a optical isolation between two power supply
In opto-coupler there is one input and one output and there is no connection between input and output. On input point there is one infra red l.e.d. cathode point of the l.e.d is connected to the resistor R1 and further connected to the microcontroller ports. In this project we use two dc motor, so we use two H bridge circuit with the four opto-coupler.
Pin no 40 of the controller is connected to the positive supply and pin no 20 is connected to the ground pin. Pin no 9 is for the reset pin, on this pin we connect a one resistor and capacitor to provide a auto reset circuit. With the help of the auto reset circuit micro-controller reset automatically and start from the zero location every time when power is on.
Now when robot is start then robot move forward, so program is to be written is so that both H bridge move the motor in clock wise direction. We use two sensors’s at the bottom of the robo. Here in this project we use infra red + photodiode as a sensor. We use two colour base for line follower project. One colour is white and second colour is black. Light reflect from the white surface and from black colour there is no reflection. We place the robo on the black line. Both the sensor on white surface. When robo moves on line then we sense the signal fro photodiode. If both the photdiode on white surface then robo move forward. If any one of these sensor is on black line then robo stop and move left or right himself to adjust the sensor on white line. When both the sensor on white line then robo move forward.
HOW TO PROGRAM BLANK CHIP.
8051 micro controller
The 8051 developed and launched in the early 80`s, is one of the most popular micro controller in use today. It has a reasonably large amount of built in ROM and RAM. In addition it has the ability to access external memory.
The generic term `8x51` is used to define the device. The value of x defining the kind of ROM, i.e. x=0, indicates none, x=3, indicates mask ROM, x=7, indicates EPROM and x=9 indicates EEPROM or Flash.
Different micro controllers in market.
• PIC One of the famous microcontrollers used in the industries. It is based on RISC Architecture which makes the microcontroller process faster than other microcontroller.
• INTEL These are the first to manufacture microcontrollers. These are not as sophisticated other microcontrollers but still the easiest one to learn.
• ATMEL Atmel’s AVR microcontrollers are one of the most powerful in the embedded industry. This is the only microcontroller having 1kb of ram even the entry stage. But it is unfortunate that in India we are unable to find this kind of microcontroller.
Intel 8051 is CISC architecture which is easy to program in assembly language and also has a good support for High level languages.
The memory of the microcontroller can be extended up to 64k.
This microcontroller is one of the easiest microcontrollers to learn.
The 8051 microcontroller is in the field for more than 20 years. There are lots of books and study materials are readily available for 8051.
First of all we select and open the assembler and wrote a program code in the file. After wrote a software we assemble the software by using internal assembler of the 8051 editor. If there is no error then assembler assemble the software abd 0 error is show the output window.
now assembler generate a ASM file and HEX file. This hex file is useful for us to program the blank chip.
Now we transfer the hex code into the blank chip with the help of serial programmer kit. In the programmer we insert a blank chip 0f 89s51 series . these chips are multi –time programmable chip. This programming kit is seperatally available in the market and we transfer the hex code into blank chip with the help of the serial programmer kit
Architecture is must to learn because before learning new machine it is necessary to learn the capabilities of the machine. This is some thing like before learning about the car you cannot become a good driver.
The 8051 doesn’t have any special feature than other microcontroller. The only feature is that it is easy to learn. Architecture makes us to know about the hardware features of the microcontroller. The features of the 8051 are
4K Bytes of Flash Memory
128 x 8-Bit Internal RAM
Fully Static Operation: 1 MHz to 24 MHz
32 Programmable I/O Lines
Two 16-Bit Timer/Counters
Six Interrupt Sources (5 Vectored)
Programmable Serial Channel
Low Power Idle and Power Down Modes
The 8051 has a 8-Bit CPU that means it is able to process 8 bit of data at a time. 8051 has 235 instructions. Some of the important registers and their functions are
To make the robots mobile we need to have motors and the control circuitry that could control the motors. There are different kinds of motors available for different application.
1. DC motor
2. Stepper motor
3. Servo motor
These are the motors that are commonly found in the toys and the tape recorders. These motors change the direction of rotation by changing the polarity. Most chips can't pass enough current or voltage to spin a motor. Also, motors tend to be electrically noisy (spikes) and can slam power back into the control lines when the motor direction or speed is changed.
Specialized circuits (motor drivers) have been developed to supply motors with power and to isolate the other ICs from electrical problems. These circuits can be designed such that they can be completely separate boards, reusable from project to project.
A very popular circuit for driving DC motors (ordinary or gearhead) is called an H-bridge. It's called that because it looks like the capital letter 'H' on classic schematics. The great ability of an H-bridge circuit is that the motor can be driven forward or backward at any speed, optionally using a completely independent power source.
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 nonvolatile memory technology and is compatible with the industry standard MCS-51™ instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with 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, and 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.
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 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 program verification.
External pull-ups are required during program verification.
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. Port 1 also receives the low-order address bytes during Flash programming and verification.
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI); Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89C51 as listed below:
Port 3 also receives some control signals for Flash programming and verification.
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.
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/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external Data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.
Program Store Enable is the read strobe to external program memory.
Port Pin Alternate Functions
P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memory write strobe)
P3.7 RD (external data memory read strobe)
When the AT89C51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.
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 FFH. 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.
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
Output from the inverting oscillator amplifier.
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 Figure 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 2.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.
In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled
Interrupt or by hardware reset. It should be noted that when idle is terminated by a hard
Hardware reset, the device normally resumes program execution, from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by reset, the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory.
Status of External Pins during Idle and Power down Modes
Mode Program Memory ALE PSEN PORT0 PORT1 PORT2 PORT3
Idle Internal 1 Data
Idle External 1 Float Data Address Data
Power down Internal 0 Data
Power down External 0 Float Data
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. The only exit from power down is a hardware reset. 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.
Program Memory Lock Bits
On the chip are three lock bits which can be left un-programmed (U) or can be programmed (P) to obtain the additional features listed in the table below:
When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the device is powered up without a reset, the latch initializes to a random value, and holds that value until reset is activated. It is necessary that the latched value of EA be in agreement with
The current logic level at that pin in order for the device to function properly.
Lock Bit Protection Modes
Program Lock Bits Protection Type
LB1 LB2 LB3
1 U No program lock features.
2 P U MOVC instructions executed from external program memory are disabled from fetching code
Bytes from internal memory, EA is sampled and latched on reset, and further programming of the
Flash is disabled.
3 P U Same as mode 2, also verify is disabled.
4 P same as mode 3, also external execution is disabled.
Programming the Flash
The AT89C51 is normally shipped with the on-chip Flash memory array in the erased state (that is, contents = FFH) and ready to be programmed. The programming interface accepts either a high-voltage (12-volt) or a low-voltage (VCC) program enable signal. The low voltage programming mode provides a convenient way to program the AT89C51 inside the user’s system, while the high-voltage programming mode is compatible with conventional third party Flash or EPROM programmers. The AT89C51 is shipped with either the high-voltage or low-voltage programming mode enabled. The respective top-side marking and device signature codes are listed in the following table. The AT89C51 code memory array is programmed byte-by byte
In either programming mode. To program any nonblank byte in the on-chip Flash Memory, the entire memory must be erased using the Chip Erase Mode.
Before programming the AT89C51, the address, data and control signals should be set up according to the Flash programming mode table and Figures 3 and 4. To program the AT89C51, 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 for the high-voltage programming mode.
5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte-write cycle is self-timed and typically takes no more than 1.5 ms. Repeat steps 1 through 5, changing the address and data for the entire array or until the end of the object file is reached.
The AT89C51 features Data Polling to indicate the end of a write cycle. During a write cycle, an attempted read of the last byte written will result in the complement of the written datum on PO.7. Once the write cycle has been completed, true data are valid on all outputs, and the next cycle may begin. Data Polling may begin any time after a write cycle has been initiated.
The progress of byte programming can also be monitored by the RDY/BSY output signal. P3.4 is pulled low after ALE goes high during programming to indicate BUSY. P3.4 is pulled high again when programming is done to indicate READY.
If lock bits LB1 and LB2 have not been programmed, the programmed code data can be read back via the address and data lines for verification. The lock bits cannot be verified directly. Verification of the lock bits is achieved by observing that their features are enabled.
The entire Flash array is erased electrically by using the proper combination of control signals and by holding ALE/PROG low for 10 ms. The code array is written with all “1”s. The chip erase operation must be executed before the code memory can be re-programmed.
Reading the Signature Bytes:
The signature bytes are read by the same procedure as a normal verification of locations 030H,
031H, and 032H, except that P3.6 and P3.7 must be pulled to a logic low. The values returned are as follows.
(030H) = 1EH indicates manufactured by Atmel
(031H) = 51H indicates 89C51
(032H) = FFH indicates 12V programming
(032H) = 05H indicates 5V programming
Every code byte in the Flash array can be written and the entire array can be erased by using the appropriate combination of control signals. The write operation cycle is self timed and once initiated, will automatically time itself to completion. All major programming vendors offer worldwide support for the Atmel microcontroller series. Please contact your local programming vendor for the appropriate software revision.