Вы находитесь на странице: 1из 39

Mini Project 2009

Programmable Robot Using PICAXE-08M

PROGRAMMABLE ROBOT BASED ON PICAXE-08

MINI PROJECT REPORT

Submitted by

NITHIN KP

PRAVEESH A

PREETHY P THANKAPPAN

PREJITH S

RAFAH ABDUL GAFOOR

PRAVEESH A PREETHY P THANKAPPAN PREJITH S RAFAH ABDUL GAFOOR Department of Applied Electronics & Instrumentation

Department of Applied Electronics & Instrumentation Engineering

GOVERNMENT ENGINEERING COLLEGE

KOZHIKODE-673 005

OCTOBER 2009

Mini Project 2009

Programmable Robot Using PICAXE-08M

ACKNOWLEDGEMENTS

We would like to express my greatest gratitude to the people who have helped and supported me throughout . First and foremost , we would like to express my deepest appreciation to Prof. P Reena (Head of the Dept. Applied Electronics & Instrumentation Engineering)for her kind and valuable support and guidance.

We would like to extend our sincere thanks to Ast.Prof. Shajahan ES for his patient and unfailing support over the successful completion of this mini project.

We are convinced that this work would not have been completed without the assistance and support of the lab assistants Balan N, Sunil Kumar, Abhilash NS.

Last but not least our course mates who have provided me with invaluable advice and help.

.

Mini Project 2009

Programmable Robot Using PICAXE-08M

GOVERNMENT ENGINEERING COLLEGE

KOZHIKODE

Department of Applied Electronics & Instrumentation Engineering

of Applied Electronics & Instrumentation Engineering CERTIFICATE Certified that this is the bonafide record of

CERTIFICATE

Certified that this is the bonafide record of the mini project work titled

PROGRAMMABLE ROBOT BASED ON PICAXE-08

done by

Nithin KP, Preethy P Thankappan, Praveesh A, Prejith S & Rafah Abdul Gafoor

during the year 2009 in partial fulfillment of the requirements for the award of the degree of Bachelor of Technology in Applied Electronics & Instrumentation Engineering of University of Calicut.

Mini project Co-ordinator

Ast.Prof . SHAJAHAN ES

Head of Department

Prof. P REENA

Mini Project 2009

Programmable Robot Using PICAXE-08M

ABSTRACT

This project explores the processes and design requirements for a programmable robot which can sense the ambient light intensity and move towards the brightest point in a given area. The robot is capable of detecting and avoiding any obstructions in front of it while moving with audio indication. Instead of using the typical microcontrollers, we have chosenPICAXE-08M microcontroller as our robot’s brain. One of the chief advantages of using the PICAXE microcontroller over the conventional PIC microcontroller is that, it is easily programmable and the programmer circuit can be integrated to the project circuitry with ease. Also, the microcontroller can be programmed in BASIC which is much simpler compared to other programming languages. Thus the easy reprogramming of the robot is easily achieved. The robot senses the light intensity with the help of a LDR and obstruction detection is done by using a bump switch installed on the robot.

Mini Project 2009

Programmable Robot Using PICAXE-08M

CONTENTS

1. Introduction

2. The Concept

3. Functional Block Diagram

4. Component description

5. Circuit Diagram

6. PICAXE-08M

7. Motor Driver Circuit

8. List of Components

9. PCB Layout

10. Programming the PICAXE

11. Flow Chart and Program description

12. Applications

13. Conclusion

14. Future Scope

15. Bibliography

16. References

Mini Project 2009

Programmable Robot Using PICAXE-08M

INTRODUCTION

Robotics is the engineering science and technology of robots, and their design, manufacture, and application. Robotics is related to electronics, mechanics, and software. Robotics is a subject of interest for both professionals as well as hobbyists.Basically,a robot is a device which have some intelligence to perform a specified task. The intelligence of the robot is realized with the help of a microcontroller and the program in it.This project aims at building a light following robot which can be easily programmed.

and the program in it.This project aims at building a light following robot which can be
and the program in it.This project aims at building a light following robot which can be

1

and the program in it.This project aims at building a light following robot which can be

Mini Project 2009

Programmable Robot Using PICAXE-08M

THE CONCEPT

The project aims at building a microcontroller based programmable robot that can act as a light follower and can detect and avoid obstructions while moving. The robot can sense light intensities at various points in a given space and is capable of moving towards the point where the light intensity is maximum. The robot is programmable, therefore, the drive circuit is merely a slave to the software and is of a relatively simple design. The circuit is based on a PICAXE-08 micro. Although more limited than a ‘raw’ microcontroller, it is a little marvel nonetheless both cutting out the need for a programmer and for placing respectable power at the service of the constructor with great simplicity. The programmer and the project circuit are one and the same and there is no need of removing the microcontroller from the main circuit for programming it.

