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

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 THA


NKAPPAN PREJITH S RAFAH ABDUL GAFOOR Department of Applied Electronics & Instrum
entation Engineering GOVERNMENT ENGINEERING COLLEGE KOZHIKODE-673 005 OCTOBER 20
09 Mini Project 2009 Programmable Robot Using PICAXE-08M ACKNOWLEDGEMENTS We wo
uld 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 EN
GINEERING COLLEGE KOZHIKODE Department of Applied Electronics & Instrumentation
Engineering CERTIFICATE Certified that this is the bonafide record of the mini p
roject work titled PROGRAMMABLE ROBOT BASED ON PICAXE-08 done by Nithin KP, Pree
thy 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 o
f
University of Calicut.
Mini project Co-ordinator Head of Department Ast.Prof . SHAJAHAN ES Prof. P REEN
A Mini Project 2009 Programmable Robot Using PICAXE-08M ABSTRACT This project e
xplores 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 ove
r 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 D
iagram 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. Applicati
ons 13. Conclusion 14. Future Scope 15. Bibliography 16. References Mini Projec
t 2009 Programmable Robot Using PICAXE-08M 1 INTRODUCTION Robotics is the engine
ering science and technology ofr obot s, and their design, manufacture, and appl
ication. Robotics is related to electronics, mechanics, and software. Robotics i
s 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.
Mini Project 2009 Programmable Robot Using PICAXE-08M 2 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.
Mini Project 2009 Programmable Robot Using PICAXE-08M 3 FUNCTIONAL BLOCK DIAGRA
M The functional block diagram shows the interrelationship between different blo
cks of the robot.The center of the robot s control system is PICAXE-08M microcontr
oller.The microcontroller listens to inputs
from the light sensing circuit and the obstruction d etection circuit.
The microcontroller triggers the motor driving circuit according to
the inputs from light sensing circuit and obstruction detection circuit.
LIGHT SENSING PICAXE-08M OBSTRUCTION DETECTION SOUND OUTPUT MOTOR DRIVER L MOTOR
R MOTOR Mini Project 2009 Programmable Robot Using PICAXE-08M 4 The motor driv
ing 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.
Mini Project 2009 Programmable Robot Using PICAXE-08M 5 COMPONENT DESCRIPTION P
ICAXE-08M MICROCONTROLLER A PICAXE microcontroller is a standard Microchip PICmi
cro
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.
The PICAXE system exploits the unique characteristics of the new generation of l
ow-cost FLASH memory based microcontrollers. These microcontrollers can be program
med over and over again
Mini Project 2009 Programmable Robot Using PICAXE-08M 7 BC 547 BC547 is NPN Sil
icon 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.
7805 VOLTAGE REGULATOR A voltage regulator maintains the supply voltage at a con
stant 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.
Mini Project 2009 Programmable Robot Using PICAXE-08M 8 9V BATTERY To ensure sm
ooth and continuous operation of the robot, 9V dc
battery was used.The supply voltage was regulated to 5V with the
regulator circuit.
LDR The light sensing circuit of the robot consists of mainly an LDR.Its resista
nce varies with the variations in the light intensity falling on it. 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 we
re used.
6 Volts DC motors Mini Project 2009 Programmable Robot Using PICAXE-08M 9 Weight
=9 0 gm s Rated Voltage = DC 6V No-load current < 60mA Load current < 300mA BUZ
ZER A 6V buzzer was used to give audio indication of an obstruction being detect
ed by the robot. Mini Project 2009 Programmable Robot Using PICAXE-08M 10 CIRCU
IT DIAGRAM The circuit diagram of the robot is given below. 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 co
mmunicates 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.
Mini Project 2009 Programmable Robot Using PICAXE-08M 11 Pinout diagram of PICA
XE-08M 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 speci
al effects. When it is high , the motors are on; when it is low they are off.Pin 5 (P
2) 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 n
ot 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 b
umper 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 leve
l at the front of the robot. Note that this first requires the correct adjustmen
t of VR1 with the help of the LDR Mini Project 2009 Programmable Robot Using PI
CAXE-08M 12 ADJUST program. The robot is capable of detecting sixteen levels of
light which may be used for light-seeking (or light-avoidance), line tracking an
d day-night sensing. Pin 7 (P0) activates both motors simultaneously via the L29
3D 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 mo
tors 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 c
losed, pin 4 is pulled high. The 10µF capacitor and the 47k?r esi st or determine
how long a bump will be remembered and the values of these components may be modif
ed as desired. These components are required because the software, as it execute
s, 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. Mini Project 2009 Programmable Robot Using PICAXE-08
M 13 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 i
n the palm of a hand. Traditional microprocessor circuits contain four or five sep
arate integrated
circuits - the microprocessor (CPU) itself, an EPROM program memory chip, some R
AM memory and an input/output interface. With PIC microcontrollers all these fun
ctions are included within one single package, making them cost effective and ea
syto 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 electr
onics experience to successfully complete these interfacing tasks.The bootstrap
code enables the PICAXE microcontroller to be re-programmed directly via a simpl
e serial connection. The PICAXE-08M IS based on PIC12F683 .The monitor program u
ses 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)
2 8/10-bit Analog-to-Digital converters (ADC)
8MHz maximum operation speed (4MHz normally)
Supports oInterrupts oDigital temperature sensors Mini Project 2009 Programmabl
e Robot Using PICAXE-08M 14 oServo control
oIR transmit/receive
oPlays user-defined musical tones
oPWM Motor control
The PICAXE Memory The PICAXE memory consists of three different areas. The amoun
t 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. Mini Project 2009 Programmable Robot Using PICAXE-08M 15 RAM
(Variables) 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 nu
mbers 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 var
iables 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 us
e 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 = another term for variable b13, used within the infrain2
command
Mini Project 2009 Programmable Robot Using PICAXE-08M 16 FUNCTIONAL BLOCK DIAGR
AM OF PICAXE-08M Mini Project 2009 Programmable Robot Using PICAXE-08M 17 THE M
OTOR DRIVER CIRCUIT The motor driver circuit is built around the high current ha
lf 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 th e 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 3
6 V. It is designed to drive inductive loads such as relays, solenoids, dc and b
ipolar stepping motors, as well as other high-current/high-voltage loads in posi
tive-supply applications. All inputs are TTL compatible. Each output is a comple
te totem-pole drive circuit, with a Darlington transistor sink and a pseudo- Dar
lington 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
Mini Project 2009 Programmable Robot Using PICAXE-08M 18 enable input is high t
he 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 the
ir 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 s
olenoid or motor applications. A VCC1 terminal, separate from VCC2, is provided
for the logic inputs to minimize device power dissipation. The L293D is characte
rized for operation from 0°C to 70°C.
Mini Project 2009 Programmable Robot Using PICAXE-08M 19 Absolute maximum ratin
gs Supply voltage, VCC1. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . .. 36 V Output supply voltage, VCC2 ........... .................. 36
V Input voltage, VI . . . . . . . . . . . . . . . .. . . . . . . . . . . . . .
. . . . . . . . . . . 7 V Output voltage range, VO.. . ..... ..... .... ... 3 V to
VCC2 + 3 V Peak output current, IO. . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . ±1.2 A Continuous output current, IO: L293. . . . .... . . . .. .
. . . . . . . . . ±1 A Continuous output current, IO: L293D...... .. ... ..... .. ±6
00 mA Continuous total dissipation at (or below) 25°C free-air temperature
. . . . . . .2075 mW Continuous total dissipation at 80°C case
Maximum junction temperature, TJ.. ..... ... ... ... 150°C
Lead temperature . .. . . . . . . . . . . . .. . . . . . 260°C
Storage temperature range, Tstg...... .... 65°C to 150°C
Mini Project 2009 Programmable Robot Using PICAXE-08M 20 LIST OF COMPONENTS COM
PONENT DESCRIPTION QUANTITY PICAXE-08M MICROCONTROLLER 1 L293D MOTOR DRVER IC 1
BC 547 2 VOLTAGE REGULATOR L7805,5V 1 RESISTORS R1",22k,
R2",10k,
R5",10k,
R6",10k,
R3",1k,
R4",1k,
R7",330, R8",330, R9",47k, 10K POT
¼ WATT CAPACITORS C1",100n, C2",100n,
C3",100u,
C4",100u,
C5",10u,
LDR 1 SPEAKER 1 CONNECTOR 1 DIODE 1N4001 1 BUMP SWITCH 1 Mini Project 2009 Prog
rammable Robot Using PICAXE-08M 21 PCB LAYOUT Mini Project 2009 Programmable Ro
bot Using PICAXE-08M 22 PROGRAMMING THE PICAXE The serial download circuit is id
entical 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 t
he computer, and the third wire provides a common ground. See the USB adapter se
ction for details on how to use the USB port adapter. The minimum download circu
it is shown here. This circuit is appropriate for most educational and hobbyist
work.
Picaxe Programming Editor The programs are edited and compiled in Picaxe Program
ming
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.
Mini Project 2009 Programmable Robot Using PICAXE-08M 23 Picaxe programming edi
tor Serial Download Cable Mini Project 2009 Programmable Robot Using PICAXE-08M
24 FLOWCHART AND PROGRAM DESCRIPTION The program used three variable memory spa
ces 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: Mini Project 2009 Programmable Robot Using PICAXE-08M 25 SUBROUTI
NES Mini Project 2009 Programmable Robot Using PICAXE-08M 26 PROGRAM MAIN PROGR
AM pwm 1,21,30 'start-up beep 'PWM is used here to circumvent a ' potential SOUN
D/READADC conflict main: if pin3=1 then reverseout 'reverse if S1 bumper bar clo
ses pause 2000 'pause for two seconds readadc 1,b1 'check light level directly i
n front gosub checkleft 'turn left, using subroutine readadc 1,b0 'check light l
evel to the left gosub checkright 'turn right, using subroutine readadc 1,b2 'ch
eck light level to the right if b0<b2 then left 'if the left is brighter than th
e right, ' turn left, using subroutine if b1<b0 then left 'if directly in front
is brighter than ' the left, provisionally use subroutine goto main 'repeat the
process reverseout: pwm 1,21,20 'beep high 2 'left motor backwards high 4 'right
motor backwards high 0 'turn both motors on for b0=0 to 40 'add a sound effect
while reversing pwm 1,b0,10 ' by varying the PWM duty cycle Mini Project 2009 P
rogrammable Robot Using PICAXE-08M 27 next b0 ' from 0 to 40 low 2 'left motor f
orwards (and right backwards) pause 1800 ' for 1.8 seconds low 0 'turn both moto
rs off goto main checkleft: high 2 'left motor backwards low 4 'right motor forw
ards high 0 'turn both motors on pause 600 ' for 0.6 seconds low 0 'turn both mo
tors off return 'return to where the main program left off checkright: low 2 'le
ft motor forwards high 4 'right motor backwards high 0 'turn both motors on paus
e 1200 ' for 1.2 seconds low 0 'turn both motors off return left: if b1<b0 then
middle 'skip this if directly in front is brighter ' than the left, using subrou
tine middle high 2 'left motor backwards low 4 'right motor forwards Mini Proje
ct 2009 Programmable Robot Using PICAXE-08M 28 high 0 'turn both motors on pause
1200 ' for 1.2 seconds low 0 'turn both motors off goto straight 'drive straigh
t ahead, using subroutine goto main middle: high 2 'left motor backwards low 4 '
right motor forwards high 0 'turn both motors on pause 600 ' for 0.6 seconds low
0 'turn both motors off goto straight 'drive straight ahead, using subroutine g
oto main straight: low 2 'left motor forwards low 4 'right motor forwards high 0
'turn both motors on pause 1200 ' for 1.2 seconds low 0 'turn both motors off g
oto main 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 ja
ck plug inserted in the robot while taking readings Mini Project 2009 Programma
ble Robot Using PICAXE-08M 29 main:readadc 1,b3 ;read the light level
debug b3 ;display the light level on screen (watch b3)
pause 100 ;pause 0.1 seconds
goto main ;repeat the procedure Mini Project 2009 Programmable Robot Using PICA
XE-08M 30 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.
Mini Project 2009 Programmable Robot Using PICAXE-08M 31 CONCLUSION The Program
mable 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.
Mini Project 2009 Programmable Robot Using PICAXE-08M 32 FUTURE SCOPE The Progr
ammable robot has a tremendous scope for improvement . Some of the possible impr
ovements are listed below. Instead of using a single LDR, three LDR s can be use
d so that the robot needn t turn every time to read the light intensities on its s
ides. With effective programming, the robot can be configured to do multitasks.
With a more advanced Microcontroller like Picaxe 14M or 28M,more sensors and out
put modules can be integrated to the robot.
Mini Project 2009 Programmable Robot Using PICAXE-08M 33 BIBLIOGRAPHY 1. Ramaka
nth A.Gayakwad : Op-Amps and Linear Integrated Circuits
2. R S Sedha: Applied Electronics
3. Paul Horowitz and Winfield Hill: The Art of Electronics

Вам также может понравиться