are one and the same and there is no need of removing the microcontroller from the
are one and the same and there is no need of removing the microcontroller from the

2

are one and the same and there is no need of removing the microcontroller from the

Mini Project 2009

Programmable Robot Using PICAXE-08M

FUNCTIONAL BLOCK DIAGRAM

LIGHT SENSING

Using PICAXE-08M FUNCTIONAL BLOCK DIAGRAM LIGHT SENSING OBSTRUCTION PICAXE-08M SOUND MOTOR DRIVER L MOTOR R MOTOR

OBSTRUCTION

FUNCTIONAL BLOCK DIAGRAM LIGHT SENSING OBSTRUCTION PICAXE-08M SOUND MOTOR DRIVER L MOTOR R MOTOR The

PICAXE-08M

BLOCK DIAGRAM LIGHT SENSING OBSTRUCTION PICAXE-08M SOUND MOTOR DRIVER L MOTOR R MOTOR The functional block

SOUND

BLOCK DIAGRAM LIGHT SENSING OBSTRUCTION PICAXE-08M SOUND MOTOR DRIVER L MOTOR R MOTOR The functional block

MOTOR DRIVER

L MOTOR
L
MOTOR
R MOTOR
R
MOTOR

The functional block diagram shows the interrelationship between different blocks of the robot.The center of the robot’s control system is PICAXE-08M microcontroller.The microcontroller listens to inputs from the light sensing circuit and the obstruction detection circuit. The microcontroller triggers the motor driving circuit according to the inputs from light sensing circuit and obstruction detection circuit.

triggers the motor driving circuit according to the inputs from light sensing circuit and obstruction detection
triggers the motor driving circuit according to the inputs from light sensing circuit and obstruction detection

3

triggers the motor driving circuit according to the inputs from light sensing circuit and obstruction detection

Mini Project 2009

Programmable Robot Using PICAXE-08M

The motor driving circuit is based on high current half H bridge IC LN293D.Under normal operation ,the robot checks for any obstructions in the path of it through the bump switch. On detecting any obstruction, the microcontroller commands the motor driving circuit to turn both motors backwards so that the robot moves backwards. Once the obstruction has been avoided, the light sensing circuit compares the light intensities on both sides of the robot as well as directly in front and moves to the direction where light intensity is maximum.The comparison of light intensities is done with the help of microcontroller’s built in ADC and the light sensing circuit. This repeats until the robot reaches the point with maximum intensity.

built in ADC and the light sensing circuit. This repeats until the robot reaches the point
built in ADC and the light sensing circuit. This repeats until the robot reaches the point

4

built in ADC and the light sensing circuit. This repeats until the robot reaches the point

Mini Project 2009

Programmable Robot Using PICAXE-08M

COMPONENT DESCRIPTION

PICAXE-08M MICROCONTROLLER

A PICAXE microcontroller is a standard Microchip PICmicro™ microcontroller that has been pre-programmed with the PICAXE bootstrap code. The bootstrap code enables the PICAXE microcontroller to be re-programmed directly via a simple serial connection. This eliminates the need for an (expensive)conventional programmer, making the whole download system a very low-cost simple serial cable. The pre-programmed bootstrap code also contains common routines (such as how to generate a pause delay or a sound output), so that each download does not have to waste time downloading this commonly required data. This makesthe download time much quicker.

required data. This makesthe download time much quicker. The PICAXE system exploits the unique characteristics of

The PICAXE system exploits the unique characteristics of the new generation of low-cost ‘FLASH’ memory based microcontrollers. These microcontrollers can be programmed over and over again

of low- cost ‘FLASH’ memory based microcontrollers. These microcontrollers can be programmed over and over again
of low- cost ‘FLASH’ memory based microcontrollers. These microcontrollers can be programmed over and over again

5

of low- cost ‘FLASH’ memory based microcontrollers. These microcontrollers can be programmed over and over again

Mini Project 2009

Programmable Robot Using PICAXE-08M

(typically 100 000 times) without the needfor an expensive programmer. The PICAXE uses a simple BASIC language (or graphical flowcharts) that younger students can start generating programs with within an hour of first use. It is much easier to learn and debug than industrial programming languages (C or assembler code). The power of the PICAXE system is its simplicity. No programmer, eraser or complicated electronic system is required - the microcontroller is programmed via a 3-wire connection to the computers serial port.

L393D-MOTOR DRIVING IC

The bidirectional rotation of motors is achieved with the help of the motor driving IC. The motor driving IC also acts as a high current source for the DC motors. The Device is a monolithic integrated high voltage, high current four channel driver designed to accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoids, DC and stepping motors) and switching power transistors. To simplify use as two bridges each pair of channels is equipped with an enable input. A separate supply input is provided for the logic, allowing operation at a lower voltage and internal clamp diodes are included.This device is suitable for use in switching applications at frequencies up to 5 kHz.

internal clamp diodes are included.This device is suitable for use in switching applications at frequencies up
internal clamp diodes are included.This device is suitable for use in switching applications at frequencies up
internal clamp diodes are included.This device is suitable for use in switching applications at frequencies up

6

internal clamp diodes are included.This device is suitable for use in switching applications at frequencies up

Mini Project 2009

Programmable Robot Using PICAXE-08M

BC 547

BC547 is

NPN Silicon Epitaxial Planar Transistor used in AF small

signal amplifier stages and direct coupled circuits. The BC 547 acts as a part of the Inverter circuit.

circuits. The BC 547 acts as a part of the Inverter circuit. 7805 VOLTAGE REGULATOR A

7805 VOLTAGE REGULATOR

A voltage regulator maintains the supply voltage at a constant level. IC 7805 was used to regulate the supply voltage to 5V,which is the optimum voltage for the PICAXE microcontroller.The 3 terminal device can source upto 1A current.

to 5V,which is the optimum voltage for the PICAXE microcontroller.The 3 terminal device can source upto
to 5V,which is the optimum voltage for the PICAXE microcontroller.The 3 terminal device can source upto
to 5V,which is the optimum voltage for the PICAXE microcontroller.The 3 terminal device can source upto

7

to 5V,which is the optimum voltage for the PICAXE microcontroller.The 3 terminal device can source upto

Mini Project 2009

Programmable Robot Using PICAXE-08M

9V BATTERY

To ensure smooth and continuous operation of the robot, 9V dc battery was used.The supply voltage was regulated to 5V with the regulator circuit.

voltage was regulated to 5V with the regulator circuit. LDR The light sensing circuit of the

LDR

The light sensing circuit of the robot consists of mainly an LDR.Its resistance varies with the variations in the light intensity falling on it.

with the variations in the light intensity falling on it. MOTORS The Robot is designed to

MOTORS

The Robot is designed to move on wheels. Two motor-powered wheels and a castor wheel are provided for this. Two geared dc- motors of the following specifications were used.

6 Volts DC motors

wheel are provided for this. Two geared dc- motors of the following specifications were used. •
wheel are provided for this. Two geared dc- motors of the following specifications were used. •
wheel are provided for this. Two geared dc- motors of the following specifications were used. •

8

Mini Project 2009

Programmable Robot Using PICAXE-08M

• Weight = 90gms

• Rated Voltage = DC 6V

• No-load current < 60mA

• Load current < 300mA

• No -load current < 60mA • Load current < 300mA BUZZER A 6V buzzer was

BUZZER

A 6V buzzer was used to give audio indication of an obstruction being detected by the robot.

current < 300mA BUZZER A 6V buzzer was used to give audio indication of an obstruction
current < 300mA BUZZER A 6V buzzer was used to give audio indication of an obstruction
current < 300mA BUZZER A 6V buzzer was used to give audio indication of an obstruction

9

current < 300mA BUZZER A 6V buzzer was used to give audio indication of an obstruction

Mini Project 2009

Programmable Robot Using PICAXE-08M

CIRCUIT DIAGRAM

The circuit diagram of the robot is given below.

DIAGRAM The circuit diagram of the robot is given below. CIRCUIT DESCRIPTION The circuit is built

CIRCUIT DESCRIPTION

The circuit is built around a PICAXE-08M microcontroller.The Vcc for the microcontroller is given from a 7805 voltage regulator which regulates the supply voltage to 5V.Picaxe is operated at 4MHz frequency and the built in oscillator generates this. The programming circuit consists of a 3.5 mm stereo socket, a 10k resistor and a 22 k resistor. The microcontroller communicates with the PC via pin 2(serial in ) and pin 7(serial out). The 22k resistor clamps the serial voltage to 5V to prevent damage to the chip. Serial in or pin 2 of the PICAXE should never be left floating and the 10k resistor is used to ground it whenever it is not connected to PC for programming. Pin 1 and Pin 8 are connected to the positive power supply and the ground respectively.

to PC for programming. Pin 1 and Pin 8 are connected to the positive power supply
to PC for programming. Pin 1 and Pin 8 are connected to the positive power supply
to PC for programming. Pin 1 and Pin 8 are connected to the positive power supply

10

Mini Project 2009

Pinout diagram of PICAXE-08M

Programmable Robot Using PICAXE-08M

diagram of PICAXE-08M Programmable Robot Using PICAXE-08M Pin 7 (P0) is designated by the manufacturers for

Pin 7 (P0) is designated by the manufacturers for output only and is used to switch both of the motors on or off at the same time. It may also be used to pulse the motors on and off (pulse-width modulation) for speed control or special effects. When it is ‘high’, the motors are on; when it is ‘low’ they are off.Pin 5 (P2) is designated for input or output. In this circuit, it is used for output only and controls the direction (forward or reverse) of the lefthand motor, as seen from the rear of the robot. Pin 3 (P4) is likewise designated for input or output and is used here to control the direction (forward or reverse) of the right hand motor. Neither pin 5 nor pin 3 will accomplish anything unless both motors are switched on frst via pin 7 (P0). Both pins 5 and 3 cause a wheel to roll forwards when it is ‘low’ and backwards when it is ‘high’. Pins 7, 5 and 3 together may be used not only to make the robot drive forwards o r reverse but also to turnPin 4 (P3) is designated for input only and is used to sense collisions through the robot’s bumper bar. The robot need not only do a simple reverse-and-turn, but it may also be programmed to respond in various ways. Pin 6 (P1) is designated for output, input or analogue input. In this circuit, it is used only for output and analogue input. In ‘output’ mode, it is used to drive a piezo sounder for programmable sound. In ‘analogue’ mode, pin 6 reads the light level at the front of the robot. Note that this first requires the correct adjustment of VR1 with the help of the LDR

level at the front of the robot. Note that this first requires the correct adjustment of
level at the front of the robot. Note that this first requires the correct adjustment of
level at the front of the robot. Note that this first requires the correct adjustment of

11

Mini Project 2009

Programmable Robot Using PICAXE-08M

ADJUST program. The robot is capable of detecting sixteen levels of light which may be used for light-seeking (or light-avoidance), line tracking and day-night sensing. Pin 7 (P0) activates both motors simultaneously via the L293D’S enable inputs. Pin 6 (P1), used in ‘output’ mode, drives piezo sounder X1. Since VR1 and LDR1 are connected to the same pin, two 330Ω resistors are included as protection for these components. In analogue mode, pin 6 monitors LDR1 and the PICAXE-08 interprets the voltage as 16 discrete levels, between <0.22V (level 1) and >3.38V (level 16). Transistors Q1 and Q8 are used as inverters, so that when the ‘forward motion’ of motors is disabled, the ‘reverse motion’ of motors is activated. Pin 4 is normally held low by its 47kΩ resistor. When bump-and-respond switch S1 (the bumper bar) is closed, pin 4 is pulled high. The 10µF capacitor and the 47kΩ resistor determine how long a bump will be ‘remembered’ and the values of these components may be modifed as desired. These components are required because the software, as it executes, may need a moment to reach the pro-gram line which monitors the status of S1 and because there is bound to be some switch-bounce too.

Motor control with Picaxe.

which monitors the status of S1 and because there is bound to be some switch-bounce too.
which monitors the status of S1 and because there is bound to be some switch-bounce too.
which monitors the status of S1 and because there is bound to be some switch-bounce too.
which monitors the status of S1 and because there is bound to be some switch-bounce too.

12

Mini Project 2009

Programmable Robot Using PICAXE-08M

PICAXE-08M MICROCONTROLLER

A PICAXE microcontroller is a standard Microchip PICmicro™ microcontroller that has been pre-programmed with the PICAXE bootstrap code. A PIC microcontroller is a single integrated circuit small enough to fit in the palm of a hand. ‘Traditional’ microprocessor circuits contain four or five separate integrated circuits - the microprocessor (CPU) itself, an EPROM program memory chip, some RAM memory and an input/output interface. With PIC microcontrollers all these functions are included within one single package, making them cost effective and easyto use.PIC microcontrollers can be used as the ‘brain’ to control a large variety of products. In order to control devices, it is necessary to interface (or ‘connect’) them to the PIC microcontroller. This section will help to enable those with limited electronics experience to successfully complete these interfacing tasks.The bootstrap code enables the PICAXE microcontroller to be re-programmed directly via a simple serial connection. The PICAXE-08M IS based on PIC12F683 .The monitor program uses all of the flash memory and the program is stored in EEPROM (256 bytes).

The PICAXE-08M offers:

80 lines memory 1-4 inputs (configurable) 1-4 outputs (configurable)
1-4 inputs (configurable) 80 lines memory 1-4 outputs (configurable)
1-4 outputs (configurable)80 lines memory 1-4 inputs (configurable)

2 8/10-bit Analog-to-Digital converters (ADC) 8MHz maximum operation speed (4MHz normally) Supports
8MHz maximum operation speed (4MHz normally) 2 8/10-bit Analog-to-Digital converters (ADC) Supports
Supports2 8/10-bit Analog-to-Digital converters (ADC) 8MHz maximum operation speed (4MHz normally)

o

Interrupts

o

Digital temperature sensors

(ADC) 8MHz maximum operation speed (4MHz normally) Supports o Interrupts o Digital temperature sensors 13
(ADC) 8MHz maximum operation speed (4MHz normally) Supports o Interrupts o Digital temperature sensors 13
(ADC) 8MHz maximum operation speed (4MHz normally) Supports o Interrupts o Digital temperature sensors 13

13

Mini Project 2009

o

Servo control

o

IR transmit/receive

o

Plays user-defined musical tones

o

PWM Motor control

The PICAXE Memory

Programmable Robot Using PICAXE-08M

The PICAXE memory consists of three different areas. The amount of memory varies between PICAXE types.

Program Memory.

Program memory is where the program is stored after a new download. This is ‘FLASH’ rewritable memory that can be reprogrammed up to (typically) 100,000times. The program is not lost when power is removed, so the program will start running again as soon as the power is re connected. It is not generally required to erase a program, as each download automatically over-writes the whole of the last program. However if you want to stop a program running you can use the PICAXE>Clear Hardware Memory menu to download an ‘empty’ program into the PICAXE.The PICAXE-08M supports 80 lines or 256 bytes of BASIC program code.

Data Memory

Data memory is additional storage space within the microcontroller. The data is also not lost when power is removed. Each download resets all data bytes to 0, unless the EEPROM command has been used to ‘preload’ data into the data memory. See the EEPROM, read and write command descriptions for more details. On the PICAXE- 08M the data memory is ‘shared’ with the program memory Therefore larger programs will result is a smaller available data memory area.

is ‘shared’ with the program memory Therefore larger programs will result is a smaller available data
is ‘shared’ with the program memory Therefore larger programs will result is a smaller available data
is ‘shared’ with the program memory Therefore larger programs will result is a smaller available data

14

Mini Project 2009

RAM (Variables)

Programmable Robot Using PICAXE-08M

The RAM memory is used to store temporary data in variables as the program runs. It loses all data when the power is removed. There are four types of variable general purpose, storage, scratchpad and special function. Variables are memory locations within the PICAXE microcontroller that store data whilst the program is running. All this information is lost when the microcontroller is reset.

General Purpose Variables.

There are 14 or more general purpose byte variables. These byte variables are labeled b0, b1 etc. Byte variables can store integer numbers between 0 and 255.Byte variables cannot use negative numbers or fractions, and will ‘overflow’ without warning if you exceed the 0 or 255 boundary values (e.g. 254 + 3 = 1),(2 - 3 = 255)

Storage Variables.

Storage variables are additional memory locations allocated for temporary storage of byte data. They cannot be used in mathematical calculations, but can be used to temporarily store byte values by use of the peek and poke commands.PICAXE-08M uses 48variables, 80 to 127 ($50 to $7F).

Special Function Variables (SFR)

The special function variables available for use depend on the PICAXE type.

PICAXE-08M SFR

pins = the input / output port dirs = the data direction register (sets whether pins are inputs or outputs) infra =
dirs = the data direction register (sets whether pins are inputs or outputs) pins = the input / output port infra = another term for variable b13, used within
infra = another term for variable b13, used within the infrain2 commandpins = the input / output port dirs = the data direction register (sets whether pins

(sets whether pins are inputs or outputs) infra = another term for variable b13, used within
(sets whether pins are inputs or outputs) infra = another term for variable b13, used within
(sets whether pins are inputs or outputs) infra = another term for variable b13, used within

15

Mini Project 2009

Programmable Robot Using PICAXE-08M

FUNCTIONAL BLOCK DIAGRAM OF PICAXE-08M

Mini Project 2009 Programmable Robot Using PICAXE-08M FUNCTIONAL BLOCK DIAGRAM OF PICAXE-08M 16
Mini Project 2009 Programmable Robot Using PICAXE-08M FUNCTIONAL BLOCK DIAGRAM OF PICAXE-08M 16
Mini Project 2009 Programmable Robot Using PICAXE-08M FUNCTIONAL BLOCK DIAGRAM OF PICAXE-08M 16
Mini Project 2009 Programmable Robot Using PICAXE-08M FUNCTIONAL BLOCK DIAGRAM OF PICAXE-08M 16

16

Mini Project 2009

Programmable Robot Using PICAXE-08M

THE MOTOR DRIVER CIRCUIT

Programmable Robot Using PICAXE-08M THE MOTOR DRIVER CIRCUIT The motor driver circuit is built around the

The motor driver circuit is built around the high current half H -Bridge IC LN 293D. For each motor connected, if the Enable is kept high and DIR1 is made high, then the motor will rotate in the clockwise direction. If Enable and DIR2 is made high, then the motor will rotate in the ant-clockwise direction. If both DIR1 and DIR2 are kept at high, then the motor will remain static. If enable is low, then the motor remains static. The inputs DIR1 and DIR2 of each motor are driven by outputs from the Pin 3(P4) and Pin 5(P2) of the PICAXE.

The IC L293D is a quadruple high-current half h-Drive. The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. It is designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high-current/high-voltage loads in positive-supply applications. All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistor sink and a pseudo- Darlington source. Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an

Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3
Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3
Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3

17

Mini Project 2009

Programmable Robot Using PICAXE-08M

enable input is high the associated drivers are enabled and their outputs are active and in phase with their inputs. When the ena ble input is low, those drivers are disabled and their outputs are off and in the high-impedance state. With the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible drive suitable for solenoid or motor applications. A VCC1 terminal, separate from VCC2, is provided for the logic inputs to minimize device power dissipation. The L293D is characterized for operation from 0°C to

70°C.

for the logic inputs to minimize device power dissipation. The L293D is characterized for operation from
for the logic inputs to minimize device power dissipation. The L293D is characterized for operation from
for the logic inputs to minimize device power dissipation. The L293D is characterized for operation from
for the logic inputs to minimize device power dissipation. The L293D is characterized for operation from
for the logic inputs to minimize device power dissipation. The L293D is characterized for operation from

18

Mini Project 2009

Absolute maximum ratings

Programmable Robot Using PICAXE-08M

Supply voltage,

.

.

.

.

.

.

.

.

36 V

Output supply voltage, VCC2

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

36 V

Input voltage, VI Output voltage range,

.

.

.

.

.

.

.

.

.

.

.

.

. 7

V

. 3 V to VCC2 + 3 V

.

.

.

.

.

.

.

.

.

.

.

.

Peak output current, IO

 

±1.2 A

Continuous output current, IO: L293

 

.…

 

.

.

.

.

.

.

.

.

.

.

.

.

±1 A

Continuous output current, IO:

 

±600 mA

Continuous total dissipation at (or below) 25°C free-air temperature …………….2075 mW

5000 mW

Continuous total dissipation at 80°C case temperature Maximum junction temperature,

150°C

Lead temperature………………… Storage temperature range, Tstg

.

.

.

.

.

.

… . 260°C –65°C to 150°C

Le ad temperature………………… Storage temperature range, Tstg . . . . . . … . 260°C
Le ad temperature………………… Storage temperature range, Tstg . . . . . . … . 260°C
Le ad temperature………………… Storage temperature range, Tstg . . . . . . … . 260°C

19

Mini Project 2009

LIST OF COMPONENTS

Programmable Robot Using PICAXE-08M

COMPONENT

DESCRIPTION

QUANTITY

PICAXE-08M

MICROCONTROLLER

1

L293D

MOTOR DRVER IC

1

BC 547

 

2

VOLTAGE

L7805,5V

1

REGULATOR

RESISTORS

R1",22k,

¼ WATT

R2",10k,

R5",10k,

R6",10k,

R3",1k,

R4",1k,

R7",330,

R8",330,

R9",47k,

10K POT

CAPACITORS

C1",100n, C2",100n,

 

C3",100u,

C4",100u,

C5",10u,

LDR

 

1

SPEAKER

 

1

CONNECTOR

 

1

DIODE

1N4001

1

BUMP SWITCH

 

1

LDR   1 SPEAKER   1 CONNECTOR   1 DIODE 1N4001 1 BUMP SWITCH   1
LDR   1 SPEAKER   1 CONNECTOR   1 DIODE 1N4001 1 BUMP SWITCH   1
LDR   1 SPEAKER   1 CONNECTOR   1 DIODE 1N4001 1 BUMP SWITCH   1

20

Mini Project 2009

Programmable Robot Using PICAXE-08M

PCB LAYOUT

Mini Project 2009 Programmable Robot Using PICAXE-08M PCB LAYOUT 21
Mini Project 2009 Programmable Robot Using PICAXE-08M PCB LAYOUT 21
Mini Project 2009 Programmable Robot Using PICAXE-08M PCB LAYOUT 21
Mini Project 2009 Programmable Robot Using PICAXE-08M PCB LAYOUT 21
Mini Project 2009 Programmable Robot Using PICAXE-08M PCB LAYOUT 21

21

Mini Project 2009

Programmable Robot Using PICAXE-08M

PROGRAMMING THE PICAXE

The serial download circuit is identical for all PICAXE chips. It consists of 3 wires from the PICAXE chip to the AXE026 serial cable. One wire sends data from the computer to the serial input of the PICAXE, one wire transmits data from the serial output of the PICAXE to the computer, and the third wire provides a common ground. See the USB adapter section for details on how to use the USB port adapter. The minimum download circuit is shown here. This circuit is appropriate for most educational and hobbyist work.

is appropriate for most educational and hobbyist work. Picaxe Programming Editor The programs are edited and
is appropriate for most educational and hobbyist work. Picaxe Programming Editor The programs are edited and

Picaxe Programming Editor The programs are edited and compiled in Picaxe Programming editor,which is provided by the manufacturer.It also have a built in simulator to debug the programs created by the user.The programs are written and compiled in BASIC and saved with .bas extension.They are then downloaded to the Microcontroller with the help of the serial download cable.

saved with .bas extension.They are then downloaded to the Microcontroller with the help of the serial
saved with .bas extension.They are then downloaded to the Microcontroller with the help of the serial
saved with .bas extension.They are then downloaded to the Microcontroller with the help of the serial

22

Mini Project 2009

Picaxe programming editor

Programmable Robot Using PICAXE-08M

Mini Project 2009 Picaxe programming editor Programmable Robot Using PICAXE-08M Serial Download Cable 23

Serial Download Cable

Mini Project 2009 Picaxe programming editor Programmable Robot Using PICAXE-08M Serial Download Cable 23
Mini Project 2009 Picaxe programming editor Programmable Robot Using PICAXE-08M Serial Download Cable 23
Mini Project 2009 Picaxe programming editor Programmable Robot Using PICAXE-08M Serial Download Cable 23
Mini Project 2009 Picaxe programming editor Programmable Robot Using PICAXE-08M Serial Download Cable 23

23

Mini Project 2009

Programmable Robot Using PICAXE-08M

FLOWCHART AND PROGRAM DESCRIPTION

The program used three variable memory spaces b0,b1 and b2 to store the adc reading corresponding to light intensities at front,left side and right side of the robot. The direction of motion was then determined by comparing these variables. MAIN PROGRAM:

and right side of the robot. The direction of motion was then determined by comparing these
and right side of the robot. The direction of motion was then determined by comparing these
and right side of the robot. The direction of motion was then determined by comparing these
and right side of the robot. The direction of motion was then determined by comparing these

24

Mini Project 2009

SUBROUTINES

Programmable Robot Using PICAXE-08M

Mini Project 2009 SUBROUTINES Programmable Robot Using PICAXE-08M 25
Mini Project 2009 SUBROUTINES Programmable Robot Using PICAXE-08M 25
Mini Project 2009 SUBROUTINES Programmable Robot Using PICAXE-08M 25
Mini Project 2009 SUBROUTINES Programmable Robot Using PICAXE-08M 25
Mini Project 2009 SUBROUTINES Programmable Robot Using PICAXE-08M 25

25

Mini Project 2009

Programmable Robot Using PICAXE-08M

MAIN PROGRAM

pwm 1,21,30

PROGRAM

'start-up beep

'PWM is used here to circumvent a

' potential SOUND/READADC conflict

main:

if pin3=1 then reverseout 'reverse if S1 bumper bar closes

pause 2000 readadc 1,b1 gosub checkleft readadc 1,b0 gosub checkright readadc 1,b2 if b0<b2 then left

'pause for two seconds 'check light level directly in front 'turn left, using subroutine 'check light level to the left 'turn right, using subroutine 'check light level to the right 'if the left is brighter than the right,

if b1<b0 then left

' turn left, using subroutine 'if directly in front is brighter than

goto main

the left, provisionally use subroutine 'repeat the process

'

reverseout:

pwm 1,21,20 high 2 high 4 high 0 for b0=0 to 40 pwm 1,b0,10

'beep 'left motor backwards 'right motor backwards 'turn both motors on 'add a sound effect while reversing '

by varying the PWM duty cycle

motor backwards 'turn both motors on 'add a sound effect while reversing ' by varying the
motor backwards 'turn both motors on 'add a sound effect while reversing ' by varying the
motor backwards 'turn both motors on 'add a sound effect while reversing ' by varying the

26

Mini Project 2009

next b0 low 2 backwards) pause 1800 low 0 goto main

Programmable Robot Using PICAXE-08M

'

'left motor forwards (and right

from 0 to 40

'

for 1.8 seconds

'turn both motors off

checkleft:

high 2

'left motor backwards

for 0.6 seconds

low 4

'right motor forwards

high 0

'turn both motors on

pause 600

'

low 0

'turn both motors off

return

'return to where the main program

left off

checkright:

low 2 high 4 high 0 pause 1200 low 0 return

left:

if b1<b0 then middle brighter

'left motor forwards

'right motor backwards 'turn both motors on '

for 1.2 seconds 'turn both motors off

'skip this if directly in front is

 

'

than the left, using subroutine middle

high 2

'left motor backwards

low 4

'right motor forwards

than the left, using subroutine middle high 2 'left motor backwards low 4 'right motor forwards
than the left, using subroutine middle high 2 'left motor backwards low 4 'right motor forwards
than the left, using subroutine middle high 2 'left motor backwards low 4 'right motor forwards

27

Mini Project 2009

high 0 pause 1200 low 0 goto straight goto main

middle:

high 2 low 4 high 0 pause 600 low 0 goto straight goto main

straight:

low 2 low 4 high 0 pause 1200 low 0 goto main

Programmable Robot Using PICAXE-08M

'turn both motors on '

'turn both motors off 'drive straight ahead, using subroutine

for 1.2 seconds

'left motor backwards 'right motor forwards 'turn both motors on '

'turn both motors off 'drive straight ahead, using subroutine

for 0.6 seconds

'left motor forwards 'right motor forwards 'turn both motors on '

'turn both motors off

for 1.2 seconds

LDR ADJUST PROGRAM ;LDR TEST ;this adjusts VR1 to suit LDR1 and lighting conditions ;b3=160 when the LDR is directed at the darkest areas of a room ;aim for the widest variation in b3 as the LDR surveys a scene ;keep the jack plug inserted in the robot while taking readings

the widest variation in b3 as the LDR surveys a scene ;keep the jack plug inserted
the widest variation in b3 as the LDR surveys a scene ;keep the jack plug inserted
the widest variation in b3 as the LDR surveys a scene ;keep the jack plug inserted

28

Mini Project 2009

Programmable Robot Using PICAXE-08M

main:

goto main

readadc 1,b3

debug b3

pause 100 ;pause 0.1 seconds

;read the light level

;display the light level on screen (watch b3)

;repeat the procedure

pause 100 ;pause 0.1 seconds ;read the light level ;display the light level on screen (watch
pause 100 ;pause 0.1 seconds ;read the light level ;display the light level on screen (watch
pause 100 ;pause 0.1 seconds ;read the light level ;display the light level on screen (watch

29

Mini Project 2009

Programmable Robot Using PICAXE-08M

APPLICATION

The circuit could operate a pulley system, serve as a line-tracker or rotate motors in response to broken beams of varying intensity without modification to the PC board.

a line-tracker or rotate motors in response to broken beams of varying intensity without modification to
a line-tracker or rotate motors in response to broken beams of varying intensity without modification to
a line-tracker or rotate motors in response to broken beams of varying intensity without modification to

30

Mini Project 2009

Programmable Robot Using PICAXE-08M

CONCLUSION

The Programmable Robot was constructed successfully, yielding satisfactory results. The robot is capable of moving towards areas having a higher light intensities and avoids obstructions in its path.

The robot is capable of moving towards areas having a higher light intensities and avoids obstructions
The robot is capable of moving towards areas having a higher light intensities and avoids obstructions
The robot is capable of moving towards areas having a higher light intensities and avoids obstructions

31

Mini Project 2009

Programmable Robot Using PICAXE-08M

FUTURE SCOPE

The Programmable robot has a tremendous scope for improvement . Some of the possible improvements are listed below.

Instead of using a single LDR, three LDR s can be used so that the robot needn’t turn every time to read the light intensities on its sides. the robot needn’t turn every time to read the light intensities on its sides.

With effective programming, the robot can be configured to do multitasks.turn every time to read the light intensities on its sides. With a more advanced Microcontroller

With a more advanced Microcontroller like Picaxe 14M or 28M,more sensors and output modules can be integrated to the robot.to read the light intensities on its sides. With effective programming, the robot can be configured

a more advanced Microcontroller like Picaxe 14M or 28M,more sensors and output modules can be integrated
a more advanced Microcontroller like Picaxe 14M or 28M,more sensors and output modules can be integrated
a more advanced Microcontroller like Picaxe 14M or 28M,more sensors and output modules can be integrated

32

Mini Project 2009

Programmable Robot Using PICAXE-08M

BIBLIOGRAPHY

1. Ramakanth A.Gayakwad : Op-Amps and Linear Integrated

Circuits

2. R S Sedha: Applied Electronics

3. Paul Horowitz and Winfield Hill: The Art of Electronics

Linear Integrated Circuits 2. R S Sedha: Applied Electronics 3. Paul Horowitz and Winfield Hill: The
Linear Integrated Circuits 2. R S Sedha: Applied Electronics 3. Paul Horowitz and Winfield Hill: The
Linear Integrated Circuits 2. R S Sedha: Applied Electronics 3. Paul Horowitz and Winfield Hill: The

33

Mini Project 2009

Programmable Robot Using PICAXE-08M

REFERENCES

1. www.microchip.com

2. www.wikipedia.com

3. www.roboticsindia.com

4. www.electro-tech-online.com

5. www.howstuffworks.com

4. www.electro-tech-online.com 5. www.howstuffworks.com 6. www.picaxe.co.uk 7. http://www.picaxeforum.co.uk 34
4. www.electro-tech-online.com 5. www.howstuffworks.com 6. www.picaxe.co.uk 7. http://www.picaxeforum.co.uk 34
4. www.electro-tech-online.com 5. www.howstuffworks.com 6. www.picaxe.co.uk 7. http://www.picaxeforum.co.uk 34

34